| author | |
| committer | |
| log | 226ed997e1a6493e6b29d5264e0b0f8173e7c630 |
| tree | 13c175af0b445d9c30b82093cfc36087077a1de9 |
| parent | c6f57a106493e893233a38b3b1132978c942c88e |
| signature | Signed by PGP key B5690EEEBB952194 |
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"; |
| 27 | 27 | import { ServerSettingsService } from "../../serverSettings"; |
| 28 | 28 | import { ServerSettingsError } from "@t3tools/contracts"; |
| 29 | 29 | |
| 30 | const DEFAULT_CLAUDE_MODEL_CAPABILITIES: ModelCapabilities = { | |
| 31 | reasoningEffortLevels: [], | |
| 32 | supportsFastMode: false, | |
| 33 | supportsThinkingToggle: false, | |
| 34 | contextWindowOptions: [], | |
| 35 | promptInjectedEffortLevels: [], | |
| 36 | }; | |
| 37 | ||
| 30 | 38 | const PROVIDER = "claudeAgent" as const; |
| 31 | 39 | const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [ |
| 32 | 40 | { |
| ... | ... | @@ -87,13 +95,8 @@ const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [ |
| 87 | 95 | export function getClaudeModelCapabilities(model: string | null | undefined): ModelCapabilities { |
| 88 | 96 | const slug = model?.trim(); |
| 89 | 97 | 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 | |
| 97 | 100 | ); |
| 98 | 101 | } |
| 99 | 102 | |
| ... | ... | @@ -450,7 +453,12 @@ export const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")( |
| 450 | 453 | Effect.map((settings) => settings.providers.claudeAgent), |
| 451 | 454 | ); |
| 452 | 455 | 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 | ); | |
| 454 | 462 | |
| 455 | 463 | if (!claudeSettings.enabled) { |
| 456 | 464 | return buildServerProvider({ |
apps/server/src/provider/Layers/CodexProvider.ts+21-8| ... | ... | @@ -49,6 +49,19 @@ import { CodexProvider } from "../Services/CodexProvider"; |
| 49 | 49 | import { ServerSettingsService } from "../../serverSettings"; |
| 50 | 50 | import { ServerSettingsError } from "@t3tools/contracts"; |
| 51 | 51 | |
| 52 | const 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 | ||
| 52 | 65 | const PROVIDER = "codex" as const; |
| 53 | 66 | const OPENAI_AUTH_PROVIDERS = new Set(["openai"]); |
| 54 | 67 | const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [ |
| ... | ... | @@ -159,13 +172,8 @@ const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [ |
| 159 | 172 | export function getCodexModelCapabilities(model: string | null | undefined): ModelCapabilities { |
| 160 | 173 | const slug = model?.trim(); |
| 161 | 174 | 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 | |
| 169 | 177 | ); |
| 170 | 178 | } |
| 171 | 179 | |
| ... | ... | @@ -339,7 +347,12 @@ export const checkCodexProviderStatus = Effect.fn("checkCodexProviderStatus")(fu |
| 339 | 347 | Effect.map((settings) => settings.providers.codex), |
| 340 | 348 | ); |
| 341 | 349 | 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 | ); | |
| 343 | 356 | |
| 344 | 357 | if (!codexSettings.enabled) { |
| 345 | 358 | return buildServerProvider({ |
apps/server/src/provider/providerSnapshot.ts+3-1| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | import type { |
| 2 | ModelCapabilities, | |
| 2 | 3 | ServerProvider, |
| 3 | 4 | ServerProviderAuth, |
| 4 | 5 | ServerProviderModel, |
| ... | ... | @@ -102,6 +103,7 @@ export function providerModelsFromSettings( |
| 102 | 103 | builtInModels: ReadonlyArray<ServerProviderModel>, |
| 103 | 104 | provider: ServerProvider["provider"], |
| 104 | 105 | customModels: ReadonlyArray<string>, |
| 106 | customModelCapabilities: ModelCapabilities, | |
| 105 | 107 | ): ReadonlyArray<ServerProviderModel> { |
| 106 | 108 | const resolvedBuiltInModels = [...builtInModels]; |
| 107 | 109 | const seen = new Set(resolvedBuiltInModels.map((model) => model.slug)); |
| ... | ... | @@ -117,7 +119,7 @@ export function providerModelsFromSettings( |
| 117 | 119 | slug: normalized, |
| 118 | 120 | name: normalized, |
| 119 | 121 | isCustom: true, |
| 120 | capabilities: null, | |
| 122 | capabilities: customModelCapabilities, | |
| 121 | 123 | }); |
| 122 | 124 | } |
| 123 | 125 |