diff --git a/dashboard/src/app/api/comfy/queue/route.ts b/dashboard/src/app/api/comfy/queue/route.ts index 7c1fc29..fdab843 100644 --- a/dashboard/src/app/api/comfy/queue/route.ts +++ b/dashboard/src/app/api/comfy/queue/route.ts @@ -1,4 +1,4 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; import { getComfyQueue } from "@/lib/docker"; export const dynamic = "force-dynamic"; @@ -6,12 +6,20 @@ export const runtime = "nodejs"; /** * GET /api/comfy/queue - * Returns current download queue via `docker exec model-worker python3 /app/worker.py queue`. + * + * Returns current download queue via `docker exec model-worker python3 + * /app/worker.py queue --json`. + * + * Returns 200 even when model-worker is offline (queue is empty in that + * case) — frontend polls this every 5s, returning 500 on every poll when + * worker isn't running would spam the browser console. */ export async function GET() { const result = await getComfyQueue(); - return NextResponse.json( - { ok: result.ok, queue: result.queue, raw: result.raw, error: result.error }, - { status: result.ok ? 200 : 500 } - ); + return NextResponse.json({ + ok: result.ok, + queue: result.queue, + raw: result.raw, + error: result.error, + }); } diff --git a/dashboard/src/app/api/llama/route.ts b/dashboard/src/app/api/llama/route.ts index 94dbe67..d120e71 100644 --- a/dashboard/src/app/api/llama/route.ts +++ b/dashboard/src/app/api/llama/route.ts @@ -17,13 +17,17 @@ export async function POST(req: NextRequest) { config?: Partial; }; + console.log("[/api/llama] action:", body.action, "config.model:", body.config?.model); + if (body.action === "start") { const current = await loadConfig(); const cfg: DashboardConfig = { ...current, ...(body.config || {}), } as DashboardConfig; + console.log("[/api/llama] merged cfg.model:", cfg.model); const result = await startLlama(cfg); + console.log("[/api/llama] startLlama result ok:", result.ok); return NextResponse.json(result, { status: result.ok ? 200 : 500 }); } diff --git a/dashboard/src/app/page.tsx b/dashboard/src/app/page.tsx index 5a5aa05..2ee0127 100644 --- a/dashboard/src/app/page.tsx +++ b/dashboard/src/app/page.tsx @@ -452,6 +452,7 @@ export default function DashboardPage() { async function handleStartLlama() { await runAction("start-llama", async () => { + // Persist config first so reloads restore it. const res = await fetch("/api/config", { method: "PUT", headers: { "Content-Type": "application/json" }, @@ -463,7 +464,17 @@ export default function DashboardPage() { headers: { "Content-Type": "application/json" }, body: JSON.stringify({ action: "start", config }), }); - return await startRes.json(); + const result = await startRes.json(); + // If start failed, include compose logs in the message so the user can + // see what went wrong (common cause: model-worker still on old image + // without --json flag, or env not set, etc). + if (!result.ok && result.logs) { + return { + ok: false, + message: `${result.message}\n\n${result.logs.slice(-500)}`, + }; + } + return result; }); } @@ -2125,10 +2136,13 @@ function Toast({ toast: { type: "success" | "error" | "info"; message: string }; onClose: () => void; }) { + // If message has multiple lines, render as pre-formatted text (so logs are + // readable); otherwise normal flow. + const isMultiLine = toast.message.includes("\n"); return (
- {toast.message} + {isMultiLine ? ( +
+            {toast.message}
+          
+ ) : ( + {toast.message} + )}