fix(cli): show search engines (incl. Keenable) in onboard wizard
The onboard wizard dispatched field handlers by bare field name, so WebSearchConfig.provider was hijacked by the LLM-provider handler and showed LLM providers instead of search engines. Keenable was also never wired into the CLI wizard when it landed in the WebUI. - Add a single source of truth for selectable search providers (SEARCH_PROVIDER_OPTIONS in web.py); WebUI settings now import it. - Add a WebSearchConfig-aware search-provider picker to the wizard and resolve handlers by (model type, field name) so the LLM and search provider fields no longer collide. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
committed by
Xubin Ren
co-authored by
Claude Opus 4.8
parent
638af123ba
commit
9354b80a6e
@@ -1998,3 +1998,27 @@ class TestModelPresetWizard:
|
||||
defaults = AgentDefaults()
|
||||
_handle_provider_field(defaults, "provider", "Provider", "auto")
|
||||
assert defaults.provider == "anthropic"
|
||||
|
||||
def test_search_provider_field_handler(self, monkeypatch):
|
||||
"""_handle_search_provider_field should set the search engine from choices."""
|
||||
from nanobot.agent.tools.web import WebSearchConfig
|
||||
from nanobot.cli.onboard import _handle_search_provider_field
|
||||
|
||||
monkeypatch.setattr(onboard_wizard, "_select_with_back", lambda *a, **kw: "keenable")
|
||||
|
||||
cfg = WebSearchConfig()
|
||||
_handle_search_provider_field(cfg, "provider", "Provider", "duckduckgo")
|
||||
assert cfg.provider == "keenable"
|
||||
|
||||
def test_provider_field_dispatch_is_model_type_aware(self):
|
||||
"""WebSearchConfig.provider must not be hijacked by the LLM provider handler."""
|
||||
from nanobot.agent.tools.web import WebSearchConfig
|
||||
from nanobot.cli.onboard import (
|
||||
_handle_provider_field,
|
||||
_handle_search_provider_field,
|
||||
_resolve_field_handler,
|
||||
)
|
||||
from nanobot.config.schema import AgentDefaults
|
||||
|
||||
assert _resolve_field_handler(WebSearchConfig(), "provider") is _handle_search_provider_field
|
||||
assert _resolve_field_handler(AgentDefaults(), "provider") is _handle_provider_field
|
||||
|
||||
Reference in New Issue
Block a user