diff --git a/engine/app/intent.py b/engine/app/intent.py index 7acc8e4..ef39406 100644 --- a/engine/app/intent.py +++ b/engine/app/intent.py @@ -23,10 +23,10 @@ _DOMAIN_RE = re.compile( # 明显跑题话题 _OFFTOPIC_RE = re.compile( - r"天气|气温|下雨|新闻|股票|基金|彩票|足球|篮球|电影|电视剧|游戏|" + r"天气|气温|下雨|新闻|股票|股市|股指|大盘|基金|彩票|足球|篮球|电影|电视剧|游戏|" r"笑话|段子|星座|运势|做饭|菜谱|旅游|机票|酒店|恋爱|八卦|" r"政治|选举|战争|加密货币|比特币|chatgpt|写诗|作文|数学题|" - r"编程作业|leetcode|今天吃什么", + r"编程作业|leetcode|今天吃什么|炒股|买股", re.I, ) @@ -74,10 +74,10 @@ def looks_off_topic(text: str) -> bool: return False # greeting/ack 另判 if looks_like_question(t): return True - # 较长文本却无任何业务词 → 视为跑题 - if len(t) >= 8 and not is_domain_related(t) and looks_like_question(t): + # 带疑问且无业务词 → 跑题 + if len(t) >= 4 and not is_domain_related(t) and looks_like_question(t): return True - if len(t) >= 16 and not is_domain_related(t): + if len(t) >= 10 and not is_domain_related(t): return True return False