|
|
|
@ -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 |
|
|
|
|