fix(frontend): image attachments not working in v1 conversations (#11864)

This commit is contained in:
Hiep Le 2025-12-02 20:22:14 +07:00 committed by GitHub
parent 8f361b3698
commit 1a3460ba06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 13 deletions

View File

@ -3,15 +3,19 @@ import { Provider } from "#/types/settings";
import { V1SandboxStatus } from "../sandbox-service/sandbox-service.types";
// V1 API Types for requests
// Note: This represents the serialized API format, not the internal TextContent/ImageContent types
export interface V1MessageContent {
type: "text" | "image_url";
text?: string;
image_url?: {
url: string;
};
// These types match the SDK's TextContent and ImageContent formats
export interface V1TextContent {
type: "text";
text: string;
}
export interface V1ImageContent {
type: "image";
image_urls: string[];
}
export type V1MessageContent = V1TextContent | V1ImageContent;
type V1Role = "user" | "system" | "assistant" | "tool";
export interface V1SendMessageRequest {

View File

@ -41,13 +41,11 @@ export function useSendMessage() {
},
];
// Add images if present
// Add images if present - using SDK's ImageContent format
if (args.image_urls && args.image_urls.length > 0) {
args.image_urls.forEach((url) => {
content.push({
type: "image_url",
image_url: { url },
});
content.push({
type: "image",
image_urls: args.image_urls,
});
}