对接HR系统的SQLserver数据库查数

This commit is contained in:
runny committed 2026-05-15 04:21:39 +08:00
1 parent 964e4925c0
commit 65b7ea8fa1
6 files changed
+371 -12

No files matched your search

+12 -2
View File
@@ -510,10 +510,20 @@ def chat_completions():
from app.services.dify import DifyService
if kb_type == 'ERP知识库':
from app.services.hr_leave_sqlserver import HRLeaveSQLServerService
from app.services.text2sql import Text2SQLService
generator = Text2SQLService.stream_chat(query, user.id, agent, conversation_id)
if HRLeaveSQLServerService.supports(query):
generator = HRLeaveSQLServerService.stream_chat(query, user, agent, conversation_id)
else:
generator = Text2SQLService.stream_chat(query, user.id, agent, conversation_id)
else:
generator = DifyService.stream_chat(query, user.id, agent, conversation_id)
from app.services.hr_leave_sqlserver import HRLeaveSQLServerService
if HRLeaveSQLServerService.supports(query):
generator = HRLeaveSQLServerService.stream_chat(query, user, agent, conversation_id)
else:
generator = DifyService.stream_chat(query, user.id, agent, conversation_id)
# 返回 SSE 响应,mimetype 设为 text/event-stream
return Response(