Prechádzať zdrojové kódy

修改编译小问题, 修复知识库访问问题

longjoedyy 3 týždňov pred
rodič
commit
e4f86eb3f4
2 zmenil súbory, kde vykonal 4 pridanie a 3 odobranie
  1. 1 1
      cythonize.py
  2. 3 2
      tools/knowledge_tools.py

+ 1 - 1
cythonize.py

@@ -73,7 +73,7 @@ def compile_project():
 
     # 运行setup.py
     result = subprocess.run(
-        [sys.executable, "setup.py"], capture_output=True, text=True, encoding="utf-8"
+        [sys.executable, "setup.py"], capture_output=True, text=True
     )
 
     if result.returncode != 0:

+ 3 - 2
tools/knowledge_tools.py

@@ -4,6 +4,7 @@ import requests
 import json
 import os
 from .base_tool import html_to_text, get_unique_match_count
+from config.settings import settings
 
 
 @tool
@@ -17,7 +18,7 @@ def get_knowledge_list(filter_words: List[str], match_limit: int = 3) -> str:
     """
     print(f"正在查询知识库列表,筛选关键词:{filter_words} 匹配下限:{match_limit}")
 
-    kms_list_url = os.getenv("KMS_LIST_URL")
+    kms_list_url = settings.KMS_LIST_URL  # os.getenv("KMS_LIST_URL")
     payload = {
         "categorycodeList": [],
         "ignoreTypeSub": False,
@@ -79,7 +80,7 @@ def get_knowledge_content(docid: str) -> str:
     """
     print(f"正在获取知识库文章内容,DocID: {docid}")
 
-    kms_view_url = os.getenv("KMS_VIEW_URL")
+    kms_view_url = settings.KMS_VIEW_URL  # os.getenv("KMS_VIEW_URL")
     headers = {
         "Accept": "application/json, text/plain, */*",
         "Content-Type": "application/json",