feat(faq): 缓存高频问题及答案,命中直接返回预置答案,不走dify

This commit is contained in:
sophie committed 2026-06-17 16:46:17 +08:00
1 parent 3264ed1e07
commit cf7cc11ffc
32 files changed
+3504 -180

No files matched your search

+14 -1
View File
@@ -1153,7 +1153,20 @@ def chat_completions():
from app.services.hr_leave_sqlserver import HRLeaveSQLServerService
leave_supported = HRLeaveSQLServerService.supports(query)
leave_feature_enabled = _can_use_leave_feature(agent_proxy)
if PLMOracleService.supports(query, agent_proxy):
from app.services.faq_cache import FaqCacheService
faq_hit = FaqCacheService.try_match(query, agent_id) if not normalized_files else None
if faq_hit:
generator = FaqCacheService.stream_chat(
faq_hit,
query,
user_proxy,
agent_proxy,
external_conversation_id,
session_id=session.session_id,
)
elif PLMOracleService.supports(query, agent_proxy):
generator = PLMOracleService.stream_chat(query, user_proxy, agent_proxy, external_conversation_id, session_id=session.session_id)
elif leave_supported and leave_feature_enabled:
if normalized_files: