Skip to content

Commit aabf752

Browse files
committed
feat(provider): add preserveReasoningInContent config option and remove isQwen auto-detection
1 parent 677a55a commit aabf752

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

packages/opencode/src/config/provider.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,16 @@ export const Model = Schema.Struct({
5353
provider: Schema.optional(
5454
Schema.Struct({ npm: Schema.optional(Schema.String), api: Schema.optional(Schema.String) }),
5555
),
56-
options: Schema.optional(Schema.Record(Schema.String, Schema.Any)),
56+
options: Schema.optional(
57+
Schema.StructWithRest(
58+
Schema.Struct({
59+
preserveReasoningInContent: Schema.optional(Schema.Boolean).annotate({
60+
description: "When true, formats reasoning history as <thinking> tags within the content instead of using reasoning_content (required for Qwen3.6 preserve_thinking)."
61+
})
62+
}),
63+
[Schema.Record(Schema.String, Schema.Any)]
64+
)
65+
),
5766
headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),
5867
variants: Schema.optional(
5968
Schema.Record(

packages/opencode/src/provider/transform.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,11 @@ function normalizeMessages(
214214
})
215215
}
216216

217-
const isQwen = model.id.toLowerCase().includes("qwen") || model.api.id.toLowerCase().includes("qwen")
218217
const preserveReasoningInContent =
219218
_options?.preserveReasoningInContent === true ||
220219
(model.options as any)?.preserveReasoningInContent === true
221220

222-
if (isQwen || preserveReasoningInContent) {
221+
if (preserveReasoningInContent) {
223222
msgs = msgs.map((msg) => {
224223
if (msg.role === "assistant" && Array.isArray(msg.content)) {
225224
const reasoningParts = msg.content.filter((part: any) => part.type === "reasoning")

0 commit comments

Comments
 (0)