mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
fix(core): don't record a null tool reply to dialogue or TTS
When a tool result carries both response and result as None, `text = result.response if result.response else result.result` is None. That None was passed to tts_one_sentence/store_tts_text and written to the dialogue as an assistant message; it also made `text in streamed_text` raise TypeError when streamed_text was non-empty (None in str). Guard the whole RESPONSE/NOTFOUND/ERROR branch on `if text:` so empty/None tool replies are skipped entirely.
This commit is contained in:
parent
071ed99a32
commit
bc142abc8a
1 changed files with 9 additions and 8 deletions
|
|
@ -1257,6 +1257,7 @@ class ConnectionHandler:
|
||||||
Action.ERROR,
|
Action.ERROR,
|
||||||
]:
|
]:
|
||||||
text = result.response if result.response else result.result
|
text = result.response if result.response else result.result
|
||||||
|
if text:
|
||||||
if streamed_text and text in streamed_text:
|
if streamed_text and text in streamed_text:
|
||||||
self.logger.bind(tag=TAG).debug(
|
self.logger.bind(tag=TAG).debug(
|
||||||
f"Skipping duplicate TTS for tool {tool_call_data['name']}, already streamed"
|
f"Skipping duplicate TTS for tool {tool_call_data['name']}, already streamed"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue