feat: proxy POST /model/unload endpoint
All checks were successful
Build & Push Docker Image / build-and-push (push) Successful in 43s
All checks were successful
Build & Push Docker Image / build-and-push (push) Successful in 43s
- Add unloadModel() to whisper.ts: POSTs to /model/unload with 10s timeout, returns parsed JSON body, throws on non-ok response - Create src/routes/api/model/unload/+server.ts: thin POST proxy, passes whisper's response through, returns 502 if whisper unreachable - Add 3 unloadModel tests (success, WHISPER_URL config, error propagation) — 147/147 passing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
13
src/routes/api/model/unload/+server.ts
Normal file
13
src/routes/api/model/unload/+server.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import { unloadModel } from '$lib/server/whisper.js';
|
||||
|
||||
/** Proxy for POST /model/unload on the whisper backend. */
|
||||
export async function POST() {
|
||||
try {
|
||||
const body = await unloadModel();
|
||||
return json(body);
|
||||
} catch (err: unknown) {
|
||||
const message = err instanceof Error ? err.message : String(err);
|
||||
return json({ ok: false, error: message }, { status: 502 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user