mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-19 00:01:19 +00:00
Revert to pre-AI-SDK state (commit67e568f6b) This commit reverts the codebase to the state before AI SDK migration work began. Target commit:67e568f6b- refactor: replace fetch_instructions with skill tool and built-in skills (#10913) Date: January 29, 2026 This removes approximately 152 commits of AI SDK migration work. A follow-up PR will add back bug fixes and features that are unrelated to AI SDK. Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { ApiMessage } from "../../core/task-persistence/apiMessages"
|
|
|
|
import { ApiHandler } from "../index"
|
|
|
|
/* Removes image blocks from messages if they are not supported by the Api Handler */
|
|
export function maybeRemoveImageBlocks(messages: ApiMessage[], apiHandler: ApiHandler): ApiMessage[] {
|
|
// Check model capability ONCE instead of for every message
|
|
const supportsImages = apiHandler.getModel().info.supportsImages
|
|
|
|
return messages.map((message) => {
|
|
// Handle array content (could contain image blocks).
|
|
let { content } = message
|
|
if (Array.isArray(content)) {
|
|
if (!supportsImages) {
|
|
// Convert image blocks to text descriptions.
|
|
content = content.map((block) => {
|
|
if (block.type === "image") {
|
|
// Convert image blocks to text descriptions.
|
|
// Note: We can't access the actual image content/url due to API limitations,
|
|
// but we can indicate that an image was present in the conversation.
|
|
return {
|
|
type: "text",
|
|
text: "[Referenced image in conversation]",
|
|
}
|
|
}
|
|
return block
|
|
})
|
|
}
|
|
}
|
|
return { ...message, content }
|
|
})
|
|
}
|