1 parent
a8f689e39c
commit
c340aec110
59 files changed
+1108
-1590
No files matched your search
@@ -128,7 +128,7 @@ test('each backend builds its own protocol request against the configured host',
|
||||
// The Codex group refuses a bare string input on some channels.
|
||||
assert.ok(Array.isArray(gpt.body.input))
|
||||
|
||||
assert.equal(DEFAULT_SEARCH_BACKEND, 'claude')
|
||||
assert.equal(DEFAULT_SEARCH_BACKEND, 'gpt')
|
||||
assert.throws(() => buildSearchRequest('bing', { apiHost: 'https://gw.example', query: 'q' }), /not supported/u)
|
||||
})
|
||||
|
||||
@@ -138,6 +138,7 @@ test('a search authenticates with the active ring key only and refuses redirects
|
||||
const provider = createGeek2APISearchProvider({
|
||||
ring,
|
||||
hosts: stubHostPool(createHostPool, ['https://gw.example']),
|
||||
backend: () => 'claude',
|
||||
fetchImpl: async (url, init) => {
|
||||
calls.push({ url, init })
|
||||
return json(200, MESSAGES_ANSWER)
|
||||
@@ -172,7 +173,7 @@ test('the backend preference is read per search', async () => {
|
||||
await provider.search({ query: 'b' })
|
||||
backend = 'unknown'
|
||||
await provider.search({ query: 'c' })
|
||||
assert.deepEqual(urls, ['https://gw.example/v1/messages', 'https://gw.example/v1/responses', 'https://gw.example/v1/messages'])
|
||||
assert.deepEqual(urls, ['https://gw.example/v1/messages', 'https://gw.example/v1/responses', 'https://gw.example/v1/responses'])
|
||||
})
|
||||
|
||||
test('an exhausted key moves aside through the shared sink and the next key answers', async () => {
|
||||
@@ -182,6 +183,7 @@ test('an exhausted key moves aside through the shared sink and the next key answ
|
||||
const provider = createGeek2APISearchProvider({
|
||||
ring,
|
||||
hosts: stubHostPool(createHostPool, ['https://gw.example']),
|
||||
backend: () => 'claude',
|
||||
onKeyFailure: (kind, message, key, id) => {
|
||||
failures.push({ kind, key, id })
|
||||
void ring.disable(id, kind)
|
||||
@@ -322,6 +324,7 @@ test('a host that never answers is set aside and the same key searches on the ne
|
||||
const provider = createGeek2APISearchProvider({
|
||||
ring,
|
||||
hosts,
|
||||
backend: () => 'claude',
|
||||
onKeyFailure: kind => failures.push(kind),
|
||||
fetchImpl: async url => {
|
||||
urls.push(url)
|
||||
@@ -352,7 +355,7 @@ function stubProvider(id, answer) {
|
||||
test('auto search serves Geek2API sessions itself and hands every other request to the fallback', async () => {
|
||||
const geek2api = stubProvider(GEEK2API_SEARCH_PROVIDER_ID, { sources: [{ url: 'https://p.example' }], truncated: false })
|
||||
const fallback = stubProvider('kimi-subscription', { sources: [{ url: 'https://k.example' }], truncated: false })
|
||||
let modelProvider = 'geek2api'
|
||||
let modelProvider = 'infstarapi'
|
||||
const auto = createGeek2APIAutoSearchProvider({
|
||||
geek2api,
|
||||
resolveModelProvider: () => modelProvider,
|
||||
|
||||
Reference in new issue
Block a user