mirror of
https://github.com/Tencent/WeKnora.git
synced 2026-10-13 08:50:22 +08:00
* feat(pluginsdk): extension protocol v1, Go SDK and conformance suite * feat(plugin): run code plugins in an embedded plugin host * feat(plugin): remote adapters for web search and data sources * fix(plugin): show plugin errors by their message * feat(frontend): plugin connectors and web search providers in the UI * docs(pluginsdk): how to write, package, test and install a plugin * fix(plugin): gofmt two files and read openapi.yaml line-ending agnostic * fix(plugin): mark a host plugin ready before Activate returns
33 lines
1.0 KiB
Go
33 lines
1.0 KiB
Go
package pluginapi
|
|
|
|
import "time"
|
|
|
|
// SearchPath is the web search endpoint for provider id.
|
|
func SearchPath(id string) string { return "/v1/websearch/" + id + "/search" }
|
|
|
|
// SearchInput is the input of a web search.
|
|
type SearchInput struct {
|
|
Query string `json:"query"`
|
|
MaxResults int `json:"maxResults"`
|
|
IncludeDate bool `json:"includeDate,omitempty"`
|
|
// Region and Freshness are optional filters; a provider that cannot
|
|
// honour a requested filter must fail rather than ignore it.
|
|
Region string `json:"region,omitempty"`
|
|
Freshness string `json:"freshness,omitempty"`
|
|
}
|
|
|
|
// SearchOutput is the output of a web search.
|
|
type SearchOutput struct {
|
|
Results []SearchResult `json:"results"`
|
|
}
|
|
|
|
// SearchResult is one hit.
|
|
type SearchResult struct {
|
|
Title string `json:"title"`
|
|
URL string `json:"url"`
|
|
Snippet string `json:"snippet,omitempty"`
|
|
Content string `json:"content,omitempty"`
|
|
Age string `json:"age,omitempty"`
|
|
PublishedAt *time.Time `json:"publishedAt,omitempty"`
|
|
}
|