fix: stabilize Router model error handling
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user