refactor(ultrawork): remove thinking config injection from model override
Delegate thinking config control to the provider layer rather than injecting it manually in ultrawork model override. 🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -960,6 +960,9 @@
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"allow_non_gpt_model": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
@@ -3248,6 +3251,11 @@
|
||||
"prompt_append": {
|
||||
"type": "string"
|
||||
},
|
||||
"max_prompt_tokens": {
|
||||
"type": "integer",
|
||||
"exclusiveMinimum": 0,
|
||||
"maximum": 9007199254740991
|
||||
},
|
||||
"is_unstable_agent": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
||||
@@ -21,11 +21,10 @@ function tryUpdateMessageModel(
|
||||
)
|
||||
const result = stmt.run(targetModel.providerID, targetModel.modelID, messageId)
|
||||
if (result.changes === 0) return false
|
||||
|
||||
if (variant) {
|
||||
db.prepare(
|
||||
`UPDATE message SET data = json_set(data, '$.variant', ?, '$.thinking', ?) WHERE id = ?`,
|
||||
).run(variant, variant, messageId)
|
||||
`UPDATE message SET data = json_set(data, '$.variant', ?) WHERE id = ?`,
|
||||
).run(variant, messageId)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -308,10 +308,6 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
||||
//#then
|
||||
expect(output.message.model).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-6" })
|
||||
expect(output.message["variant"]).toBe("max")
|
||||
expect(output.message["thinking"]).toEqual({
|
||||
type: "enabled",
|
||||
budgetTokens: 16000,
|
||||
})
|
||||
expect(dbOverrideSpy).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
@@ -327,10 +323,6 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
|
||||
//#then
|
||||
expect(output.message.model).toBeUndefined()
|
||||
expect(output.message["variant"]).toBe("high")
|
||||
expect(output.message["thinking"]).toEqual({
|
||||
type: "enabled",
|
||||
budgetTokens: 16000,
|
||||
})
|
||||
expect(dbOverrideSpy).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import { scheduleDeferredModelOverride } from "./ultrawork-db-model-override"
|
||||
const CODE_BLOCK = /```[\s\S]*?```/g
|
||||
const INLINE_CODE = /`[^`]+`/g
|
||||
const ULTRAWORK_PATTERN = /\b(ultrawork|ulw)\b/i
|
||||
const ULTRAWORK_THINKING_CONFIG = { type: "enabled", budgetTokens: 16000 } as const
|
||||
|
||||
export function detectUltrawork(text: string): boolean {
|
||||
const clean = text.replace(CODE_BLOCK, "").replace(INLINE_CODE, "")
|
||||
@@ -118,7 +117,6 @@ export function applyUltraworkModelOverrideOnMessage(
|
||||
if (!override.providerID || !override.modelID) {
|
||||
if (override.variant) {
|
||||
output.message["variant"] = override.variant
|
||||
output.message["thinking"] = { ...ULTRAWORK_THINKING_CONFIG }
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -135,7 +133,6 @@ export function applyUltraworkModelOverrideOnMessage(
|
||||
output.message.model = targetModel
|
||||
if (override.variant) {
|
||||
output.message["variant"] = override.variant
|
||||
output.message["thinking"] = { ...ULTRAWORK_THINKING_CONFIG }
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user