From 305545623a85b1b055f50bf8bdefeb8d147fb4b2 Mon Sep 17 00:00:00 2001 From: Chris Staley Date: Thu, 2 Apr 2026 10:08:49 -0600 Subject: [PATCH] =?UTF-8?q?docs:=20fix=20plan=20=E2=80=94=20add=20context?= =?UTF-8?q?=5Flength=20to=20both=20catalog=20model=20pushes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plans/2026-04-02-gemini-model-metadata.md | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/docs/superpowers/plans/2026-04-02-gemini-model-metadata.md b/docs/superpowers/plans/2026-04-02-gemini-model-metadata.md index 34dc05c31f..b595b50b97 100644 --- a/docs/superpowers/plans/2026-04-02-gemini-model-metadata.md +++ b/docs/superpowers/plans/2026-04-02-gemini-model-metadata.md @@ -216,13 +216,13 @@ git commit -m "feat(db): extend replaceCustomModels with metadata fields" ### Task 4: Use stored token limits in catalog **Files:** -- Modify: `src/app/api/v1/models/catalog.ts:443-458` +- Modify: `src/app/api/v1/models/catalog.ts:443-480` - [ ] **Step 1: Add context_length from stored inputTokenLimit for custom models** -In the custom models section, add `context_length` to the first `models.push` (around line 443). After the existing `...(visionFields || {}),` line, add: +There are two `models.push` calls for custom models — the main one and the provider-prefixed alias. Both need `context_length`. -The full replacement for lines 443-458: +Replace lines 443-458 (first push) with: ```typescript models.push({ @@ -246,6 +246,26 @@ The full replacement for lines 443-458: }); ``` +Also add `context_length` to the second push (provider-prefixed alias, around line 469-480). Replace that push with: + +```typescript + models.push({ + id: providerPrefixedId, + object: "model", + created: timestamp, + owned_by: canonicalProviderId, + permission: [], + root: modelId, + parent: aliasId, + custom: true, + ...(modelType ? { type: modelType } : {}), + ...(typeof (model as any).inputTokenLimit === "number" + ? { context_length: (model as any).inputTokenLimit } + : {}), + ...(providerVisionFields || {}), + }); +``` + - [ ] **Step 2: Build to verify no type errors** Run: `npx tsc --noEmit --pretty 2>&1 | head -30`