From 17529e762e384f5a368604ae0479d5d1ec9a892b Mon Sep 17 00:00:00 2001 From: redshift <213178690+1ftredsh@users.noreply.github.com> Date: Sat, 30 May 2026 14:04:24 +0800 Subject: [PATCH] feat: add context window support to pi integration - Add optional contextWindow field to PiModelEntry type - Map model.context_length to contextWindow when available - Add context_length to RoutstrModel type in registry --- src/integrations/pi.ts | 11 ++++++++--- src/integrations/registry.ts | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/integrations/pi.ts b/src/integrations/pi.ts index bdc0ac6..6f12f2d 100644 --- a/src/integrations/pi.ts +++ b/src/integrations/pi.ts @@ -8,6 +8,7 @@ import { callDaemon, getDaemonBaseUrl } from "../utils/daemon-client"; type PiModelEntry = { id: string; + contextWindow?: number; }; type PiProviderConfig = { @@ -60,9 +61,13 @@ export async function installPiIntegration( return; } - const providerModels: PiModelEntry[] = models.map((model) => ({ - id: model.id, - })); + const providerModels: PiModelEntry[] = models.map((model) => { + const entry: PiModelEntry = { id: model.id }; + if (model.context_length !== undefined && model.context_length > 0) { + entry.contextWindow = model.context_length; + } + return entry; + }); piConfig.providers["routstr"] = { baseUrl, diff --git a/src/integrations/registry.ts b/src/integrations/registry.ts index c69375f..03efe93 100644 --- a/src/integrations/registry.ts +++ b/src/integrations/registry.ts @@ -15,6 +15,7 @@ export interface IntegrationConfig { export type RoutstrModel = { id: string; name?: string; + context_length?: number; }; export type IntegrationFn = (