From 51c0af517b62d18c75599d94e30ce01fd4c3cc7d Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Sun, 24 Aug 2025 21:07:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=9F=A5=E8=AF=86?= =?UTF-8?q?=E5=9B=BE=E8=B0=B1=E6=9F=A5=E8=AF=A2=E6=97=A5=E5=BF=97=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E7=B1=BB=E5=9E=8B=E5=88=A4=E6=96=AD=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E5=B9=B6=E6=94=AF=E6=8C=81=E5=93=81=E7=89=8C=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 tools_factory.py 中知识图谱查询结果日志记录时的类型判断错误,将 'd' 改为 'dict' 在 system_router.py 中添加对环境变量 YUXI_BRAND_FILE_PATH 的支持,用于配置品牌文件路径 --- server/routers/system_router.py | 3 ++- src/agents/tools_factory.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server/routers/system_router.py b/server/routers/system_router.py index 3a2174a5..a4925659 100644 --- a/server/routers/system_router.py +++ b/server/routers/system_router.py @@ -82,7 +82,8 @@ def load_info_config(): """加载信息配置文件""" try: # 配置文件路径 - config_path = Path("src/static/info.local.yaml") + brand_file_path = os.environ.get("YUXI_BRAND_FILE_PATH", "src/static/info.local.yaml") + config_path = Path(brand_file_path) # 检查文件是否存在 if not config_path.exists(): diff --git a/src/agents/tools_factory.py b/src/agents/tools_factory.py index 11926c32..a402d927 100644 --- a/src/agents/tools_factory.py +++ b/src/agents/tools_factory.py @@ -173,7 +173,7 @@ def query_knowledge_graph(query: Annotated[str, "The keyword to query knowledge try: logger.debug(f"Querying knowledge graph with: {query}") result = graph_base.query_node(query, hops=2, return_format='triples') - logger.debug(f"Knowledge graph query returned {len(result.get('triples', [])) if isinstance(result, d) else 'N/A'} triples") + logger.debug(f"Knowledge graph query returned {len(result.get('triples', [])) if isinstance(result, dict) else 'N/A'} triples") return result except Exception as e: logger.error(f"Knowledge graph query error: {e}")