fix: 修复知识图谱查询日志中的类型判断错误并支持品牌文件路径配置

修复 tools_factory.py 中知识图谱查询结果日志记录时的类型判断错误,将 'd' 改为 'dict'
在 system_router.py 中添加对环境变量 YUXI_BRAND_FILE_PATH 的支持,用于配置品牌文件路径
This commit is contained in:
Wenjie Zhang 2025-08-24 21:07:55 +08:00
parent dce989bb2c
commit 51c0af517b
2 changed files with 3 additions and 2 deletions

View File

@ -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():

View File

@ -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}")