main
HuangHai 2 weeks ago
parent 9a3392e5aa
commit 464db22b37

@ -67,7 +67,7 @@ app.mount("/static", StaticFiles(directory="Static"), name="static")
async def rag(request: fastapi.Request):
data = await request.json()
query = data.get("query")
lightrag_working_dir = "./Topic/Chinese"
lightrag_working_dir = "./Topic/Math"
async def generate_response_stream(query: str):
try:
llm_model_func = create_llm_model_func()
@ -92,10 +92,10 @@ async def rag(request: fastapi.Request):
resp = await rag.aquery(
query=query,
mode="hybrid", # 直接传入mode参数
stream=True # 直接传入stream参数
stream=True # 直接传入stream参数
)
# 直接处理流式响应,不再打印完整结果
# 直接处理流式响应
async for chunk in resp:
if not chunk:
continue

@ -2182,15 +2182,15 @@
"embedding_max": null,
"original_prompt": "小学数学有哪些模型"
},
"9b50a199b83407c62d8532b7b904c17d": {
"return": "{\"high_level_keywords\": [\"\\u82cf\\u8f7c\", \"\\u5bb6\\u4eba\", \"\\u5bb6\\u5ead\\u5173\\u7cfb\"], \"low_level_keywords\": [\"\\u7236\\u4eb2\", \"\\u6bcd\\u4eb2\", \"\\u5144\\u5f1f\", \"\\u59d0\\u59b9\", \"\\u59bb\\u5b50\", \"\\u5b50\\u5973\"]}",
"6a2a99a3bd4688b079a45fedbd1cd493": {
"return": "{\"high_level_keywords\": [\"\\u5c0f\\u5b66\\u6570\\u5b66\", \"\\u6570\\u5b66\\u6a21\\u578b\", \"\\u57fa\\u7840\\u6559\\u80b2\"], \"low_level_keywords\": [\"\\u52a0\\u51cf\\u6cd5\\u6a21\\u578b\", \"\\u51e0\\u4f55\\u56fe\\u5f62\", \"\\u5206\\u6570\\u6a21\\u578b\", \"\\u5e94\\u7528\\u9898\", \"\\u6570\\u8f74\"]}",
"cache_type": "keywords",
"chunk_id": null,
"embedding": null,
"embedding_shape": null,
"embedding_min": null,
"embedding_max": null,
"original_prompt": "苏轼的家人都有谁"
"original_prompt": "小学数学中有哪些模型"
}
}
}

@ -2181,6 +2181,16 @@
"embedding_min": null,
"embedding_max": null,
"original_prompt": "小学数学有哪些模型"
},
"6a2a99a3bd4688b079a45fedbd1cd493": {
"return": "{\"high_level_keywords\": [\"\\u5c0f\\u5b66\\u6570\\u5b66\", \"\\u6570\\u5b66\\u6559\\u80b2\", \"\\u5b66\\u4e60\\u6a21\\u578b\"], \"low_level_keywords\": [\"\\u52a0\\u51cf\\u6cd5\\u6a21\\u578b\", \"\\u4e58\\u9664\\u6cd5\\u6a21\\u578b\", \"\\u51e0\\u4f55\\u56fe\\u5f62\", \"\\u5206\\u6570\\u6a21\\u578b\", \"\\u5e94\\u7528\\u9898\"]}",
"cache_type": "keywords",
"chunk_id": null,
"embedding": null,
"embedding_shape": null,
"embedding_min": null,
"embedding_max": null,
"original_prompt": "小学数学中有哪些模型?"
}
}
}
Loading…
Cancel
Save