Skip to content

Commit 79d378e

Browse files
Implement smarter reasoning model detection using regex patterns
Co-authored-by: PeterDaveHello <[email protected]>
1 parent f4b3fd9 commit 79d378e

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/utils/model-name-convert.mjs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,17 @@ export function isInApiModeGroup(apiModeGroup, configOrSession) {
167167

168168
export function isUsingReasoningModel(configOrSession) {
169169
const modelValue = getModelValue(configOrSession)
170-
return (
171-
modelValue &&
172-
(modelValue === 'o4-mini' ||
173-
modelValue === 'gpt-5' ||
174-
modelValue === 'gpt-5-mini' ||
175-
modelValue === 'gpt-5-nano')
176-
)
170+
if (!modelValue) return false
171+
172+
// Match o[134] pattern with optional dash and suffix (e.g., o1, o1-preview, o3-mini, o4-mini)
173+
if (/^o[134](-|$)/.test(modelValue)) {
174+
return true
175+
}
176+
177+
// Match gpt-5* pattern but exclude gpt-5-chat-* variants
178+
if (modelValue.startsWith('gpt-5') && !modelValue.startsWith('gpt-5-chat')) {
179+
return true
180+
}
181+
182+
return false
177183
}

0 commit comments

Comments
 (0)