Просмотр исходного кода

chore: handle fields other than reasoning_content in interleaved block

Aiden Cline 1 месяц назад
Родитель
Сommit
3fd0043d19
1 измененных файлов с 4 добавлено и 7 удалено
  1. 4 7
      packages/opencode/src/provider/transform.ts

+ 4 - 7
packages/opencode/src/provider/transform.ts

@@ -123,11 +123,8 @@ export namespace ProviderTransform {
       return result
     }
 
-    if (
-      model.capabilities.interleaved &&
-      typeof model.capabilities.interleaved === "object" &&
-      model.capabilities.interleaved.field === "reasoning_content"
-    ) {
+    if (typeof model.capabilities.interleaved === "object" && model.capabilities.interleaved.field) {
+      const field = model.capabilities.interleaved.field
       return msgs.map((msg) => {
         if (msg.role === "assistant" && Array.isArray(msg.content)) {
           const reasoningParts = msg.content.filter((part: any) => part.type === "reasoning")
@@ -136,7 +133,7 @@ export namespace ProviderTransform {
           // Filter out reasoning parts from content
           const filteredContent = msg.content.filter((part: any) => part.type !== "reasoning")
 
-          // Include reasoning_content directly on the message for all assistant messages
+          // Include reasoning_content | reasoning_details directly on the message for all assistant messages
           if (reasoningText) {
             return {
               ...msg,
@@ -145,7 +142,7 @@ export namespace ProviderTransform {
                 ...msg.providerOptions,
                 openaiCompatible: {
                   ...(msg.providerOptions as any)?.openaiCompatible,
-                  reasoning_content: reasoningText,
+                  [field]: reasoningText,
                 },
               },
             }