fix(tools): improve web search provider fallback (#2629)

- centralize web search provider readiness and resolution logic
- fall back when the configured provider is unavailable or invalid
- allow native-search-capable models to use built-in search without the client tool
- simplify the tools page and add direct access to web search settings
- add backend, agent, and integration tests for the new selection behavior
This commit is contained in:
wenjie
2026-04-23 15:39:16 +08:00
committed by GitHub
parent 451db2f5d8
commit cac4f21746
16 changed files with 633 additions and 222 deletions
+13
View File
@@ -4,6 +4,7 @@ import (
"github.com/modelcontextprotocol/go-sdk/mcp"
"github.com/sipeed/picoclaw/pkg/audio/tts"
"github.com/sipeed/picoclaw/pkg/config"
"github.com/sipeed/picoclaw/pkg/media"
"github.com/sipeed/picoclaw/pkg/skills"
integrationtools "github.com/sipeed/picoclaw/pkg/tools/integration"
@@ -72,6 +73,18 @@ func GetPreferredWebSearchLanguage() string {
return integrationtools.GetPreferredWebSearchLanguage()
}
func WebSearchToolOptionsFromConfig(cfg *config.Config) WebSearchToolOptions {
return integrationtools.WebSearchToolOptionsFromConfig(cfg)
}
func WebSearchProviderReady(opts WebSearchToolOptions, name string) bool {
return integrationtools.WebSearchProviderReady(opts, name)
}
func ResolveWebSearchProviderName(opts WebSearchToolOptions, query string) (string, error) {
return integrationtools.ResolveWebSearchProviderName(opts, query)
}
func NewWebSearchTool(opts WebSearchToolOptions) (*WebSearchTool, error) {
return integrationtools.NewWebSearchTool(opts)
}