|
@@ -29,12 +29,15 @@ app.add_middleware(
|
|
|
# max_age=1000
|
|
|
)
|
|
|
|
|
|
-# 定义默认路径
|
|
|
-DEFAULT_DB_PATH = os.path.join(".", "knowledge_db")
|
|
|
-DEFAULT_PERSIST_PATH = os.path.join(".", "vector_db", "chroma")
|
|
|
+# 获取当前脚本所在的绝对路径
|
|
|
+current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
|
|
-# 初始化你的Chat_QA_chain_self实例
|
|
|
-chat_qa_chain = Chat_QA_chain_self(file_path=DEFAULT_DB_PATH, persist_path=DEFAULT_PERSIST_PATH,embedding='m3e')
|
|
|
+# 构建默认路径
|
|
|
+DEFAULT_DB_PATH = os.path.join(current_dir, "knowledge_db")
|
|
|
+DEFAULT_PERSIST_PATH = os.path.join(current_dir, "vector_db", "chroma")
|
|
|
+
|
|
|
+# 初始化 QA 链接
|
|
|
+chat_qa_chain = Chat_QA_chain_self(file_path=DEFAULT_DB_PATH, persist_path=DEFAULT_PERSIST_PATH, embedding='m3e')
|
|
|
|
|
|
@app.post('/clear/history')
|
|
|
async def clear_history():
|