fixed chat

This commit is contained in:
2026-06-11 10:20:49 +03:00
parent 52ab7e1ac4
commit 363aca293a
2 changed files with 31 additions and 30 deletions
+2 -6
View File
@@ -243,9 +243,6 @@ class ChatService:
{"name": fn["name"], "result": json.loads(tool_result)}
)
if notices:
return "\n\n".join(notices), notices, pomodoro_events
followup = await self.llm.complete(
messages,
tools=None,
@@ -384,6 +381,7 @@ class ChatService:
{"name": fn["name"], "result": json.loads(result)},
)
yield self._sse("status", {"phase": "tools"})
for notice in round_notices:
yield self._sse("notice", {"content": notice})
@@ -394,9 +392,6 @@ class ChatService:
final_content = "".join(streamed_reply_parts).strip()
if not final_content and reasoning:
final_content = reasoning.strip()
if not final_content and all_tool_notices:
final_content = "\n\n".join(all_tool_notices)
yield self._sse("token", {"content": final_content})
if not final_content and tools_executed:
retry = await self.llm.complete(
messages,
@@ -407,6 +402,7 @@ class ChatService:
final_content = (retry.get("content") or "").strip()
if final_content:
yield self._sse("token", {"content": final_content})
# Notices уже в чате как role=notice — не дублируем в assistant.
if not final_content:
final_content, fb_notices, fb_pomodoro = await self._fallback_complete(
messages, session_id