diff --git a/backend/open_webui/utils/response.py b/backend/open_webui/utils/response.py index 3debe63af..b8501e92c 100644 --- a/backend/open_webui/utils/response.py +++ b/backend/open_webui/utils/response.py @@ -26,7 +26,6 @@ async def convert_streaming_response_ollama_to_openai(ollama_streaming_response) ) line = f"data: {json.dumps(data)}\n\n" - if done: - line += "data: [DONE]\n\n" - yield line + + yield "data: [DONE]\n\n" diff --git a/src/lib/components/playground/Completions.svelte b/src/lib/components/playground/Completions.svelte index ef8f2dc9e..f370a2e0c 100644 --- a/src/lib/components/playground/Completions.svelte +++ b/src/lib/components/playground/Completions.svelte @@ -78,8 +78,7 @@ for (const line of lines) { if (line !== '') { - if (line === 'data: [DONE]') { - // responseMessage.done = true; + if (line.includes('[DONE]')) { console.log('done'); } else { let data = JSON.parse(line.replace(/^data: /, ''));