authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-04-06 15:29:11-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-04-06 15:29:11-07:00
log226ed997e1a6493e6b29d5264e0b0f8173e7c630
tree13c175af0b445d9c30b82093cfc36087077a1de9
parentc6f57a106493e893233a38b3b1132978c942c88e
signature Signed by PGP key B5690EEEBB952194

Assign default capabilities to Codex custom models (#1793)


3 files changed, 40 insertions(+), 17 deletions(-)

apps/server/src/provider/Layers/ClaudeProvider.ts+16-8
......@@ -27,6 +27,14 @@ import { ClaudeProvider } from "../Services/ClaudeProvider";
2727import { ServerSettingsService } from "../../serverSettings";
2828import { ServerSettingsError } from "@t3tools/contracts";
2929
30const DEFAULT_CLAUDE_MODEL_CAPABILITIES: ModelCapabilities = {
31 reasoningEffortLevels: [],
32 supportsFastMode: false,
33 supportsThinkingToggle: false,
34 contextWindowOptions: [],
35 promptInjectedEffortLevels: [],
36};
37
3038const PROVIDER = "claudeAgent" as const;
3139const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [
3240 {
......@@ -87,13 +95,8 @@ const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [
8795export function getClaudeModelCapabilities(model: string | null | undefined): ModelCapabilities {
8896 const slug = model?.trim();
8997 return (
90 BUILT_IN_MODELS.find((candidate) => candidate.slug === slug)?.capabilities ?? {
91 reasoningEffortLevels: [],
92 supportsFastMode: false,
93 supportsThinkingToggle: false,
94 contextWindowOptions: [],
95 promptInjectedEffortLevels: [],
96 }
98 BUILT_IN_MODELS.find((candidate) => candidate.slug === slug)?.capabilities ??
99 DEFAULT_CLAUDE_MODEL_CAPABILITIES
97100 );
98101}
99102
......@@ -450,7 +453,12 @@ export const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")(
450453 Effect.map((settings) => settings.providers.claudeAgent),
451454 );
452455 const checkedAt = new Date().toISOString();
453 const models = providerModelsFromSettings(BUILT_IN_MODELS, PROVIDER, claudeSettings.customModels);
456 const models = providerModelsFromSettings(
457 BUILT_IN_MODELS,
458 PROVIDER,
459 claudeSettings.customModels,
460 DEFAULT_CLAUDE_MODEL_CAPABILITIES,
461 );
454462
455463 if (!claudeSettings.enabled) {
456464 return buildServerProvider({
apps/server/src/provider/Layers/CodexProvider.ts+21-8
......@@ -49,6 +49,19 @@ import { CodexProvider } from "../Services/CodexProvider";
4949import { ServerSettingsService } from "../../serverSettings";
5050import { ServerSettingsError } from "@t3tools/contracts";
5151
52const DEFAULT_CODEX_MODEL_CAPABILITIES: ModelCapabilities = {
53 reasoningEffortLevels: [
54 { value: "xhigh", label: "Extra High" },
55 { value: "high", label: "High", isDefault: true },
56 { value: "medium", label: "Medium" },
57 { value: "low", label: "Low" },
58 ],
59 supportsFastMode: true,
60 supportsThinkingToggle: false,
61 contextWindowOptions: [],
62 promptInjectedEffortLevels: [],
63};
64
5265const PROVIDER = "codex" as const;
5366const OPENAI_AUTH_PROVIDERS = new Set(["openai"]);
5467const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [
......@@ -159,13 +172,8 @@ const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [
159172export function getCodexModelCapabilities(model: string | null | undefined): ModelCapabilities {
160173 const slug = model?.trim();
161174 return (
162 BUILT_IN_MODELS.find((candidate) => candidate.slug === slug)?.capabilities ?? {
163 reasoningEffortLevels: [],
164 supportsFastMode: false,
165 supportsThinkingToggle: false,
166 contextWindowOptions: [],
167 promptInjectedEffortLevels: [],
168 }
175 BUILT_IN_MODELS.find((candidate) => candidate.slug === slug)?.capabilities ??
176 DEFAULT_CODEX_MODEL_CAPABILITIES
169177 );
170178}
171179
......@@ -339,7 +347,12 @@ export const checkCodexProviderStatus = Effect.fn("checkCodexProviderStatus")(fu
339347 Effect.map((settings) => settings.providers.codex),
340348 );
341349 const checkedAt = new Date().toISOString();
342 const models = providerModelsFromSettings(BUILT_IN_MODELS, PROVIDER, codexSettings.customModels);
350 const models = providerModelsFromSettings(
351 BUILT_IN_MODELS,
352 PROVIDER,
353 codexSettings.customModels,
354 DEFAULT_CODEX_MODEL_CAPABILITIES,
355 );
343356
344357 if (!codexSettings.enabled) {
345358 return buildServerProvider({
apps/server/src/provider/providerSnapshot.ts+3-1
......@@ -1,4 +1,5 @@
11import type {
2 ModelCapabilities,
23 ServerProvider,
34 ServerProviderAuth,
45 ServerProviderModel,
......@@ -102,6 +103,7 @@ export function providerModelsFromSettings(
102103 builtInModels: ReadonlyArray<ServerProviderModel>,
103104 provider: ServerProvider["provider"],
104105 customModels: ReadonlyArray<string>,
106 customModelCapabilities: ModelCapabilities,
105107): ReadonlyArray<ServerProviderModel> {
106108 const resolvedBuiltInModels = [...builtInModels];
107109 const seen = new Set(resolvedBuiltInModels.map((model) => model.slug));
......@@ -117,7 +119,7 @@ export function providerModelsFromSettings(
117119 slug: normalized,
118120 name: normalized,
119121 isCustom: true,
120 capabilities: null,
122 capabilities: customModelCapabilities,
121123 });
122124 }
123125