Add configurable data providers and localize frontend UI

This commit is contained in:
2026-03-15 00:55:12 +08:00
parent 12de93aa30
commit d233a3f55d
38 changed files with 1936 additions and 1038 deletions

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""Tests for normalized env config helpers."""
from backend.config.env_config import (
canonicalize_model_provider,
get_agent_model_config,
)
def test_canonicalize_model_provider_aliases():
assert canonicalize_model_provider("claude") == "ANTHROPIC"
assert canonicalize_model_provider("openai_compatible") == "OPENAI"
assert canonicalize_model_provider("google") == "GEMINI"
def test_get_agent_model_config_fallback(monkeypatch):
monkeypatch.delenv("AGENT_RISK_MANAGER_MODEL_NAME", raising=False)
monkeypatch.delenv("AGENT_RISK_MANAGER_MODEL_PROVIDER", raising=False)
monkeypatch.setenv("MODEL_NAME", "gpt-4o-mini")
monkeypatch.setenv("MODEL_PROVIDER", "openai")
config = get_agent_model_config("risk_manager")
assert config.model_name == "gpt-4o-mini"
assert config.provider == "OPENAI"