mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
794eb04f32
* add gemini web search provider * fix(web): prefer free providers before Gemini in auto mode * fix(web): expose gemini api key and model settings * fix(web): prefer configured providers before Gemini in auto mode * fix(web): satisfy gemini lint checks * fix(web): address gemini provider review feedback * test(web): align auto-provider expectations * fix(web): let gemini ignore search range
108 lines
4.0 KiB
Go
108 lines
4.0 KiB
Go
package tools
|
|
|
|
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"
|
|
)
|
|
|
|
type (
|
|
SendCallbackWithContext = integrationtools.SendCallbackWithContext
|
|
ReactionCallback = integrationtools.ReactionCallback
|
|
MCPManager = integrationtools.MCPManager
|
|
MCPTool = integrationtools.MCPTool
|
|
FindSkillsTool = integrationtools.FindSkillsTool
|
|
InstallSkillTool = integrationtools.InstallSkillTool
|
|
MessageTool = integrationtools.MessageTool
|
|
ReactionTool = integrationtools.ReactionTool
|
|
SendTTSTool = integrationtools.SendTTSTool
|
|
APIKeyPool = integrationtools.APIKeyPool
|
|
APIKeyIterator = integrationtools.APIKeyIterator
|
|
SearchProvider = integrationtools.SearchProvider
|
|
SearchResultItem = integrationtools.SearchResultItem
|
|
BraveSearchProvider = integrationtools.BraveSearchProvider
|
|
TavilySearchProvider = integrationtools.TavilySearchProvider
|
|
SogouSearchProvider = integrationtools.SogouSearchProvider
|
|
DuckDuckGoSearchProvider = integrationtools.DuckDuckGoSearchProvider
|
|
GeminiSearchProvider = integrationtools.GeminiSearchProvider
|
|
PerplexitySearchProvider = integrationtools.PerplexitySearchProvider
|
|
SearXNGSearchProvider = integrationtools.SearXNGSearchProvider
|
|
GLMSearchProvider = integrationtools.GLMSearchProvider
|
|
BaiduSearchProvider = integrationtools.BaiduSearchProvider
|
|
WebSearchTool = integrationtools.WebSearchTool
|
|
WebSearchToolOptions = integrationtools.WebSearchToolOptions
|
|
WebFetchTool = integrationtools.WebFetchTool
|
|
)
|
|
|
|
func NewMCPTool(manager MCPManager, serverName string, tool *mcp.Tool) *MCPTool {
|
|
return integrationtools.NewMCPTool(manager, serverName, tool)
|
|
}
|
|
|
|
func NewFindSkillsTool(registryMgr *skills.RegistryManager, cache *skills.SearchCache) *FindSkillsTool {
|
|
return integrationtools.NewFindSkillsTool(registryMgr, cache)
|
|
}
|
|
|
|
func NewInstallSkillTool(registryMgr *skills.RegistryManager, workspace string) *InstallSkillTool {
|
|
return integrationtools.NewInstallSkillTool(registryMgr, workspace)
|
|
}
|
|
|
|
func NewMessageTool() *MessageTool {
|
|
return integrationtools.NewMessageTool()
|
|
}
|
|
|
|
func NewReactionTool() *ReactionTool {
|
|
return integrationtools.NewReactionTool()
|
|
}
|
|
|
|
func NewSendTTSTool(provider tts.TTSProvider, store media.MediaStore) *SendTTSTool {
|
|
return integrationtools.NewSendTTSTool(provider, store)
|
|
}
|
|
|
|
func NewAPIKeyPool(keys []string) *APIKeyPool {
|
|
return integrationtools.NewAPIKeyPool(keys)
|
|
}
|
|
|
|
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)
|
|
}
|
|
|
|
func NewWebFetchTool(maxChars int, format string, fetchLimitBytes int64) (*WebFetchTool, error) {
|
|
return integrationtools.NewWebFetchTool(maxChars, format, fetchLimitBytes)
|
|
}
|
|
|
|
func NewWebFetchToolWithProxy(
|
|
maxChars int,
|
|
proxy string,
|
|
format string,
|
|
fetchLimitBytes int64,
|
|
privateHostWhitelist []string,
|
|
) (*WebFetchTool, error) {
|
|
return integrationtools.NewWebFetchToolWithProxy(maxChars, proxy, format, fetchLimitBytes, privateHostWhitelist)
|
|
}
|
|
|
|
func NewWebFetchToolWithConfig(
|
|
maxChars int,
|
|
proxy string,
|
|
format string,
|
|
fetchLimitBytes int64,
|
|
privateHostWhitelist []string,
|
|
) (*WebFetchTool, error) {
|
|
return integrationtools.NewWebFetchToolWithConfig(maxChars, proxy, format, fetchLimitBytes, privateHostWhitelist)
|
|
}
|