fix(ai): type empty OpenAI classifier catalogs

This commit is contained in:
Armin Ronacher 2026-10-07 08:35:06 +02:00
parent ce8972a0e9
commit 6b58544540
2 changed files with 6 additions and 1 deletions

View file

@ -23,6 +23,7 @@
- Fixed the error message of a failed lazy API setup, such as a module load or auth failure, using its failure time as `timestamp` instead of the request start
- Reduced context-limit request failures by estimating input at 3.5 characters per token instead of 4 when calculating output limits ([#10497](https://github.com/earendil-works/pi/issues/10497))
- Fixed Radius models disabled by an organization owner still being listed: a fetched or cached Radius catalog now replaces the shipped default catalog instead of being merged into it
- Fixed OpenAI provider type-checking with cached catalogs that contain no classifier models
## [1.0.4] - 2026-10-05

View file

@ -3,6 +3,7 @@ import { openAIResponsesApi } from "../api/openai-responses.lazy.ts";
import { envApiKeyAuth, lazyOAuth } from "../auth/helpers.ts";
import { loadOpenAIChatGPTOAuth } from "../auth/oauth/load.ts";
import { createProvider, isModelType, type Provider } from "../models.ts";
import type { ClassifierModel } from "../types.ts";
import { OPENAI_CLASSIFIER_MODELS, OPENAI_MODELS } from "./openai.models.ts";
export function openaiProvider(): Provider<"openai-responses"> {
@ -19,7 +20,10 @@ export function openaiProvider(): Provider<"openai-responses"> {
load: loadOpenAIChatGPTOAuth,
}),
},
models: [...Object.values(OPENAI_MODELS), ...Object.values(OPENAI_CLASSIFIER_MODELS)],
models: [
...Object.values(OPENAI_MODELS),
...Object.values<ClassifierModel<"openai-decisions">>(OPENAI_CLASSIFIER_MODELS),
],
// Sign in with ChatGPT tokens only reach the Responses API; the Decisions API rejects them.
filterAllModels: (models, credential) =>
credential?.type === "oauth" ? models.filter((model) => !isModelType(model, "classifier")) : models,