fix(workflow): prevent fixed speech continuation

This commit is contained in:
Xin Wang
2026-08-03 13:02:31 +08:00
parent 4c43e167db
commit ef434c80b2
3 changed files with 63 additions and 16 deletions

View File

@@ -12,6 +12,20 @@ from services.brains.base import BrainRuntime
from services.runtime_variables import DynamicVariableStore
FIXED_SPEECH_CONTEXT_MARKER = "[会话事实:以下固定消息已向用户播报]"
def fixed_speech_context_message(content: str) -> dict[str, str] | None:
"""Keep deterministic speech in context without inviting assistant continuation."""
text = content.strip()
if not text:
return None
return {
"role": "system",
"content": f"{FIXED_SPEECH_CONTEXT_MARKER}\n{text}",
}
class FixedSpeechOutput:
"""Display and synthesize fixed speech without waiting for playback."""