fix: stabilize Router model error handling

This commit is contained in:
potaser
2026-08-22 00:47:11 +08:00
parent 8985f5cbdd
commit 052b0c1d5d
4 changed files with 424 additions and 10 deletions
+11
View File
@@ -62,12 +62,23 @@ DEFAULT_AGENT_LANG = "zh"
if PLANTAI_RAG_ROOT.exists() and str(PLANTAI_RAG_ROOT) not in sys.path:
sys.path.insert(0, str(PLANTAI_RAG_ROOT))
_deepseek_api_key_before_rag_import = os.environ.get("DEEPSEEK_API_KEY")
_plantai_new_api_bundle_configured = all(
str(os.environ.get(name) or "").strip()
for name in ("NEW_API_KEY", "NEW_API_BASE_URL", "NEW_API_MODEL")
)
try:
from src.rag.unified.bbav5_methodology_config import build_bbav5_methodology_config
METHODOLOGY_CONFIG_AVAILABLE = True
except Exception as e:
METHODOLOGY_CONFIG_AVAILABLE = False
print(f"⚠️ 方法学配置模块加载失败: {e}")
finally:
if _plantai_new_api_bundle_configured:
if _deepseek_api_key_before_rag_import is None:
os.environ.pop("DEEPSEEK_API_KEY", None)
else:
os.environ["DEEPSEEK_API_KEY"] = _deepseek_api_key_before_rag_import
try:
from gfa_core.mas.agents.interpretation_evidence import build_evidence_report