feat(provider): add LongCat via OpenAI-compatible backend
This commit is contained in:
@@ -285,6 +285,39 @@ def test_find_by_name_accepts_camel_case_and_hyphen_aliases():
|
||||
assert find_by_name("volcengineCodingPlan").name == "volcengine_coding_plan"
|
||||
assert find_by_name("github-copilot") is not None
|
||||
assert find_by_name("github-copilot").name == "github_copilot"
|
||||
assert find_by_name("longcat") is not None
|
||||
assert find_by_name("longcat").name == "longcat"
|
||||
|
||||
|
||||
def test_config_explicit_longcat_provider_resolves_provider_name():
|
||||
config = Config.model_validate(
|
||||
{
|
||||
"agents": {
|
||||
"defaults": {
|
||||
"provider": "longcat",
|
||||
"model": "LongCat-Flash-Chat",
|
||||
}
|
||||
},
|
||||
"providers": {
|
||||
"longcat": {
|
||||
"apiKey": "test-key",
|
||||
}
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
assert config.get_provider_name() == "longcat"
|
||||
|
||||
|
||||
def test_config_auto_detects_longcat_from_model_keyword():
|
||||
config = Config.model_validate(
|
||||
{
|
||||
"agents": {"defaults": {"provider": "auto", "model": "longcat/LongCat-Flash-Chat"}},
|
||||
"providers": {"longcat": {"apiKey": "test-key"}},
|
||||
}
|
||||
)
|
||||
|
||||
assert config.get_provider_name() == "longcat"
|
||||
|
||||
|
||||
def test_config_explicit_xiaomi_mimo_provider_uses_default_api_base():
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
"""Tests for the LongCat provider registration."""
|
||||
|
||||
from nanobot.config.schema import ProvidersConfig
|
||||
from nanobot.providers.registry import PROVIDERS, find_by_name
|
||||
|
||||
|
||||
def test_longcat_config_field_exists():
|
||||
"""ProvidersConfig should have a longcat field."""
|
||||
config = ProvidersConfig()
|
||||
assert hasattr(config, "longcat")
|
||||
|
||||
|
||||
def test_longcat_provider_in_registry():
|
||||
"""LongCat should be registered in the provider registry."""
|
||||
specs = {s.name: s for s in PROVIDERS}
|
||||
assert "longcat" in specs
|
||||
|
||||
longcat = specs["longcat"]
|
||||
assert longcat.backend == "openai_compat"
|
||||
assert longcat.env_key == "LONGCAT_API_KEY"
|
||||
assert longcat.default_api_base == "https://api.longcat.chat/openai"
|
||||
|
||||
|
||||
def test_find_by_name_longcat():
|
||||
"""find_by_name should resolve the LongCat provider."""
|
||||
spec = find_by_name("longcat")
|
||||
|
||||
assert spec is not None
|
||||
assert spec.name == "longcat"
|
||||
Reference in New Issue
Block a user