- plugins: calculator, datetime, crypto, random, text, json, markdown - plugins: web-search (SearXNG stub), web-fetch, file, http (stubs) - main.go: full wiring — config→db→nats→plugins→voice→memory→ persona→llm→context→subsession→orchestrator→gateway→ws - 15 packages passing, 11 plugins loaded at startup
20 lines
913 B
Go
20 lines
913 B
Go
package websearch
|
|
import (
|
|
"context"
|
|
"git.yeij.top/AskaEth/Cyrene_v2/internal/plugin"
|
|
)
|
|
type Plugin struct{ searxngURL string }
|
|
func New(url string) *Plugin { return &Plugin{searxngURL: url} }
|
|
func (p *Plugin) Name() string { return "web-search" }
|
|
func (p *Plugin) Version() string { return "1.0.0" }
|
|
func (p *Plugin) Description() string { return "网络搜索" }
|
|
func (p *Plugin) Init(_ context.Context, _ plugin.PluginConfig) error { return nil }
|
|
func (p *Plugin) Close() error { return nil }
|
|
func (p *Plugin) Enabled() bool { return p.searxngURL != "" }
|
|
func (p *Plugin) Tools() []plugin.ToolDefinition {
|
|
return []plugin.ToolDefinition{{Name:"web_search", Description:"互联网搜索", Parameters:map[string]any{"query": map[string]string{"type":"string"}}}}
|
|
}
|
|
func (p *Plugin) Execute(_ context.Context, _ string, _ map[string]any) (string, error) {
|
|
return "[搜索] 引擎未配置", nil
|
|
}
|