@@ -29,6 +29,7 @@ import {
|
29 | 29 | normalizeAgentId, |
30 | 30 | parseAgentSessionKey, |
31 | 31 | } from "../session-key.ts"; |
| 32 | +import { sessionModelMatchesDefaults } from "../session-model-defaults.ts"; |
32 | 33 | import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "../string-coerce.ts"; |
33 | 34 | import { |
34 | 35 | formatInheritedThinkingLabel, |
@@ -958,16 +959,6 @@ function resolveChatFastModeSelectState(
|
958 | 959 | }; |
959 | 960 | } |
960 | 961 | |
961 | | -function sessionModelMatchesDefaults( |
962 | | -row: SessionsListResult["sessions"][number] | undefined, |
963 | | -defaults: SessionsListResult["defaults"] | undefined, |
964 | | -): boolean { |
965 | | -return ( |
966 | | -(!row?.modelProvider || row.modelProvider === defaults?.modelProvider) && |
967 | | -(!row?.model || row.model === defaults?.model) |
968 | | -); |
969 | | -} |
970 | | - |
971 | 962 | function buildThinkingOptions( |
972 | 963 | levels: readonly GatewayThinkingLevelOption[], |
973 | 964 | currentOverride: string, |
@@ -1006,18 +997,14 @@ function resolveThinkingLevelOptions(
|
1006 | 997 | model: string | null, |
1007 | 998 | catalog: readonly ThinkingCatalogEntry[], |
1008 | 999 | ): GatewayThinkingLevelOption[] { |
1009 | | -const sessionModelMatchesDefaultsLocal = |
1010 | | -(!activeRow?.modelProvider || activeRow.modelProvider === defaults?.modelProvider) && |
1011 | | -(!activeRow?.model || activeRow.model === defaults?.model); |
| 1000 | +const modelMatchesDefaults = sessionModelMatchesDefaults(activeRow, defaults); |
1012 | 1001 | const catalogEntry = |
1013 | 1002 | provider && model |
1014 | 1003 | ? catalog.find((entry) => entry.provider === provider && entry.id === model) |
1015 | 1004 | : undefined; |
1016 | 1005 | const explicitLevels = |
1017 | 1006 | (activeRow?.thinkingLevels?.length ? activeRow.thinkingLevels : null) ?? |
1018 | | -(sessionModelMatchesDefaultsLocal && defaults?.thinkingLevels?.length |
1019 | | - ? defaults.thinkingLevels |
1020 | | - : null); |
| 1007 | +(modelMatchesDefaults && defaults?.thinkingLevels?.length ? defaults.thinkingLevels : null); |
1021 | 1008 | if (explicitLevels) { |
1022 | 1009 | if (catalogEntry?.reasoning === false && isOffOnlyThinkingLevels(explicitLevels)) { |
1023 | 1010 | return []; |
@@ -1026,9 +1013,7 @@ function resolveThinkingLevelOptions(
|
1026 | 1013 | } |
1027 | 1014 | const explicitLabels = |
1028 | 1015 | (activeRow?.thinkingOptions?.length ? activeRow.thinkingOptions : null) ?? |
1029 | | -(sessionModelMatchesDefaultsLocal && defaults?.thinkingOptions?.length |
1030 | | - ? defaults.thinkingOptions |
1031 | | - : null); |
| 1016 | +(modelMatchesDefaults && defaults?.thinkingOptions?.length ? defaults.thinkingOptions : null); |
1032 | 1017 | if (catalogEntry?.reasoning === false) { |
1033 | 1018 | if (!explicitLabels || explicitLabels.every(isOffThinkingOption)) { |
1034 | 1019 | return []; |
|