release: 0.2.0 — custom models, gateway context caps, free daily keys

- Custom models: add a model by id (protocol, reasoning, images, context
  window, max output) next to the built-in catalog.
- Gateway context caps: read per-model context_window from each key's
  /v1/models and narrow the catalog model to the tightest window (free
  DeepSeek group: 200K, 32K output) so DSH compacts before the cap.
- Free daily keys: show each key's expiry, flag the renewal window and
  link to https://www.geek2api.com/free-ds; the no-usable-key error points
  there too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
大阔andClaude Opus 5.5 committed 2026-11-16 21:44:12 +08:00
1 parent 93a5fe93b4
commit a8f689e39c
21 files changed
+2161 -427

No files matched your search

+27 -1
View File
@@ -59,7 +59,9 @@ function host({ generation = '0.2', writable = true, failWrite = false, initial
},
effect(callback) { return callback() },
}
const config = generation === '0.2' ? { hiddenModels: { get: () => values.hiddenModels } } : {}
const config = generation === '0.2'
? { hiddenModels: { get: () => values.hiddenModels }, customModels: { get: () => values.customModels } }
: {}
apply(ctx, config)
return {
seen,
@@ -182,3 +184,27 @@ test('the actual DSH LLM registry refreshes discovery atomically and keeps a pre
assert.deepEqual((await llm.listModels('geek2api')).map(model => model.id), ['grok-4.7'])
registration()
})
for (const generation of ['0.1', '0.2']) {
test(`DSH ${generation}: a custom model added in the panel reaches the picker and survives reconstruction`, async () => {
const env = host({ generation })
const { seen } = env
const added = await seen.handler('models/custom/update', { customModels: [{ id: 'qwen3-max', name: 'Qwen3 Max', api: 'openai-completions' }] })
assert.equal(added.ok, true)
assert.deepEqual(seen.updates.at(-1).customModels.map(entry => entry.id), ['qwen3-max'])
assert.equal(seen.notifications, 1, 'one registry refresh for the changed catalog')
assert.equal(added.value.models.at(-1).id, 'qwen3-max')
assert.equal(added.value.models.at(-1).custom, true)
assert.equal((await seen.adapter.listModels('geek2api')).at(-1).id, 'qwen3-max')
assert.equal((await seen.adapter.resolveModel('geek2api', 'qwen3-max')).id, 'qwen3-max')
assert.equal((await env.reapply().seen.adapter.listModels('geek2api')).at(-1).id, 'qwen3-max')
const refused = await seen.handler('models/custom/update', { customModels: [{ id: 'claude-opus-5-5' }] })
assert.equal(refused.ok, false)
assert.match(refused.error.message, /already a built-in model/u, 'the reason reaches the panel')
await seen.handler('models/custom/update', { customModels: [] })
assert.equal(seen.notifications, 2)
assert.ok(!(await seen.adapter.listModels('geek2api')).some(model => model.id === 'qwen3-max'))
})
}