- deployments + deployment_logs tables; desired/actual state reconciled by the worker (create/start/stop/remove via the socket proxy, /health wait, log follower, stats, memory guard, adopt/remove containers on restart). - Pure command builder for llama-server and vllm serve (mmproj, MTP draft, KV cache types, dtype, KV cache size) with tests; file candidates per engine with tests. - New main menu entry Deployments: list, new/edit form (runtime -> model and files -> launch options, live command preview), detail page with stats, log, endpoint and a streaming chat smoke test. Not yet tested end-to-end against real containers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
864 B
TypeScript
21 lines
864 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { z } from "zod";
|
|
import { withAuth } from "@/lib/api-auth";
|
|
import { apiError, handleApiError } from "@/lib/api-errors";
|
|
import { createDeployment, DeploymentBody, DeploymentError, listDeployments } from "@/lib/deployments";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export const GET = withAuth(async () => NextResponse.json(await listDeployments()));
|
|
|
|
/** Create a deployment; `start: true` starts it right away. */
|
|
export const POST = withAuth(async (req) => {
|
|
try {
|
|
const body = DeploymentBody.extend({ start: z.boolean().default(true) }).parse(await req.json());
|
|
return NextResponse.json(await createDeployment(body, body.start), { status: 201 });
|
|
} catch (err) {
|
|
if (err instanceof DeploymentError) return apiError(err.status, err.code, err.message);
|
|
return handleApiError(err);
|
|
}
|
|
});
|