| 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,6 +27,14 @@ import { ClaudeProvider } from "../Services/ClaudeProvider"; |
| 27 | import { ServerSettingsService } from "../../serverSettings"; | 27 | import { ServerSettingsService } from "../../serverSettings"; |
| 28 | import { ServerSettingsError } from "@t3tools/contracts"; | 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 | const PROVIDER = "claudeAgent" as const; | 38 | const PROVIDER = "claudeAgent" as const; |
| 31 | const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [ | 39 | const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [ |
| 32 | { | 40 | { |
| ... | @@ -87,13 +95,8 @@ const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [ | ... | @@ -87,13 +95,8 @@ const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [ |
| 87 | export function getClaudeModelCapabilities(model: string | null | undefined): ModelCapabilities { | 95 | export function getClaudeModelCapabilities(model: string | null | undefined): ModelCapabilities { |
| 88 | const slug = model?.trim(); | 96 | const slug = model?.trim(); |
| 89 | return ( | 97 | return ( |
| 90 | BUILT_IN_MODELS.find((candidate) => candidate.slug === slug)?.capabilities ?? { | 98 | BUILT_IN_MODELS.find((candidate) => candidate.slug === slug)?.capabilities ?? |
| 91 | reasoningEffortLevels: [], | 99 | DEFAULT_CLAUDE_MODEL_CAPABILITIES |
| 92 | supportsFastMode: false, | ||
| 93 | supportsThinkingToggle: false, | ||
| 94 | contextWindowOptions: [], | ||
| 95 | promptInjectedEffortLevels: [], | ||
| 96 | } | ||
| 97 | ); | 100 | ); |
| 98 | } | 101 | } |
| 99 | 102 | ||
| ... | @@ -450,7 +453,12 @@ export const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")( | ... | @@ -450,7 +453,12 @@ export const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")( |
| 450 | Effect.map((settings) => settings.providers.claudeAgent), | 453 | Effect.map((settings) => settings.providers.claudeAgent), |
| 451 | ); | 454 | ); |
| 452 | const checkedAt = new Date().toISOString(); | 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 | if (!claudeSettings.enabled) { | 463 | if (!claudeSettings.enabled) { |
| 456 | return buildServerProvider({ | 464 | return buildServerProvider({ |
apps/server/src/provider/Layers/CodexProvider.ts+21-8| ... | @@ -49,6 +49,19 @@ import { CodexProvider } from "../Services/CodexProvider"; | ... | @@ -49,6 +49,19 @@ import { CodexProvider } from "../Services/CodexProvider"; |
| 49 | import { ServerSettingsService } from "../../serverSettings"; | 49 | import { ServerSettingsService } from "../../serverSettings"; |
| 50 | import { ServerSettingsError } from "@t3tools/contracts"; | 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 | const PROVIDER = "codex" as const; | 65 | const PROVIDER = "codex" as const; |
| 53 | const OPENAI_AUTH_PROVIDERS = new Set(["openai"]); | 66 | const OPENAI_AUTH_PROVIDERS = new Set(["openai"]); |
| 54 | const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [ | 67 | const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [ |
| ... | @@ -159,13 +172,8 @@ const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [ | ... | @@ -159,13 +172,8 @@ const BUILT_IN_MODELS: ReadonlyArray<ServerProviderModel> = [ |
| 159 | export function getCodexModelCapabilities(model: string | null | undefined): ModelCapabilities { | 172 | export function getCodexModelCapabilities(model: string | null | undefined): ModelCapabilities { |
| 160 | const slug = model?.trim(); | 173 | const slug = model?.trim(); |
| 161 | return ( | 174 | return ( |
| 162 | BUILT_IN_MODELS.find((candidate) => candidate.slug === slug)?.capabilities ?? { | 175 | BUILT_IN_MODELS.find((candidate) => candidate.slug === slug)?.capabilities ?? |
| 163 | reasoningEffortLevels: [], | 176 | DEFAULT_CODEX_MODEL_CAPABILITIES |
| 164 | supportsFastMode: false, | ||
| 165 | supportsThinkingToggle: false, | ||
| 166 | contextWindowOptions: [], | ||
| 167 | promptInjectedEffortLevels: [], | ||
| 168 | } | ||
| 169 | ); | 177 | ); |
| 170 | } | 178 | } |
| 171 | 179 | ||
| ... | @@ -339,7 +347,12 @@ export const checkCodexProviderStatus = Effect.fn("checkCodexProviderStatus")(fu | ... | @@ -339,7 +347,12 @@ export const checkCodexProviderStatus = Effect.fn("checkCodexProviderStatus")(fu |
| 339 | Effect.map((settings) => settings.providers.codex), | 347 | Effect.map((settings) => settings.providers.codex), |
| 340 | ); | 348 | ); |
| 341 | const checkedAt = new Date().toISOString(); | 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 | if (!codexSettings.enabled) { | 357 | if (!codexSettings.enabled) { |
| 345 | return buildServerProvider({ | 358 | return buildServerProvider({ |
apps/server/src/provider/providerSnapshot.ts+3-1| ... | @@ -1,4 +1,5 @@ | ... | @@ -1,4 +1,5 @@ |
| 1 | import type { | 1 | import type { |
| 2 | ModelCapabilities, | ||
| 2 | ServerProvider, | 3 | ServerProvider, |
| 3 | ServerProviderAuth, | 4 | ServerProviderAuth, |
| 4 | ServerProviderModel, | 5 | ServerProviderModel, |
| ... | @@ -102,6 +103,7 @@ export function providerModelsFromSettings( | ... | @@ -102,6 +103,7 @@ export function providerModelsFromSettings( |
| 102 | builtInModels: ReadonlyArray<ServerProviderModel>, | 103 | builtInModels: ReadonlyArray<ServerProviderModel>, |
| 103 | provider: ServerProvider["provider"], | 104 | provider: ServerProvider["provider"], |
| 104 | customModels: ReadonlyArray<string>, | 105 | customModels: ReadonlyArray<string>, |
| 106 | customModelCapabilities: ModelCapabilities, | ||
| 105 | ): ReadonlyArray<ServerProviderModel> { | 107 | ): ReadonlyArray<ServerProviderModel> { |
| 106 | const resolvedBuiltInModels = [...builtInModels]; | 108 | const resolvedBuiltInModels = [...builtInModels]; |
| 107 | const seen = new Set(resolvedBuiltInModels.map((model) => model.slug)); | 109 | const seen = new Set(resolvedBuiltInModels.map((model) => model.slug)); |
| ... | @@ -117,7 +119,7 @@ export function providerModelsFromSettings( | ... | @@ -117,7 +119,7 @@ export function providerModelsFromSettings( |
| 117 | slug: normalized, | 119 | slug: normalized, |
| 118 | name: normalized, | 120 | name: normalized, |
| 119 | isCustom: true, | 121 | isCustom: true, |
| 120 | capabilities: null, | 122 | capabilities: customModelCapabilities, |
| 121 | }); | 123 | }); |
| 122 | } | 124 | } |
| 123 | 125 |