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
This commit is contained in:
redshift
2026-05-30 14:04:24 +08:00
parent 8db3b3cf8b
commit 17529e762e
2 changed files with 9 additions and 3 deletions
+8 -3
View File
@@ -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,
+1
View File
@@ -15,6 +15,7 @@ export interface IntegrationConfig {
export type RoutstrModel = {
id: string;
name?: string;
context_length?: number;
};
export type IntegrationFn = (