修复缓存 await 问题

This commit is contained in:
Tian jianyong 2025-12-17 14:33:23 +08:00
parent 0e47ed045f
commit c293e43281
5 changed files with 10 additions and 6 deletions

View File

@ -230,7 +230,8 @@ async def converse_with_chat_assistant(
# Revert to Native RAGFlow Service (OpenAI endpoint failed with Auth error)
t1 = time.perf_counter()
result = await RAGFlowService.converse_with_chat_assistant_services(converse_params)
# 修复直接获取AsyncGenerator不使用await消费
result = RAGFlowService.converse_with_chat_assistant_services(converse_params)
logger.info(f"[RAG_PROFILE] RAG Init/Connect ({converse_params.chat_id}): {time.perf_counter() - t1:.3f}s")
if converse_params.stream:

View File

@ -189,7 +189,8 @@ class SearchService:
except SearchServiceError as exc:
logger.warning('搜索服务失败降级到RAGFlow: %s', exc)
# Fallback to normal flow
result = await RAGFlowService.converse_with_chat_assistant_services(converse_params)
# 修复直接获取AsyncGenerator不使用await消费
result = RAGFlowService.converse_with_chat_assistant_services(converse_params)
if converse_params.stream:
async def stream_response():

View File

@ -30,7 +30,8 @@ async def test_fix_logic():
print("[1] Fetching Stream from Native Service (Expect Cumulative)...")
try:
result_stream = await RAGFlowService.converse_with_chat_assistant_services(params)
# 修复直接获取AsyncGenerator不使用await消费
result_stream = RAGFlowService.converse_with_chat_assistant_services(params)
print("[2] Applying Controller Delta Logic...")
print("-" * 20 + " OUTPUT " + "-" * 20)

View File

@ -30,7 +30,8 @@ async def test_rag_internal():
try:
# Call the NATIVE SERVICE method directly
# This bypassed the Controller Delta Logic, so we expect CUMULATIVE text here.
result_stream = await RAGFlowService.converse_with_chat_assistant_services(params)
# 修复直接获取AsyncGenerator不使用await消费
result_stream = RAGFlowService.converse_with_chat_assistant_services(params)
print("\n[Start Streaming]...")
async for chunk in result_stream:

View File

@ -107,8 +107,8 @@ async def test_new_implementation():
print("="*60)
try:
# 服务层直接返回生成器
generator = await MockRAGFlowServiceNew.converse_with_chat_assistant_services(
# 修复直接获取AsyncGenerator不使用await消费
generator = MockRAGFlowServiceNew.converse_with_chat_assistant_services(
chat_id="test_chat_123",
question="你好",
stream=True