diff --git a/dsLightRag/Start.py b/dsLightRag/Start.py index 8923fe23..f0da83c4 100644 --- a/dsLightRag/Start.py +++ b/dsLightRag/Start.py @@ -43,6 +43,7 @@ app.mount("/static", StaticFiles(directory="Static"), name="static") async def rag(request: fastapi.Request): data = await request.json() topic = data.get("topic") # Chinese, Math + mode = data.get("mode", "hybrid") # 默认为hybrid模式 # 拼接路径 WORKING_PATH = "./Topic/" + topic # 查询的问题 @@ -67,7 +68,7 @@ async def rag(request: fastapi.Request): await initialize_pipeline_status() resp = await rag.aquery( query=query, - param=QueryParam(mode="hybrid", stream=True, user_prompt=user_prompt)) + param=QueryParam(mode=mode, stream=True, user_prompt=user_prompt)) # hybrid naive async for chunk in resp: diff --git a/dsLightRag/static/ai.html b/dsLightRag/static/ai.html index 0ed164c2..b946d816 100644 --- a/dsLightRag/static/ai.html +++ b/dsLightRag/static/ai.html @@ -232,6 +232,20 @@ +
+

回答模式

+
+ + +
+
+
@@ -293,6 +307,7 @@ const question = document.getElementById('questionInput').value.trim(); const answerArea = document.getElementById('answerArea'); const topic = document.querySelector('input[name="topic"]:checked').value; + const mode = document.querySelector('input[name="mode"]:checked').value; if (!question) { alert('请输入问题!'); @@ -310,7 +325,8 @@ }, body: JSON.stringify({ query: question, - topic: topic + topic: topic, + mode: mode }) }) .then(response => {