1 parent
a8f689e39c
commit
c340aec110
59 files changed
+1108
-1590
No files matched your search
@@ -46,7 +46,7 @@ test('a custom model that cannot be served is refused with a reason the panel ma
|
||||
refuses({ id: 'has space' }, /may only use/u)
|
||||
refuses({ id: '-leading' }, /may only use/u)
|
||||
refuses({ id: 'x'.repeat(129) }, /may only use/u)
|
||||
refuses({ id: 'claude-opus-5-5' }, /already a built-in/u)
|
||||
refuses({ id: 'gpt-6.1-sol' }, /already a built-in/u)
|
||||
refuses({ id: 'm', api: 'google-generative-ai' }, /unsupported protocol/u)
|
||||
refuses({ id: 'm', contextWindow: 10 }, /context window/u)
|
||||
refuses({ id: 'm', contextWindow: 1.5e4 + 0.5 }, /context window/u)
|
||||
@@ -71,19 +71,19 @@ test('each protocol gets the base URL and compat its built-in models use', () =>
|
||||
const completions = customCatalogModel(parseCustomModel({ id: 'qwen3-max' }))
|
||||
assert.equal(completions.provider, PROVIDER)
|
||||
assert.equal(completions.name, 'qwen3-max', 'an empty name shows the id')
|
||||
assert.equal(completions.baseUrl, 'https://hk.geek2api.com/v1')
|
||||
assert.equal(completions.baseUrl, 'https://sub.infstar.org/v1')
|
||||
assert.equal(completions.compat.maxTokensField, 'max_tokens')
|
||||
assert.equal(completions.reasoning, false)
|
||||
assert.deepEqual([...completions.input], ['text'])
|
||||
|
||||
const responses = customCatalogModel(parseCustomModel({ id: 'gpt-x', api: 'openai-responses', reasoning: true, image: true }))
|
||||
assert.equal(responses.baseUrl, 'https://hk.geek2api.com/v1')
|
||||
assert.equal(responses.baseUrl, 'https://sub.infstar.org/v1')
|
||||
assert.equal(responses.compat, undefined)
|
||||
assert.deepEqual([...responses.input], ['text', 'image'])
|
||||
assert.equal(responses.thinkingLevelMap.minimal, null)
|
||||
|
||||
const messages = customCatalogModel(parseCustomModel({ id: 'claude-x', api: 'anthropic-messages', name: 'Claude X' }))
|
||||
assert.equal(messages.baseUrl, 'https://hk.geek2api.com', 'the Anthropic client appends /v1/messages itself')
|
||||
assert.equal(messages.baseUrl, 'https://sub.infstar.org', 'the Anthropic client appends /v1/messages itself')
|
||||
assert.equal(messages.name, 'Claude X')
|
||||
})
|
||||
|
||||
@@ -128,7 +128,7 @@ test('custom models join the catalog after the built-in ones, selected by defaul
|
||||
|
||||
// An invalid list is refused without writing anything.
|
||||
const writes = seen.writes.length
|
||||
await assert.rejects(controller.updateCustom({ customModels: [{ id: 'gpt-6-luna' }] }), /already a built-in/u)
|
||||
await assert.rejects(controller.updateCustom({ customModels: [{ id: 'gpt-6.2-astra' }] }), /already a built-in/u)
|
||||
assert.equal(seen.writes.length, writes)
|
||||
|
||||
await controller.updateCustom({ customModels: [] })
|
||||
@@ -205,7 +205,7 @@ test('key coverage is measured for custom models too', async () => {
|
||||
const { controller } = selection({ customModels: [{ id: 'qwen3-max' }] })
|
||||
const fetchImpl = async url => {
|
||||
const body = url.endsWith('/v1/models')
|
||||
? { object: 'list', data: ['qwen3-max', 'claude-opus-5-5', 'other'].map(id => ({ id })) }
|
||||
? { object: 'list', data: ['qwen3-max', 'gpt-6.2-astra', 'other'].map(id => ({ id })) }
|
||||
: { mode: 'unrestricted', balance: 1 }
|
||||
return { ok: true, status: 200, json: async () => body, text: async () => JSON.stringify(body) }
|
||||
}
|
||||
@@ -217,7 +217,7 @@ test('key coverage is measured for custom models too', async () => {
|
||||
})
|
||||
const value = await reader.read()
|
||||
assert.equal(value.keys[0].coverage['qwen3-max'], true)
|
||||
assert.equal(value.keys[0].coverage['gpt-6.1-sol'], false)
|
||||
assert.equal(value.keys[0].coverage['gpt-6.2-astra'], true)
|
||||
assert.equal(value.keys[0].extraModels, 1, 'a custom model is no longer "outside the list"')
|
||||
assert.equal(reader.covers('k', 'qwen3-max'), true)
|
||||
})
|
||||
Reference in new issue
Block a user