feat: LLM/Embedding 重试次数纳入 system.yaml 统一配置

- system.yaml: llm.max_retries(死配置) 改为 llm.max_attempts;embedding 段新增 max_attempts
- llm/client.py: LLMConfig 新增 max_attempts(默认 3 兜底),load_llm_config 读取配置
- llm/extractor.py: translate_and_extract(_async) max_attempts=None 时取 config.max_attempts
- embedding/client.py: load_embedding_config 读取 embedding.max_attempts
- scheduler/reporter.py: _call_llm_simple max_retries=None 时取 max_attempts-1
- 新增 2 个配置读取测试;已同步 pi5 验证
This commit is contained in:
2026-08-05 08:48:43 +08:00
parent d4a55bcaaa
commit 9aa44e610d
7 changed files with 37 additions and 7 deletions
+2
View File
@@ -92,6 +92,7 @@ def load_embedding_config(
dimension = int(sys_cfg.get("dimension", DASHSCOPE_DEFAULT_DIM))
batch_size = min(int(sys_cfg.get("batch_size", DASHSCOPE_BATCH_LIMIT)), DASHSCOPE_BATCH_LIMIT)
timeout = float(sys_cfg.get("timeout_sec", 30.0))
max_attempts = int(sys_cfg.get("max_attempts", DEFAULT_MAX_ATTEMPTS))
if not api_key:
raise EmbeddingError("DASHSCOPE_API_KEY 未配置,请检查 .env")
@@ -104,6 +105,7 @@ def load_embedding_config(
dimension=dimension,
batch_size=batch_size,
timeout_sec=timeout,
max_attempts=max_attempts,
)