refactor(agent): consolidate provider preset resolution

This commit is contained in:
jxxghp
2026-05-08 12:35:02 +08:00
parent c9931aa948
commit c6d95cd006
3 changed files with 254 additions and 135 deletions

View File

@@ -1200,6 +1200,8 @@ def _llm_provider_defaults(
provider_definitions: list[dict[str, Any]],
) -> dict[str, str]:
normalized_provider = str(provider or "").strip().lower()
if normalized_provider == "kimi-coding":
normalized_provider = "moonshot"
defaults = dict(LLM_PROVIDER_DEFAULTS.get(normalized_provider) or {})
provider_meta = next(
(
@@ -1231,6 +1233,8 @@ def _llm_provider_meta(
provider_definitions: list[dict[str, Any]],
) -> dict[str, Any]:
normalized_provider = str(provider or "").strip().lower()
if normalized_provider == "kimi-coding":
normalized_provider = "moonshot"
provider_meta = next(
(
item
@@ -1784,6 +1788,8 @@ def _collect_agent_config(
provider_definitions = _load_llm_provider_definitions(runtime_python=runtime_python)
provider_choices = _llm_provider_choice_map(provider_definitions)
current_provider = _env_default("LLM_PROVIDER", "deepseek").lower()
if current_provider == "kimi-coding":
current_provider = "moonshot"
if current_provider not in provider_choices:
current_provider = "deepseek"