fix: web_search 走本地 SearXNG 而非 DuckDuckGo
This commit is contained in:
@@ -192,16 +192,17 @@ func main() {
|
|||||||
var asrProvider llm.ASRProvider
|
var asrProvider llm.ASRProvider
|
||||||
if getEnvBool("ENABLE_TOOLS", true) {
|
if getEnvBool("ENABLE_TOOLS", true) {
|
||||||
// 11 个共享通用插件 — 注册其工具到统一注册中心
|
// 11 个共享通用插件 — 注册其工具到统一注册中心
|
||||||
|
registerPlugins(toolRegistry)
|
||||||
|
for _, t := range pluginFile.NewFilePlugin(dataDir).Tools() { toolRegistry.Register(t) }
|
||||||
|
for _, t := range pluginHTTP.NewHTTPPlugin().Tools() { toolRegistry.Register(t) }
|
||||||
|
// 优先使用本地 SearXNG,不可用时回退 DuckDuckGo
|
||||||
searxngURL := getEnv("SEARXNG_URL", "")
|
searxngURL := getEnv("SEARXNG_URL", "")
|
||||||
if searxngURL != "" {
|
if searxngURL != "" {
|
||||||
|
toolRegistry.Register(wrapTool(tools.NewWebSearchToolWithURL(searxngURL), "web_search", "Search the web via SearXNG", "search"))
|
||||||
} else {
|
} else {
|
||||||
|
for _, t := range pluginWS.NewWebSearchPlugin().Tools() { toolRegistry.Register(t) }
|
||||||
}
|
}
|
||||||
|
for _, t := range pluginWF.NewWebFetchPlugin().Tools() { toolRegistry.Register(t) }
|
||||||
registerPlugins(toolRegistry)
|
|
||||||
for _, t := range pluginFile.NewFilePlugin(dataDir).Tools() { toolRegistry.Register(t) }
|
|
||||||
for _, t := range pluginHTTP.NewHTTPPlugin().Tools() { toolRegistry.Register(t) }
|
|
||||||
for _, t := range pluginWS.NewWebSearchPlugin().Tools() { toolRegistry.Register(t) }
|
|
||||||
for _, t := range pluginWF.NewWebFetchPlugin().Tools() { toolRegistry.Register(t) }
|
|
||||||
// ai-core 专属工具 — 通过 sdk.Tool 适配器注册
|
// ai-core 专属工具 — 通过 sdk.Tool 适配器注册
|
||||||
if iotClient != nil {
|
if iotClient != nil {
|
||||||
toolRegistry.Register(wrapTool(tools.NewIoTQueryTool(iotClient), "iot_query", "Query IoT Devices", "iot"))
|
toolRegistry.Register(wrapTool(tools.NewIoTQueryTool(iotClient), "iot_query", "Query IoT Devices", "iot"))
|
||||||
|
|||||||
Reference in New Issue
Block a user