修改缓存记录的 bug

This commit is contained in:
Tian jianyong 2025-12-24 19:18:55 +08:00
parent c2d0c13948
commit 454febf7f3

View File

@ -218,6 +218,9 @@ async def converse_with_chat_assistant(
# 流式响应
if converse_params.stream:
# 注意:存储时使用清理后的问题(与查找时保持一致)
cache_question = cleaned_question if style_removed else converse_params.question
# 创建缓存存储回调函数
async def make_cache_store(chat_id: str, question: str):
async def store_answer(answer: str):
@ -229,7 +232,7 @@ async def converse_with_chat_assistant(
logger.warning(f'语义缓存存储失败: {e}')
return store_answer
cache_store = await make_cache_store(converse_params.chat_id, converse_params.question)
cache_store = await make_cache_store(converse_params.chat_id, cache_question)
return StreamingResponse(
stream_ragflow_response(result, converse_params.chat_id, start_time, cache_store_func=cache_store),