From 71cb593d634d16089637ba888a96846e912235fc Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 20 Sep 2026 05:52:45 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=B6=E7=B4=A7=E8=B7=91=E9=A2=98?= =?UTF-8?q?=E8=AF=86=E5=88=AB=EF=BC=8C=E9=81=BF=E5=85=8D=E8=82=A1=E5=B8=82?= =?UTF-8?q?=E7=AD=89=E9=97=B2=E8=81=8A=E5=86=99=E5=85=A5=E6=A7=BD=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: haijd --- engine/app/intent.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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