Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/transform/openai-format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function convertToOpenAiMessages(
}
}
return { type: "text", text: part.text }
}),
}).join("\n") ?? "",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: The mapping of non-tool messages returns objects (e.g. { type: 'image_url', image_url: { url: '...' } } or { type: 'text', text: ... }), but the join function expects an array of strings. Joining these objects will result in undesired '[object Object]' strings. Consider transforming each block to an appropriate string format before joining.

Suggested change
}).join("\n") ?? "",
content: nonToolMessages.map((part) => part.type === "image" ? `data:${part.source.media_type};base64,${part.source.data}` : part.text).join("\n") ?? "",

})
}
} else if (anthropicMessage.role === "assistant") {
Expand Down
Loading