update
This commit is contained in:
parent
879f94f720
commit
b685823869
@ -304,6 +304,11 @@ class SearchService:
|
||||
Classify user intent: 'SEARCH' (Public Internet) vs 'RAG' (Internal KB)
|
||||
Uses glm-4-flash for <300ms latency.
|
||||
"""
|
||||
# 0) 确定性兜底:明确公司内部话题一律走 RAG(避免 LLM 误判导致“走搜索”)
|
||||
normalized = (question or '').strip().lower()
|
||||
if any(neg_k in normalized for neg_k in cls.NEGATIVE_KEYWORDS) or any(k in normalized for k in ('康达新材', '康达')):
|
||||
return 'RAG'
|
||||
|
||||
if not SearchConfig.ZHIPUAI_API_KEY:
|
||||
# Fallback to simple keyword check if no key
|
||||
return 'SEARCH' if cls.should_handle(question) else 'RAG'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user