main
zc 2 months ago
parent 22c795c70e
commit 2e4c794c89
  1. 8
      app/api/chat/ai/chat_router.py
  2. 4
      app/api/chat/ai/chat_service.py

@ -80,6 +80,10 @@ async def h5_chat_stream(request: Request, inp: ChatIn):
async def content_stream() -> AsyncGenerator[str, None]:
global knowledge
nonlocal conversation_history
# 记录热门问题(包括快捷问题)
await record_hot_question(inp.message)
try:
if is_quick_question:
# 找到对应的问题内容
@ -112,9 +116,7 @@ async def h5_chat_stream(request: Request, inp: ChatIn):
# 只有非快捷问题才保存对话历史
if not is_quick_question:
await redis_client.setex(conversation_history_key, CONVERSATION_EXPIRE_TIME, json.dumps(conversation_history))
# 记录热门问题(包括快捷问题)
await record_hot_question(inp.message)
except Exception as e:
print(f"Error in content_stream: {e}")
raise

@ -91,7 +91,7 @@ ANSWER_PROMPT = """
输入数据格式
- 用户问题{msg}
- 查询到的数据{data}包含景区名称在园人数最大承载量进出人数等
- 查询到的数据{data}包含在园人数舒适度等级停车场数据等可能包含知识库内容
- 输出语言{language}
输出要求
@ -461,7 +461,7 @@ async def get_all_scenic_flow_data(request: Request) -> list:
cyjcpt_bd.zhly_video_manage t2 ON t1.mac_address = t2.mac_address
LEFT JOIN
cyjcpt_bd.zhly_scenic_basic t3 ON t2.video_scenic_id = t3.id
WHERE t3.`name` IS NOT NULL
WHERE t3.`name` IS NOT NULL AND DATE_FORMAT(t1.create_time,'%Y%m%d') = DATE_FORMAT(NOW(),'%Y%m%d')
GROUP BY
t3.`name`, t3.realtime_load_capacity
ORDER BY

Loading…
Cancel
Save