fix: align sessions.patch and tui typing

This commit is contained in:
Peter Steinberger
2026-01-03 06:37:40 +01:00
parent e41821342b
commit 662208949f
7 changed files with 109 additions and 26 deletions

View File

@@ -42,10 +42,18 @@ export type GatewaySessionList = {
verboseLevel?: string;
model?: string;
contextTokens?: number | null;
totalTokens?: number | null;
displayName?: string;
}>;
};
export type GatewayModelChoice = {
id: string;
name: string;
provider: string;
contextWindow?: number;
};
export class GatewayChatClient {
private client: GatewayClient;
private readyPromise: Promise<void>;
@@ -161,16 +169,11 @@ export class GatewayChatClient {
return await this.client.request("status");
}
async listModels(): Promise<
Array<{
id: string;
name: string;
provider: string;
contextWindow?: number;
}>
> {
const res = await this.client.request<{ models?: unknown }>("models.list");
return Array.isArray(res?.models) ? (res.models as Array<any>) : [];
async listModels(): Promise<GatewayModelChoice[]> {
const res = await this.client.request<{ models?: GatewayModelChoice[] }>(
"models.list",
);
return Array.isArray(res?.models) ? res.models : [];
}
}