fix: 修复知识图谱查询日志中的类型判断错误并支持品牌文件路径配置
修复 tools_factory.py 中知识图谱查询结果日志记录时的类型判断错误,将 'd' 改为 'dict' 在 system_router.py 中添加对环境变量 YUXI_BRAND_FILE_PATH 的支持,用于配置品牌文件路径
This commit is contained in:
parent
dce989bb2c
commit
51c0af517b
@ -82,7 +82,8 @@ def load_info_config():
|
|||||||
"""加载信息配置文件"""
|
"""加载信息配置文件"""
|
||||||
try:
|
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():
|
if not config_path.exists():
|
||||||
|
|||||||
@ -173,7 +173,7 @@ def query_knowledge_graph(query: Annotated[str, "The keyword to query knowledge
|
|||||||
try:
|
try:
|
||||||
logger.debug(f"Querying knowledge graph with: {query}")
|
logger.debug(f"Querying knowledge graph with: {query}")
|
||||||
result = graph_base.query_node(query, hops=2, return_format='triples')
|
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
|
return result
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Knowledge graph query error: {e}")
|
logger.error(f"Knowledge graph query error: {e}")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user