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.