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:
Brad Shannon 2026-06-17 17:58:24 -04:00
parent 071ed99a32
commit bc142abc8a

View file

@ -1257,14 +1257,15 @@ 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 streamed_text and text in streamed_text: if text:
self.logger.bind(tag=TAG).debug( if streamed_text and text in streamed_text:
f"Skipping duplicate TTS for tool {tool_call_data['name']}, already streamed" self.logger.bind(tag=TAG).debug(
) f"Skipping duplicate TTS for tool {tool_call_data['name']}, already streamed"
else: )
self.tts.tts_one_sentence(self, ContentType.TEXT, content_detail=text) else:
self.tts.store_tts_text(self.sentence_id, text) self.tts.tts_one_sentence(self, ContentType.TEXT, content_detail=text)
self.dialogue.put(Message(role="assistant", content=text)) self.tts.store_tts_text(self.sentence_id, text)
self.dialogue.put(Message(role="assistant", content=text))
elif result.action == Action.REQLLM: elif result.action == Action.REQLLM:
need_llm_tools.append((result, tool_call_data)) need_llm_tools.append((result, tool_call_data))
elif result.action == Action.RECORD: elif result.action == Action.RECORD: