|
|
|
@ -53,6 +53,12 @@ function startMockLlm(): Promise<void> { |
|
|
|
let parsed: any = {}; |
|
|
|
try { parsed = JSON.parse(body); } catch { parsed = {}; } |
|
|
|
const model = parsed.model || "mock-model"; |
|
|
|
const systemMsg = Array.isArray(parsed.messages) |
|
|
|
? parsed.messages.find((m: any) => m.role === "system") |
|
|
|
: undefined; |
|
|
|
if (systemMsg?.content) { |
|
|
|
(globalThis as any).__lastMockSystemPrompt = systemMsg.content; |
|
|
|
} |
|
|
|
const chars = Array.from(MOCK_REPLY); |
|
|
|
res.writeHead(200, { |
|
|
|
"Content-Type": "text/event-stream", |
|
|
|
|