feat(agent): 增强 Agent 配置,新增结构化字段与聊天功能支持

This commit is contained in:
hugo committed 2026-07-07 11:10:32 +08:00
1 parent ac4262cd75
commit c8ce77199e
183 files changed
+11690 -2300

No files matched your search

@@ -9,6 +9,7 @@ services/shipping_notice/rpa.py
from __future__ import annotations
import json
import os
import shutil
from datetime import datetime
from pathlib import Path
@@ -17,6 +18,27 @@ from typing import Any
from flask import current_app
def _runtime_summary(mode: str) -> dict[str, str | bool]:
"""将 browser/mock 规范化为前端安全展示摘要。"""
normalized = "mock" if str(mode or "").strip().lower() == "mock" else "browser"
mock_enabled = normalized == "mock"
return {
"mode": normalized,
"label": "Mock RPA" if mock_enabled else "真实 RPA",
"mock": mock_enabled,
}
def rpa_runtime_mode(runtime: dict[str, Any] | None = None) -> dict[str, str | bool]:
"""返回 RPA 运行模式摘要;优先使用任务最近一次回调实际模式,兜底读取当前后端配置。"""
if isinstance(runtime, dict):
mode = str(runtime.get("mode") or runtime.get("rpa_mode") or "").strip().lower()
if mode in {"browser", "mock"}:
return _runtime_summary(mode)
raw = str(os.getenv("FREIGHT_RPA_MOCK", current_app.config.get("FREIGHT_RPA_MOCK", "false")) or "false").strip().lower()
return _runtime_summary("mock" if raw in {"1", "true", "yes", "on"} else "browser")
def _path(key: str) -> Path | None:
value = str(current_app.config.get(key) or "").strip()
if not value: