teamsbot: Stop-Phrasen sofort triggern ohne Debounce (root cause fix)
Made-with: Cursor
This commit is contained in:
parent
f5fd1d2406
commit
86ede6d3df
1 changed files with 20 additions and 0 deletions
|
|
@ -778,6 +778,12 @@ class TeamsbotService:
|
||||||
if self.config.responseMode == TeamsbotResponseMode.TRANSCRIBE_ONLY:
|
if self.config.responseMode == TeamsbotResponseMode.TRANSCRIBE_ONLY:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Stop phrases: trigger immediately without debounce (root cause: 3s debounce delayed stop)
|
||||||
|
if self._isStopPhrase(text):
|
||||||
|
logger.info(f"Session {sessionId}: Stop phrase detected, triggering analysis immediately")
|
||||||
|
await self._analyzeAndRespond(sessionId, interface, voiceInterface, websocket, createdTranscript)
|
||||||
|
return
|
||||||
|
|
||||||
# Update activity for any pending debounced trigger
|
# Update activity for any pending debounced trigger
|
||||||
if self._pendingNameTrigger:
|
if self._pendingNameTrigger:
|
||||||
self._pendingNameTrigger["lastActivity"] = time.time()
|
self._pendingNameTrigger["lastActivity"] = time.time()
|
||||||
|
|
@ -855,6 +861,20 @@ class TeamsbotService:
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def _isStopPhrase(self, text: str) -> bool:
|
||||||
|
"""Check if text is a stop command (stop, halt, be quiet, etc.). Triggers immediate analysis."""
|
||||||
|
if not text or len(text.strip()) < 2:
|
||||||
|
return False
|
||||||
|
t = text.strip().lower()
|
||||||
|
words = [w.strip(".,!?:;\"'()[]") for w in t.split() if w.strip()]
|
||||||
|
wordSet = set(words)
|
||||||
|
stopWords = {"stop", "stopp", "halt", "ruhe", "stille", "schweig", "arrete", "quiet", "shut"}
|
||||||
|
if wordSet & stopWords:
|
||||||
|
return True
|
||||||
|
if "sei still" in t or "be quiet" in t or "shut up" in t or "aufhoeren" in t or "aufhören" in t:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def _detectBotName(self, text: str) -> bool:
|
def _detectBotName(self, text: str) -> bool:
|
||||||
"""Check if text contains the bot's name (exact or phonetically similar)."""
|
"""Check if text contains the bot's name (exact or phonetically similar)."""
|
||||||
botNameLower = self.config.botName.lower()
|
botNameLower = self.config.botName.lower()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue