diff --git a/tools/server/public/index.html.gz b/tools/server/public/index.html.gz index c104b1ca05..d2ac1ed257 100644 Binary files a/tools/server/public/index.html.gz and b/tools/server/public/index.html.gz differ diff --git a/tools/server/webui/src/lib/services/chat.ts b/tools/server/webui/src/lib/services/chat.ts index 22960cffdd..406231c171 100644 --- a/tools/server/webui/src/lib/services/chat.ts +++ b/tools/server/webui/src/lib/services/chat.ts @@ -985,19 +985,27 @@ export class ChatService { try { let chunk = ''; while (true) { - if (abortSignal?.aborted) break; + if (abortSignal?.aborted) { + break; + } const { done, value } = await reader.read(); - if (done) break; + if (done) { + break; + } - if (abortSignal?.aborted) break; + if (abortSignal?.aborted) { + break; + } chunk += decoder.decode(value, { stream: true }); const lines = chunk.split('\n'); chunk = lines.pop() || ''; for (const line of lines) { - if (abortSignal?.aborted) break; + if (abortSignal?.aborted) { + break; + } if (line.startsWith('data: ')) { const data = line.slice(6); @@ -1012,6 +1020,10 @@ export class ChatService { const timings = parsed.timings; const model = parsed.model; + if (parsed.stop) { + streamFinished = true; + } + if (model && !modelEmitted) { modelEmitted = true; onModel?.(model); @@ -1034,10 +1046,14 @@ export class ChatService { } } - if (abortSignal?.aborted) break; + if (streamFinished) { + break; + } } - if (abortSignal?.aborted) return; + if (abortSignal?.aborted) { + return; + } if (streamFinished) { onComplete?.(aggregatedContent, undefined, lastTimings, undefined);