Files
agent/app/modules/rag/intent_router_v2/followup_detector.py
T

23 lines
578 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from __future__ import annotations
class FollowUpDetector:
_MARKERS = (
"что дальше",
"почему",
"зачем",
"а что",
"уточни",
"подробнее",
"как именно",
"покажи подробнее",
)
def is_follow_up(self, raw: str) -> bool:
text = " ".join((raw or "").lower().split())
if not text:
return False
if len(text.split()) <= 4:
return True
return any(marker in text for marker in self._MARKERS)