search: Tencent Cloud's Yuanbao Search (wsa) is a built-in search API (plugins#509)
chenjiangzi asked for Tencent Cloud's WSA SearchPro (元宝搜索). It is added
as vendor "wsa", following Doubao Search (dca3e2d71), from Tencent's
own docs:
- API-key method (cloud.tencent.com/document/product/1806/130615):
POST https://api.wsa.cloud.tencent.com/SearchPro with
Authorization: Bearer <key> and a JSON body {"Query", "Cnt": 10}.
Keys come from console.cloud.tencent.com/wsapi/index (KeysURL).
- SearchPro (121811): Response.Pages is an array of JSON strings, each
with title, url, date, passage and content. The text is passage, or
content when passage is empty or only the title. Tags are stripped.
- Errors (121818/121820, 130615): HTTP 200 with Response.Error{Code,
Message}. AuthFailure*, UnauthorizedOperation and ResourceNotFound are
turned away (403); ResourceUnavailable (欠费), LimitExceeded and
ResourceInsufficient are out of credit (402); RequestLimitExceeded* is
rate limited (429); others are plain errors, with the key masked.
The fixtures in testdata are the docs' two example replies. 130615's is
shown with its quotes escaped twice, which isn't JSON; they were
unescaped once and nothing else changed. The GUI's picker is built from
SearchVendors, so no GUI file changes. README (en, zh), the CLI help and
gateway-routing.md name it.
Run on mote (mote-run), at the rebased head:
- go test -run 'SearchAPI|WSASearch|Volcengine|Search' ./internal/gateway/
./internal/gui/
./internal/provider/ ./internal/cli/: ok
- go vet -tags nogui darwin/linux/windows: ok; gofmt -l clean
- GUI (no GUI file changes; the picker reads SearchVendors):
search-api.test.cjs in Chromium 4/4 ok. Its WebKit cases and
searcher-pick timed out at browserType.launch (180s) on mote,
where ~57 WebKit pw_run launches from several sessions hang. Not
a result about this change; WebKit not run.
Broken by hand, each made TestWSASearchAPI red: the wsaSearchError call
removed, and Cnt dropped from the body.
Not tried: the real API. No WSA key was available, so the request,
reply and error mapping rest on Tencent's docs only. The full go test
./... is to follow.
This commit is contained in:
@@ -273,7 +273,7 @@ Find them under Plugins › Discover › Gateway middleware. See [Gateway middle
|
||||
### Also
|
||||
|
||||
- **Library**: write instructions, MCP servers, skills and subagents once; magpie writes them into each agent's files in its format, and removes only what it wrote.
|
||||
- **Web search for any model**: a model that can't search gets magpie's search: a provider that can, or search APIs (Tavily, Brave, Exa, Firecrawl, You.com, DeepSeek, Doubao Search on Volcengine, SearXNG), asked in the order you drag them into, each one able to be switched off without losing its key. An API can hold several keys: searches take turns over them (or use them in order with `pick=order`), a key refused lately is asked last, and Tavily keys show what each has used of its limit, in Settings and in `magpie search`. Any agent can mount the same search as an MCP server, with a `web_search` tool and a `web_fetch` tool that reads a page by its URL.
|
||||
- **Web search for any model**: a model that can't search gets magpie's search: a provider that can, or search APIs (Tavily, Brave, Exa, Firecrawl, You.com, DeepSeek, Doubao Search on Volcengine, Yuanbao Search on Tencent Cloud, SearXNG), asked in the order you drag them into, each one able to be switched off without losing its key. An API can hold several keys: searches take turns over them (or use them in order with `pick=order`), a key refused lately is asked last, and Tavily keys show what each has used of its limit, in Settings and in `magpie search`. Any agent can mount the same search as an MCP server, with a `web_search` tool and a `web_fetch` tool that reads a page by its URL.
|
||||
- **Images and video**: an image tool for any agent over MCP, with the model you choose, and videos with a Grok subscription or a MiniMax API key (MiniMax H3).
|
||||
- **Agents kept current**: the Agents page shows each CLI's version, updates it the way it was installed, and gives the commands for the ones you don't have.
|
||||
- **WSL**: on Windows, agents inside WSL distros are wired too, and their sessions counted.
|
||||
|
||||
+1
-1
@@ -273,7 +273,7 @@ magpie plugin options model-map '{"mapping": {"fast": "deepseek/deepseek-chat"}}
|
||||
### 还有
|
||||
|
||||
- **资料库**:指令、MCP 服务器、技能和子代理只写一次,magpie 按每个 Agent 的格式写进它的文件,删除时只删自己写的部分。
|
||||
- **任何模型都能联网搜索**:不能搜索的模型由 magpie 代为搜索,用能搜索的 provider 或搜索 API(Tavily、Brave、Exa、Firecrawl、You.com、DeepSeek、火山引擎豆包搜索、SearXNG),按你拖好的顺序调用,每个都能单独关闭而不删除密钥。一个 API 可以填多个密钥:搜索默认轮流使用(`pick=order` 则按顺序),最近被拒的密钥最后才用;Tavily 的每个密钥用了多少额度,在设置页和 `magpie search` 里都能看到。任何 Agent 都能把同一个搜索挂成 MCP 服务器,提供 `web_search` 工具和按 URL 读取网页的 `web_fetch` 工具。
|
||||
- **任何模型都能联网搜索**:不能搜索的模型由 magpie 代为搜索,用能搜索的 provider 或搜索 API(Tavily、Brave、Exa、Firecrawl、You.com、DeepSeek、火山引擎豆包搜索、腾讯云元宝搜索、SearXNG),按你拖好的顺序调用,每个都能单独关闭而不删除密钥。一个 API 可以填多个密钥:搜索默认轮流使用(`pick=order` 则按顺序),最近被拒的密钥最后才用;Tavily 的每个密钥用了多少额度,在设置页和 `magpie search` 里都能看到。任何 Agent 都能把同一个搜索挂成 MCP 服务器,提供 `web_search` 工具和按 URL 读取网页的 `web_fetch` 工具。
|
||||
- **图片和视频**:通过 MCP 给任何 Agent 一个生图工具,用你选的模型;有 Grok 订阅或 MiniMax API Key(MiniMax H3)还能生成视频。
|
||||
- **Agent 保持最新**:Agents 页显示每个 CLI 的版本,按当初的安装方式更新,没装的也给出安装命令。
|
||||
- **WSL**:在 Windows 上,WSL 发行版里的 Agent 一样能配置,会话也一样统计。
|
||||
|
||||
@@ -782,7 +782,7 @@ answers as that API does (#1580). Empty is the vendor's own
|
||||
takes only an `http://` or `https://` URL with a host and no `?query` or
|
||||
`#fragment`, since `askSearchAPI` puts the vendor's path after it
|
||||
(`/search`, `/res/v1/web/search`, `/v2/search`, `/v1/tools/search`,
|
||||
`/search_api/web_search`; `SearchVendor.Paths`) with the slash at its end
|
||||
`/search_api/web_search`, `/SearchPro`; `SearchVendor.Paths`) with the slash at its end
|
||||
trimmed. A URL given ending in that path (`…/search` for Tavily, any
|
||||
case) is its base: `SetSearchAPI` saves it without the path, and
|
||||
`SearchAPI.Base` drops it from one saved with it before, so it is asked
|
||||
@@ -862,7 +862,14 @@ says its error in `ResponseMetadata.Error`, possibly with a 200, so
|
||||
`volcSearchError` reads it by its code first: 10401, 10403 and 10409 as
|
||||
403, 10406, 10408, 10410 and 10412 (no free searches left, none paid
|
||||
for, a plan missing or spent) as 402, 700429 as 429; any other code is a
|
||||
plain error (`TestVolcengineSearchAPI`). A resting key is not dropped:
|
||||
plain error (`TestVolcengineSearchAPI`). Yuanbao Search (Tencent Cloud,
|
||||
`wsa`) answers 200 to every request it handled, its error in
|
||||
`Response.Error.Code`, so `wsaSearchError` reads the code: `AuthFailure.*`,
|
||||
`UnauthorizedOperation` (a wrong key) and `ResourceNotFound` (the service
|
||||
not opened) as 403, `ResourceUnavailable` (an account in arrears),
|
||||
`LimitExceeded` and `ResourceInsufficient` as 402,
|
||||
`RequestLimitExceeded.*` as 429; any other code is a plain error
|
||||
(`TestWSASearchAPI`). A resting key is not dropped:
|
||||
it is asked after every key that isn't, the one back soonest first, so a
|
||||
search still has every key to fall back on. A key that answers wakes.
|
||||
Rests are held by vendor and a hash of the key (`searchKeyID`), never the
|
||||
|
||||
@@ -86,7 +86,7 @@ const usage = `magpie — one place to pick every agent's model
|
||||
magpie visible [<agent> <family|provider|group>,… | all | --only-picked | --show-new]
|
||||
which models an agent is shown: families (magpie provider/group set <id> family=…),
|
||||
or only the models ticked for it, a new one off until it is ticked
|
||||
magpie search [add <api> <key>|rm <api>] Tavily, Brave, Exa, Firecrawl, You.com, DeepSeek, Doubao Search (Volcengine) or SearXNG for web search when no provider can search
|
||||
magpie search [add <api> <key>|rm <api>] Tavily, Brave, Exa, Firecrawl, You.com, DeepSeek, Doubao Search (Volcengine), Yuanbao Search (Tencent Cloud) or SearXNG for web search when no provider can search
|
||||
magpie groups routing groups: several models agents pick as one, group/<id>
|
||||
magpie group add <name> models=<m1>,<m2> [routing=smart|order|rotate|usage|pace|weight|free|fast] [stays=auto|session|turn|off]
|
||||
magpie group <id> | set <id> k=v… | rm <id> show, change or remove one (magpie group help for more)
|
||||
|
||||
@@ -26,7 +26,7 @@ const searchUsage = `usage:
|
||||
magpie search move <api> <n> put one at place n in the order they are asked
|
||||
magpie search rm <api> take one away
|
||||
|
||||
apis: tavily, brave, exa, firecrawl, you, deepseek, volcengine, searxng
|
||||
apis: tavily, brave, exa, firecrawl, you, deepseek, volcengine, wsa, searxng
|
||||
|
||||
url= is the API's base URL, for an endpoint of your own that answers as that API
|
||||
does (e.g. url=https://search.example.com/tavily). Without it the vendor's own is
|
||||
@@ -55,7 +55,7 @@ func searchCmd(args []string) error {
|
||||
if len(args) == 0 {
|
||||
as := provider.StoredSearchAPIs()
|
||||
if len(as) == 0 {
|
||||
fmt.Println(muted.Render(" no search API · magpie search add <tavily|brave|exa|firecrawl|you|deepseek|volcengine|searxng> <key>"))
|
||||
fmt.Println(muted.Render(" no search API · magpie search add <tavily|brave|exa|firecrawl|you|deepseek|volcengine|wsa|searxng> <key>"))
|
||||
return nil
|
||||
}
|
||||
for i, a := range as {
|
||||
|
||||
@@ -236,6 +236,13 @@ func (s *Server) askSearchAPI(ctx context.Context, a provider.SearchAPI, query s
|
||||
// with a URL (NeedUrl leaves out its 火山如意 cards, which have none)
|
||||
post("/search_api/web_search", map[string]any{"Query": firstRunes(query, volcQueryMax), "SearchType": "web",
|
||||
"Count": searchHits, "Filter": map[string]any{"NeedUrl": true}})
|
||||
case "wsa":
|
||||
// Tencent Cloud's Yuanbao Search by its service API key
|
||||
// (cloud.tencent.com/document/product/1806/130615): Cnt is one of
|
||||
// 10/20/30/40/50 (cloud.tencent.com/document/api/1806/121811), and
|
||||
// a smaller one is turned away, so the fewest, cut to searchHits
|
||||
// below
|
||||
post("/SearchPro", map[string]any{"Query": query, "Cnt": wsaCnt})
|
||||
case "searxng":
|
||||
get("/search", url.Values{"q": {query}, "format": {"json"}})
|
||||
case "you":
|
||||
@@ -299,10 +306,14 @@ func (s *Server) askSearchAPI(ctx context.Context, a provider.SearchAPI, query s
|
||||
}
|
||||
status := res.StatusCode
|
||||
var volcMsg string
|
||||
if a.Vendor == "volcengine" {
|
||||
switch a.Vendor {
|
||||
case "volcengine":
|
||||
// its error is in ResponseMetadata.Error, a code beside the
|
||||
// status, and may come with a 200
|
||||
status, volcMsg = volcSearchError(b, status)
|
||||
case "wsa":
|
||||
// Tencent Cloud's is in Response.Error, its HTTP status 200
|
||||
status, volcMsg = wsaSearchError(b, status)
|
||||
}
|
||||
if status >= 300 {
|
||||
msg := provider.APIError(b, res.Status)
|
||||
@@ -344,6 +355,8 @@ func readSearchAPI(vendor string, b []byte) ([]foundPage, error) {
|
||||
return readYouSearch(b)
|
||||
case "volcengine":
|
||||
return readVolcSearch(b)
|
||||
case "wsa":
|
||||
return readWSASearch(b)
|
||||
}
|
||||
type result struct {
|
||||
Title string `json:"title"`
|
||||
@@ -489,6 +502,85 @@ func readVolcSearch(b []byte) ([]foundPage, error) {
|
||||
return pages, nil
|
||||
}
|
||||
|
||||
// wsaCnt is the Cnt Yuanbao Search is asked for: the fewest it takes.
|
||||
const wsaCnt = 10
|
||||
|
||||
// wsaSearchError is the status a Yuanbao Search (Tencent Cloud) reply
|
||||
// stands for, and its error's words. Tencent Cloud answers 200 whenever
|
||||
// the request was handled (cloud.tencent.com/document/api/1806/121818),
|
||||
// its error in Response.Error {Code, Message}, so the code decides: one
|
||||
// about the key or the service not opened for it is a key turned away
|
||||
// (403), one about an account in arrears (ResourceUnavailable, "请检查账号
|
||||
// 是否欠费") or a spent quota out of credit (402), a frequency limit
|
||||
// rate limited (429). Any other code is a plain error.
|
||||
func wsaSearchError(b []byte, status int) (int, string) {
|
||||
var out struct {
|
||||
Response struct {
|
||||
Error *struct{ Code, Message string }
|
||||
}
|
||||
}
|
||||
if json.Unmarshal(b, &out) != nil || out.Response.Error == nil || out.Response.Error.Code == "" {
|
||||
return status, ""
|
||||
}
|
||||
e := out.Response.Error
|
||||
msg := strings.TrimSpace(e.Code + " " + e.Message)
|
||||
code, _, _ := strings.Cut(e.Code, ".")
|
||||
switch code {
|
||||
case "AuthFailure", "UnauthorizedOperation", "ResourceNotFound":
|
||||
// a key it doesn't take ("请检查服务密钥 API KEY 是否正确"), or
|
||||
// the service not opened ("用户资源未开通")
|
||||
return 403, msg
|
||||
case "ResourceUnavailable", "LimitExceeded", "ResourceInsufficient":
|
||||
return 402, msg
|
||||
case "RequestLimitExceeded":
|
||||
return 429, msg
|
||||
}
|
||||
if status < 300 {
|
||||
status = 502
|
||||
}
|
||||
return status, msg
|
||||
}
|
||||
|
||||
// readWSASearch reads Yuanbao Search's reply: Response.Pages, each page
|
||||
// a JSON object in a string, with its title, url, date, passage (its
|
||||
// standard summary, in every edition) and content (a summary for the
|
||||
// query, not in its 极速版).
|
||||
func readWSASearch(b []byte) ([]foundPage, error) {
|
||||
var out struct {
|
||||
Response *struct {
|
||||
Pages []string
|
||||
}
|
||||
}
|
||||
if err := json.Unmarshal(b, &out); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if out.Response == nil || out.Response.Pages == nil {
|
||||
return nil, errors.New("no Response.Pages in it")
|
||||
}
|
||||
var pages []foundPage
|
||||
for _, s := range out.Response.Pages {
|
||||
var h struct {
|
||||
Title, URL, Date, Passage, Content string
|
||||
}
|
||||
if json.Unmarshal([]byte(s), &h) != nil || h.URL == "" {
|
||||
continue
|
||||
}
|
||||
text := h.Passage
|
||||
if strings.TrimSpace(searchPlain(text)) == "" || searchPlain(text) == searchPlain(h.Title) {
|
||||
// a passage that is only its title says less than its content
|
||||
if c := searchPlain(h.Content); c != "" {
|
||||
text = h.Content
|
||||
}
|
||||
}
|
||||
title := searchPlain(h.Title)
|
||||
if title == "" {
|
||||
title = h.URL
|
||||
}
|
||||
pages = append(pages, foundPage{Title: title, URL: h.URL, Text: clipText(searchPlain(text), pageText), Age: h.Date})
|
||||
}
|
||||
return pages, nil
|
||||
}
|
||||
|
||||
// firstRunes is s cut to at most n characters, with nothing added.
|
||||
func firstRunes(s string, n int) string {
|
||||
i := 0
|
||||
|
||||
@@ -465,3 +465,128 @@ func TestVolcengineSearchAPI(t *testing.T) {
|
||||
t.Errorf("vendor %+v", v)
|
||||
}
|
||||
}
|
||||
|
||||
// TestWSASearchAPI: Tencent Cloud's Yuanbao Search (元宝搜索, wsa) by its
|
||||
// service API key answers from its docs' own example replies, asked as
|
||||
// its docs say, its errors read by their code (plugins#509, chenjiangzi).
|
||||
// wsa_searchpro.json is SearchPro's API page's example
|
||||
// (cloud.tencent.com/document/api/1806/121811) byte for byte;
|
||||
// wsa_searchpro_apikey.json the API-key page's
|
||||
// (cloud.tencent.com/document/product/1806/130615), whose page shows each
|
||||
// quote in Pages escaped twice (\\", not JSON), once here.
|
||||
func TestWSASearchAPI(t *testing.T) {
|
||||
t.Setenv("XDG_CONFIG_HOME", t.TempDir())
|
||||
api, err := os.ReadFile("testdata/wsa_searchpro.json")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
keyed, err := os.ReadFile("testdata/wsa_searchpro_apikey.json")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// its docs' error reply (cloud.tencent.com/document/api/1806/121818)
|
||||
errReply := func(code, msg string) string {
|
||||
return `{
|
||||
"Response": {
|
||||
"Error": {
|
||||
"Code": "` + code + `",
|
||||
"Message": "` + msg + `"
|
||||
},
|
||||
"RequestId": "ed93f3cb-f35e-473f-b9f3-0d451b8b79c6"
|
||||
}
|
||||
}`
|
||||
}
|
||||
var mu sync.Mutex
|
||||
var got []map[string]any
|
||||
var paths, auths []string
|
||||
reply := keyed
|
||||
answer := func(w http.ResponseWriter) { w.Write(reply) }
|
||||
f := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
b, _ := io.ReadAll(r.Body)
|
||||
var body map[string]any
|
||||
json.Unmarshal(b, &body)
|
||||
mu.Lock()
|
||||
got = append(got, body)
|
||||
paths = append(paths, r.Method+" "+r.URL.Path+" "+r.Header.Get("Content-Type"))
|
||||
auths = append(auths, r.Header.Get("Authorization"))
|
||||
a := answer
|
||||
mu.Unlock()
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
a(w)
|
||||
}))
|
||||
t.Cleanup(f.Close)
|
||||
s := New()
|
||||
a := provider.SearchAPI{Vendor: "wsa", Key: "sk-209b0123456789e23d", URL: f.URL}
|
||||
|
||||
pages, err := s.askSearchAPI(context.Background(), a, "三星堆的由来")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(pages) != 3 || pages[0].URL != "https://www.163.com/dy/article/J43Q2STU0553FV3Z.html" ||
|
||||
pages[0].Title != "三星堆名字的由来,你真的了解吗?三星堆的参观攻略,建议收藏青铜文物玉器古蜀国三星堆遗址_网易订阅" ||
|
||||
!strings.HasPrefix(pages[0].Text, "三星堆名字的由来 三星堆遗址位于四川省广汉市西北部") ||
|
||||
pages[0].Age != "2024-06-07 19:00:51" ||
|
||||
pages[1].URL != "https://news.qq.com/rain/a/20240903A048N700" ||
|
||||
// its <strong> marks taken out
|
||||
pages[2].Text != "最早在1929年,一位当地农民在遗址区域内偶然发现了一个玉器坑,这一发现引起了考古界的关注。在四川省广汉市西北部,有三座稍稍隆起的土堆呈直线排列,这种地形布局与夜空中闪烁的三颗星辰相呼应,因此得名“三星堆”。" {
|
||||
t.Fatalf("pages %+v", pages)
|
||||
}
|
||||
if paths[0] != "POST /SearchPro application/json" || auths[0] != "Bearer sk-209b0123456789e23d" {
|
||||
t.Fatalf("asked %q with %q", paths[0], auths[0])
|
||||
}
|
||||
// Query as given, and Cnt 10: fewer is turned away ("illegal Cnt")
|
||||
if len(got[0]) != 2 || got[0]["Query"] != "三星堆的由来" || got[0]["Cnt"] != float64(10) {
|
||||
t.Fatalf("body %v", got[0])
|
||||
}
|
||||
|
||||
// the API page's example: a passage that is only its title gives
|
||||
// way to its content; a date as it gives it
|
||||
mu.Lock()
|
||||
reply = api
|
||||
mu.Unlock()
|
||||
pages, err = s.askSearchAPI(context.Background(), a, "人工智能发展现状")
|
||||
if err != nil || len(pages) != 1 || pages[0].URL != "https://www.cac.gov.cn/2025-02/26/c_1742272852299173.htm" ||
|
||||
pages[0].Title != "【新思想引领新征程】人工智能创新加速我国产业转型升级_中央网络安全和信息化委员会办公室" ||
|
||||
pages[0].Text != "【新思想引领新征程】人工智能创新加速我国产业转型升级_中央网络安全和信息化委员会办公室..." ||
|
||||
pages[0].Age != "2025/02/26 09:37:00" {
|
||||
t.Fatalf("pages %+v, %v", pages, err)
|
||||
}
|
||||
|
||||
// its errors come in Response.Error with a 200, read by their code
|
||||
for _, c := range []struct {
|
||||
code, msg string
|
||||
want int
|
||||
why string
|
||||
}{
|
||||
{"UnauthorizedOperation", "未授权操作。", 403, "turned away"},
|
||||
{"AuthFailure.SignatureFailure", "The provided credentials could not be validated. Please check your signature is correct.", 403, "turned away"},
|
||||
{"ResourceNotFound", "用户资源未开通。", 403, "turned away"},
|
||||
{"ResourceUnavailable", "用户资源不可用。", 402, "out of credit"},
|
||||
{"LimitExceeded", "超过配额限制。", 402, "out of credit"},
|
||||
{"RequestLimitExceeded", "请求的次数超过了频率限制。", 429, "rate limited"},
|
||||
{"RequestLimitExceeded.UinLimitExceeded", "主账号限频。", 429, "rate limited"},
|
||||
{"InvalidParameter", "illegal Cnt sk-209b0123456789e23d", 0, ""},
|
||||
{"InternalError", "内部错误。", 0, ""},
|
||||
} {
|
||||
mu.Lock()
|
||||
answer = func(w http.ResponseWriter) { io.WriteString(w, errReply(c.code, c.msg)) }
|
||||
mu.Unlock()
|
||||
_, err := s.askSearchAPI(context.Background(), a, "q")
|
||||
if err == nil || !strings.Contains(err.Error(), c.code+" ") || strings.Contains(err.Error(), "sk-209b0123456789e23d") {
|
||||
t.Fatalf("%s: %v", c.code, err)
|
||||
}
|
||||
var r searchRefused
|
||||
if refused := errors.As(err, &r); refused != (c.want != 0) || refused && r.status != c.want {
|
||||
t.Fatalf("%s: %#v", c.code, err)
|
||||
}
|
||||
if c.want != 0 {
|
||||
if _, why := searchRestFor("wsa", r.status, "", time.Now()); why != c.why {
|
||||
t.Errorf("%s rests as %q", c.code, why)
|
||||
}
|
||||
}
|
||||
}
|
||||
if v, ok := provider.SearchVendorOf("wsa"); !ok || v.Base != "https://api.wsa.cloud.tencent.com" || v.KeyOptional ||
|
||||
v.KeysURL != "https://console.cloud.tencent.com/wsapi/index" {
|
||||
t.Errorf("vendor %+v", v)
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"Response": {
|
||||
"Pages": [
|
||||
"{\"title\":\"【新思想引领新征程】人工智能创新加速我国产业转型升级_中央网络安全和信息化委员会办公室\",\"url\":\"https://www.cac.gov.cn/2025-02/26/c_1742272852299173.htm\",\"date\":\"2025/02/26 09:37:00\",\"passage\":\"【新思想引领新征程】人工智能创新加速我国产业转型升级_中央网络安全和信息化委员会办公室\",\"content\":\"【新思想引领新征程】人工智能创新加速我国产业转型升级_中央网络安全和信息化委员会办公室...\",\"site\":\"中国网信网\",\"favicon\":\"https://cdn-yb.icon.qq.com/zuowei_dir/www_cac_gov_cn.ico\",\"score\":0.84889734,\"pics\":[{\"caption\":\"CCTV报道人工智能创新加速我国产业转型升级\",\"origin_url\":\"https://www.cac.gov.cn/rootimages/2025/02/26/1742272852299173-1742272852345396.jpg\"},{\"caption\":\"CCTV13报道工厂内正在搬运黑色料箱的机械臂\",\"origin_url\":\"https://www.cac.gov.cn/rootimages/2025/02/26/1742272852299173-1742272852346371.jpg\"},{\"caption\":\"AI创新文章配图服务器机房\",\"origin_url\":\"https://www.cac.gov.cn/rootimages/2025/02/26/1742272852299173-1742272852347738.jpg\"},{\"caption\":\"CCTV13报道长春市人工智能产业展示\",\"origin_url\":\"https://www.cac.gov.cn/rootimages/2025/02/26/1742272852299173-1742272852348427.jpg\"},{\"caption\":\"央视报道人工智能创新加速产业转型升级\",\"origin_url\":\"https://www.cac.gov.cn/rootimages/2025/02/26/1742272852299173-1742272852350041.jpg\"},{\"caption\":\"CCTV13报道之江实验室建筑及园区\",\"origin_url\":\"https://www.cac.gov.cn/rootimages/2025/02/26/1742272852299173-1742272852350602.jpg\"}]}"
|
||||
],
|
||||
"Query": "人工智能发展现状",
|
||||
"Version": "flagship",
|
||||
"RequestId": "39684d0c-0504-4892-b7b4-0d8f05203007"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"Response": {
|
||||
"Pages": [
|
||||
"{\"passage\":\"三星堆名字的由来 三星堆遗址位于四川省广汉市西北部,距离成都约40公里,地理位置独特,被三条河流环绕,形成了天然的地理屏障。据《华阳国志》记载,古蜀国“有三江,皆发源于岷山,流至成都平原”。 这三条河流,即今之鸭子河、石亭江和郪江,在三星堆附近交汇,形成了一片肥沃的土地。三星堆之名,最初来源于这一地区的地形特征——三座小山丘呈三角状分布,犹如夜空中的三星,故得名“三星堆”。 三星堆名称的演变 三星堆遗址的发掘,始于20世纪20年代末期,但其真正引起广泛关注是在1986年两个大型祭祀坑的发现之后。在此之前,三星堆只是当地的一个地名,直到考古学家们在这里发现了大量的古代遗存,三星堆才逐渐成为了世界瞩目的焦点。 随着研究的深入,三星堆之名也从一个简单的地理标识,演变为承载着深厚历史文化的符号。\",\"score\":0.897802,\"date\":\"2024-06-07 19:00:51\",\"title\":\"三星堆名字的由来,你真的了解吗?三星堆的参观攻略,建议收藏青铜文物玉器古蜀国三星堆遗址_网易订阅\",\"url\":\"https://www.163.com/dy/article/J43Q2STU0553FV3Z.html\",\"site\":\"网易\",\"images\":[],\"favicon\":\"http://img01.sogoucdn.com/app/a/200913/a51423369a5d5a.png\"}",
|
||||
"{\"passage\":\"一、地理环境因素三星堆遗址位于四川省广汉市,距离成都约40公里。在四川省广汉市西北部,有三座稍稍隆起的土堆呈直线排列,这种地形布局与夜空中闪烁的三颗星辰相呼应,因此得名“三星堆”。这三个土堆历史悠久,据考古学家研究,它们的存在可以追溯到3000多年前。这三个土堆不仅形态独特,而且在古代具有一定的宗教或象征意义。在三星堆遗址的东北方,有一段残破的城墙,这段城墙呈现出弯月形状,与三个土堆隔河相望。这种自然与人工相结合的景观,在当时的社会背景下,很可能被赋予了一定的神话色彩和宗教意义。这一景观组合在历史上更是被形象地称为“三星伴月”,进一步增添了三星堆名字的文化韵味。其中的“三星”指的就是那三个土堆,而“月”则是指那段弯月般的城墙。当地居民根据这一独特的地理特征,赋予了这片土地以“三星伴月”的美称。这种说法不仅反映了古人对于自然现象的崇拜和敬畏之情,同时也体现了人们对于美好事物的向往和赞美之心。随着时间的推移,这一称谓逐渐深入人心,并最终演变成了“三星堆”这一名称。\",\"score\":0.8887853,\"date\":\"2024-09-03 12:59:00\",\"title\":\"三星堆名字的由来_腾讯新闻\",\"url\":\"https://news.qq.com/rain/a/20240903A048N700\",\"site\":\"腾讯网\",\"images\":[],\"favicon\":\"http://img02.sogoucdn.com/app/a/200913/ab735a258a90e8.png\"}",
|
||||
"{\"passage\":\"最早在1929年,一位当地农民在遗址区域内偶然发现了一个玉器坑,这一发现引起了考古界的关注。在四川省广汉市西北部,有<strong>三座稍稍隆起的土堆呈直线排列</strong>,这种地形布局与夜空中闪烁的<strong>三颗星辰</strong>相呼应,因此得名<strong>“三星堆”</strong>。\",\"score\":0.86471426,\"date\":\"2024-09-03 13:06:46\",\"title\":\"三星堆名字的由来\",\"url\":\"https://so.html5.qq.com/page/real/search_news?docid=70000021_14266d6996591252\",\"site\":\"企鹅号\",\"images\":[],\"favicon\":\"http://img02.sogoucdn.com/app/a/200913/ab735a25.png\"}"
|
||||
],
|
||||
"Query": "三星堆的由来",
|
||||
"RequestId": "6f8df221-9a68-4ea2-90d6-a9590cae244c"
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package provider
|
||||
|
||||
// Search APIs answer a model's web search when no provider can (#419):
|
||||
// Tavily, Brave Search, Exa, Firecrawl, You.com, DeepSeek, Volcengine's
|
||||
// Doubao Search, a SearXNG of the user's. They are
|
||||
// Doubao Search, Tencent Cloud's Yuanbao Search, a SearXNG of the user's. They are
|
||||
// kept in providers.json beside the providers, their keys with theirs.
|
||||
|
||||
import (
|
||||
@@ -68,6 +68,10 @@ var SearchVendors = []SearchVendor{
|
||||
// Volcengine's Doubao Search Custom (豆包搜索 Custom版, once 联网搜索 /
|
||||
// 融合信息搜索), with an API key from its console (CyberCaius on Discord)
|
||||
{ID: "volcengine", Name: "Doubao Search (Volcengine)", Base: "https://open.feedcoopapi.com", KeysURL: "https://console.volcengine.com/search-infinity/api-key", Paths: []string{"/search_api/web_search"}},
|
||||
// Tencent Cloud's Yuanbao Search (元宝搜索, wsa) by its service API
|
||||
// key (服务 API KEY 方式, cloud.tencent.com/document/product/1806/130615),
|
||||
// made in its console's 概览 › 服务 API KEY 方式 (plugins#509)
|
||||
{ID: "wsa", Name: "Yuanbao Search (Tencent Cloud)", Base: "https://api.wsa.cloud.tencent.com", KeysURL: "https://console.cloud.tencent.com/wsapi/index", Paths: []string{"/SearchPro"}},
|
||||
{ID: "searxng", Name: "SearXNG", KeyOptional: true, Paths: []string{"/search"}},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user