From 811e219d2e050ec1fbc1a1bb85a13cabfa430fcf Mon Sep 17 00:00:00 2001 From: Jason Cox Date: Thu, 2 Jan 2025 22:07:36 -0800 Subject: [PATCH] Fix CoT handling to ensure proper status updates during processing --- chatbot/server.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chatbot/server.py b/chatbot/server.py index 6e6e430..1d9135d 100644 --- a/chatbot/server.py +++ b/chatbot/server.py @@ -902,13 +902,14 @@ async def send_update(session_id): # Send thinking status to client and ask LLM for answer await sio.emit('update', {'update': 'Thinking... ', 'voice': 'ai'},room=session_id) answer = await ask_context(temp_context) + await sio.emit('update', {'update': '\n\n', 'voice': 'ai'},room=session_id) # Load request for CoT conclusion into conversational thread cot_prompt = expand_prompt(prompts["chain_of_thought_summary"], {"context_str": answer, "prompt": client[session_id]["cot_prompt"]}) client[session_id]["prompt"] = cot_prompt except Exception as erro: log(f"CoT error - continuing with original prompt: {erro}") - await sio.emit('update', {'update': '\n\n', 'voice': 'ai'},room=session_id) + await sio.emit('update', {'update': '\n\n', 'voice': 'ai'},room=session_id) else: client_cot = False try: