feat(provider): add LongCat via OpenAI-compatible backend

This commit is contained in:
moranfong
2026-05-02 01:52:04 +08:00
committed by Xubin Ren
parent ee364c6ac1
commit 051037ff08
5 changed files with 101 additions and 0 deletions
+29
View File
@@ -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"