diff --git a/ruoyi-fastapi-backend/module_admin/controller/ragflow_controller.py b/ruoyi-fastapi-backend/module_admin/controller/ragflow_controller.py index 6106e23..f0381f5 100644 --- a/ruoyi-fastapi-backend/module_admin/controller/ragflow_controller.py +++ b/ruoyi-fastapi-backend/module_admin/controller/ragflow_controller.py @@ -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),