fix: turn log type from text to jsonb

This commit is contained in:
bennykok 2024-01-31 00:31:00 +08:00
parent 4b37de9ec5
commit 7ae25aa162
6 changed files with 1326 additions and 4 deletions

View File

@ -0,0 +1,2 @@
ALTER TABLE "comfyui_deploy"."workflow_runs" DROP COLUMN "run_log";
ALTER TABLE "comfyui_deploy"."workflow_runs" ADD COLUMN "run_log" jsonb;

File diff suppressed because it is too large Load Diff

View File

@ -344,6 +344,13 @@
"when": 1706600255919, "when": 1706600255919,
"tag": "0048_dear_korath", "tag": "0048_dear_korath",
"breakpoints": true "breakpoints": true
},
{
"idx": 49,
"version": "5",
"when": 1706631744127,
"tag": "0049_sweet_hex",
"breakpoints": true
} }
] ]
} }

View File

@ -35,6 +35,15 @@ export async function POST(request: Request) {
run_log: log_data, run_log: log_data,
}) })
.where(eq(workflowRunsTable.id, run_id)); .where(eq(workflowRunsTable.id, run_id));
return NextResponse.json(
{
message: "success",
},
{
status: 200,
},
);
} }
if (status == "started" && time != undefined) { if (status == "started" && time != undefined) {

View File

@ -76,9 +76,7 @@ export async function RunDisplay({
<RunInputs run={run} /> <RunInputs run={run} />
<Suspense> <Suspense>
<RunOutputs run_id={run.id} /> <RunOutputs run_id={run.id} />
{run.run_log && ( {run.run_log && <LogsViewer logs={run.run_log} />}
<LogsViewer logs={JSON.parse(run.run_log) as LogsType} />
)}
</Suspense> </Suspense>
</div> </div>
{/* <div className="max-h-96 overflow-y-scroll">{view}</div> */} {/* <div className="max-h-96 overflow-y-scroll">{view}</div> */}

View File

@ -1,3 +1,4 @@
import { LogsType } from "@/components/LogsViewer";
import { CivitaiModelResponse } from "@/types/civitai"; import { CivitaiModelResponse } from "@/types/civitai";
import { type InferSelectModel, relations } from "drizzle-orm"; import { type InferSelectModel, relations } from "drizzle-orm";
import { import {
@ -173,7 +174,7 @@ export const workflowRunsTable = dbSchema.table("workflow_runs", {
machine_type: machinesType("machine_type"), machine_type: machinesType("machine_type"),
user_id: text("user_id"), user_id: text("user_id"),
org_id: text("org_id"), org_id: text("org_id"),
run_log: text("run_log"), run_log: jsonb("run_log").$type<LogsType>(),
}); });
export const workflowRunRelations = relations( export const workflowRunRelations = relations(