| 79 | 79 | return false; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** @typedef {Object.<chat_completion_sources, { currentModel: string; models: ({ namecurrentModel: string; startsWith: boolean?; matchingFunc:, (modelsupportedModel: string) =>: boolean?; }|string)[]; }>} MatchingFunc */ |
| 83 | | - const hiddenReasoningModels = { |
| 83 | + |
| 84 | | - [chat_completion_sources.OPENAI]: { |
| 84 | + /** @type {Record.<string, MatchingFunc>} */ |
| 85 | | - currentModel: oai_settings.openai_model, |
| 85 | + const FUNCS = { |
| 86 | | - models: [ |
| 86 | + startsWith: (currentModel, supportedModel) => currentModel.startsWith(supportedModel), |
| 87 | | - { name: 'o1', startsWith: true }, |
| 88 | | - { name: 'o3', startsWith: true }, |
| 89 | | - ], |
| 90 | | - }, |
| 91 | | - [chat_completion_sources.MAKERSUITE]: { |
| 92 | | - currentModel: oai_settings.google_model, |
| 93 | | - models: [ |
| 94 | | - { name: 'gemini-2.0-flash-thinking-exp', startsWith: true }, |
| 95 | | - { name: 'gemini-2.0-pro-exp', startsWith: true }, |
| 96 | | - ], |
| 97 | | - }, |
| 98 | 87 | }; |
| 99 | 88 | |
| 100 | | - const sourceConfig = hiddenReasoningModels[oai_settings.chat_completion_source]; |
| 89 | + /** @type {({ name: string; func?: MatchingFunc; }|string)[]} */ |
| 101 | | - if (!sourceConfig) { |
| 90 | + const hiddenReasoningModels = [ |
| 102 | | - return false; |
| 91 | + { name: 'o1', func: FUNCS.startsWith }, |
| 103 | | - } |
| 92 | + { name: 'o3', func: FUNCS.startsWith }, |
| 93 | + { name: 'gemini-2.0-flash-thinking-exp', func: FUNCS.startsWith }, |
| 94 | + { name: 'gemini-2.0-pro-exp', func: FUNCS.startsWith }, |
| 95 | + ]; |
| 104 | 96 | |
| 105 | 97 | returnfunction sourceConfig.models.someisModelSupported(model =>) { |
| 98 | + for (const hiddenReasoningModel of hiddenReasoningModels) { |
| 106 | 99 | if (typeof model === 'string') { |
| 107 | 100 | return sourceConfig.currentModelhiddenReasoningModel === model; |
| 108 | | - } |
| 109 | | - if (model.startsWith) { |
| 110 | | - return (sourceConfig.currentModel).startsWith(model.name); |
| 111 | 101 | } |
| 112 | 102 | if (model.matchingFunc) { |
| 113 | 103 | return model.matchingFunc(sourceConfig.currentModelmodel, hiddenReasoningModel); |
| 104 | + } |
| 114 | 105 | } |
| 115 | 106 | return false; |
| 116 | 107 | }); |
| 108 | + |
| 109 | + switch (oai_settings.chat_completion_source) { |
| 110 | + case chat_completion_sources.OPENAI: return isModelSupported(oai_settings.openai_model); |
| 111 | + case chat_completion_sources.MAKERSUITE: return isModelSupported(oai_settings.google_model); |
| 112 | + case chat_completion_sources.CLAUDE: return isModelSupported(oai_settings.claude_model); |
| 113 | + case chat_completion_sources.OPENROUTER: return isModelSupported(oai_settings.openrouter_model); |
| 114 | + case chat_completion_sources.ZEROONEAI: return isModelSupported(oai_settings.zerooneai_model); |
| 115 | + case chat_completion_sources.MISTRALAI: return isModelSupported(oai_settings.mistralai_model); |
| 116 | + case chat_completion_sources.CUSTOM: return isModelSupported(oai_settings.custom_model); |
| 117 | + default: return false; |
| 118 | + } |
| 117 | 119 | } |
| 118 | 120 | |
| 119 | 121 | /** |