From ae93470be33b863c32068ff07f2b5ab15268c2a7 Mon Sep 17 00:00:00 2001 From: HuangHai <10402852@qq.com> Date: Mon, 7 Jul 2025 11:05:54 +0800 Subject: [PATCH] 'commit' --- dsRagAnything/T3_Start.py | 11 +- .../Math/kv_store_llm_response_cache.json | 40 ++ dsRagAnything/static/ai.html | 371 ++++++++++++++++++ 3 files changed, 415 insertions(+), 7 deletions(-) create mode 100644 dsRagAnything/static/ai.html diff --git a/dsRagAnything/T3_Start.py b/dsRagAnything/T3_Start.py index b5fac659..d79dd3ee 100644 --- a/dsRagAnything/T3_Start.py +++ b/dsRagAnything/T3_Start.py @@ -41,7 +41,6 @@ async def lifespan(app: FastAPI): yield - async def print_stream(stream): async for chunk in stream: if chunk: @@ -53,16 +52,14 @@ app = FastAPI(lifespan=lifespan) # 挂载静态文件目录 app.mount("/static", StaticFiles(directory="Static"), name="static") -# 数学索引文件目录 -# WORKING_PATH = "./Topic/Math" - -# 苏轼索引文件目录 -WORKING_PATH = "./Topic/Chinese" - @app.post("/api/rag") async def rag(request: fastapi.Request): data = await request.json() + topic = data.get("topic") # Chinese, Math + # 拼接路径 + WORKING_PATH= "./Topic/" + topic + # 查询的问题 query = data.get("query") # 关闭参考资料 query = query + "\n 不要输出参考资料!" diff --git a/dsRagAnything/Topic/Math/kv_store_llm_response_cache.json b/dsRagAnything/Topic/Math/kv_store_llm_response_cache.json index bf90e9e6..51e4f506 100644 --- a/dsRagAnything/Topic/Math/kv_store_llm_response_cache.json +++ b/dsRagAnything/Topic/Math/kv_store_llm_response_cache.json @@ -2191,6 +2191,46 @@ "embedding_min": null, "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\", \"\\u59bb\\u5b50\", \"\\u5b50\\u5973\"]}", + "cache_type": "keywords", + "chunk_id": null, + "embedding": null, + "embedding_shape": null, + "embedding_min": null, + "embedding_max": null, + "original_prompt": "苏轼的家人都有谁?" + }, + "585eef85444b748e7c7fce9281f7152b": { + "return": "{\"high_level_keywords\": [\"\\u82cf\\u8f7c\", \"\\u5bb6\\u5ead\\u6210\\u5458\", \"\\u5bb6\\u65cf\\u5173\\u7cfb\"], \"low_level_keywords\": [\"\\u7a0b\\u592b\\u4eba\", \"\\u738b\\u5f17\", \"\\u82cf\\u8f99\", \"\\u82cf\\u8fc8\", \"\\u7709\\u5c71\"]}", + "cache_type": "keywords", + "chunk_id": null, + "embedding": null, + "embedding_shape": null, + "embedding_min": null, + "embedding_max": null, + "original_prompt": "苏轼的家人都有谁?\n 不要输出参考资料!" + }, + "5c5ee10a1a6deda17447c905118427e3": { + "return": "{\"high_level_keywords\": [\"\\u82cf\\u8f7c\", \"\\u597d\\u53cb\", \"\\u4eba\\u9645\\u5173\\u7cfb\"], \"low_level_keywords\": [\"\\u9ec4\\u5ead\\u575a\", \"\\u79e6\\u89c2\", \"\\u7c73\\u82be\", \"\\u4f5b\\u5370\", \"\\u6587\\u4eba\\u4ea4\\u5f80\"]}", + "cache_type": "keywords", + "chunk_id": null, + "embedding": null, + "embedding_shape": null, + "embedding_min": null, + "embedding_max": null, + "original_prompt": "苏轼的好朋友都有谁?\n 不要输出参考资料!" + }, + "aa541ae622441668370c2515c5756622": { + "return": "{\"high_level_keywords\": [\"\\u5c0f\\u5b66\\u6570\\u5b66\", \"\\u6570\\u5b66\\u6a21\\u578b\", \"\\u57fa\\u7840\\u6559\\u80b2\"], \"low_level_keywords\": [\"\\u52a0\\u51cf\\u6cd5\", \"\\u4e58\\u9664\\u6cd5\", \"\\u5206\\u6570\", \"\\u5c0f\\u6570\", \"\\u51e0\\u4f55\\u56fe\\u5f62\", \"\\u5e94\\u7528\\u9898\"]}", + "cache_type": "keywords", + "chunk_id": null, + "embedding": null, + "embedding_shape": null, + "embedding_min": null, + "embedding_max": null, + "original_prompt": "小学数学中有哪些模型?\n 不要输出参考资料!" } } } \ No newline at end of file diff --git a/dsRagAnything/static/ai.html b/dsRagAnything/static/ai.html new file mode 100644 index 00000000..77add2d4 --- /dev/null +++ b/dsRagAnything/static/ai.html @@ -0,0 +1,371 @@ + + +
+ + +请在下方输入您的问题,答案将在此处显示
+您也可以点击"示例问题"快速体验
+