fix(ultrawork-model-override): set thinking config object instead of variant string
Fixes #2049
This commit is contained in:
parent
15519b9580
commit
565ab8c13a
@ -308,7 +308,10 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
|||||||
//#then
|
//#then
|
||||||
expect(output.message.model).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-6" })
|
expect(output.message.model).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-6" })
|
||||||
expect(output.message["variant"]).toBe("max")
|
expect(output.message["variant"]).toBe("max")
|
||||||
expect(output.message["thinking"]).toBe("max")
|
expect(output.message["thinking"]).toEqual({
|
||||||
|
type: "enabled",
|
||||||
|
budgetTokens: 16000,
|
||||||
|
})
|
||||||
expect(dbOverrideSpy).not.toHaveBeenCalled()
|
expect(dbOverrideSpy).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -324,7 +327,10 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
|||||||
//#then
|
//#then
|
||||||
expect(output.message.model).toBeUndefined()
|
expect(output.message.model).toBeUndefined()
|
||||||
expect(output.message["variant"]).toBe("high")
|
expect(output.message["variant"]).toBe("high")
|
||||||
expect(output.message["thinking"]).toBe("high")
|
expect(output.message["thinking"]).toEqual({
|
||||||
|
type: "enabled",
|
||||||
|
budgetTokens: 16000,
|
||||||
|
})
|
||||||
expect(dbOverrideSpy).not.toHaveBeenCalled()
|
expect(dbOverrideSpy).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import { scheduleDeferredModelOverride } from "./ultrawork-db-model-override"
|
|||||||
const CODE_BLOCK = /```[\s\S]*?```/g
|
const CODE_BLOCK = /```[\s\S]*?```/g
|
||||||
const INLINE_CODE = /`[^`]+`/g
|
const INLINE_CODE = /`[^`]+`/g
|
||||||
const ULTRAWORK_PATTERN = /\b(ultrawork|ulw)\b/i
|
const ULTRAWORK_PATTERN = /\b(ultrawork|ulw)\b/i
|
||||||
|
const ULTRAWORK_THINKING_CONFIG = { type: "enabled", budgetTokens: 16000 } as const
|
||||||
|
|
||||||
export function detectUltrawork(text: string): boolean {
|
export function detectUltrawork(text: string): boolean {
|
||||||
const clean = text.replace(CODE_BLOCK, "").replace(INLINE_CODE, "")
|
const clean = text.replace(CODE_BLOCK, "").replace(INLINE_CODE, "")
|
||||||
@ -117,7 +118,7 @@ export function applyUltraworkModelOverrideOnMessage(
|
|||||||
if (!override.providerID || !override.modelID) {
|
if (!override.providerID || !override.modelID) {
|
||||||
if (override.variant) {
|
if (override.variant) {
|
||||||
output.message["variant"] = override.variant
|
output.message["variant"] = override.variant
|
||||||
output.message["thinking"] = override.variant
|
output.message["thinking"] = { ...ULTRAWORK_THINKING_CONFIG }
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -134,7 +135,7 @@ export function applyUltraworkModelOverrideOnMessage(
|
|||||||
output.message.model = targetModel
|
output.message.model = targetModel
|
||||||
if (override.variant) {
|
if (override.variant) {
|
||||||
output.message["variant"] = override.variant
|
output.message["variant"] = override.variant
|
||||||
output.message["thinking"] = override.variant
|
output.message["thinking"] = { ...ULTRAWORK_THINKING_CONFIG }
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user