refactor(providers): register shared setup templates
This commit is contained in:
1 parent
5eabed859c
commit
ebb8419ddf
9 files changed
+193
-124
No files matched your search
@@ -902,7 +902,7 @@ class TestMainMenuInteraction:
|
||||
from nanobot.providers.registry import PROVIDERS
|
||||
|
||||
choices = onboard_wizard._get_quick_start_provider_choices()
|
||||
selected_provider_names = set(choices.values())
|
||||
selected_provider_names = {choice for choice in choices.values() if isinstance(choice, str)}
|
||||
expected_provider_names = set()
|
||||
seen_display_names: set[str] = set()
|
||||
for spec in PROVIDERS:
|
||||
|
||||
@@ -2901,13 +2901,17 @@ def test_setup_template_keeps_existing_provider_with_matching_name(tmp_path, mon
|
||||
before = load_config(config_path)
|
||||
monkeypatch.setattr("nanobot.config.loader._current_config_path", config_path)
|
||||
|
||||
settings = settings_payload()
|
||||
template = next(item for item in settings["provider_setup_templates"] if item["id"] == "shengsuanyun")
|
||||
assert template["label"] == "ShengSuanYun Router"
|
||||
assert "胜算云" in template["search_aliases"].split()
|
||||
assert template["suggested_name"] == "ShengSuanYun Router 2"
|
||||
assert any(provider["name"] == legacy_key for provider in settings["providers"])
|
||||
payload = create_provider_settings({
|
||||
"name": ["ShengSuanYun Router 2"],
|
||||
"apiBase": ["https://router.shengsuanyun.com/api/v1"],
|
||||
"name": [template["suggested_name"]],
|
||||
"apiBase": [template["api_base"]],
|
||||
"apiKey": ["new-key"],
|
||||
"api": [json.dumps({
|
||||
"supportedApis": ["chat_completions", "responses"], "preferredApi": "chat_completions",
|
||||
})],
|
||||
"api": [json.dumps(template["api"])],
|
||||
})
|
||||
key = payload["created_provider"]
|
||||
saved = load_config(config_path)
|
||||
|
||||
Reference in new issue
Block a user