π OpenHands: AI-Driven Development
fix(frontend): image attachments not working in v1 conversations (#11864)
Hiep Le1a3460ba0650
diff --git a/frontend/src/api/conversation-service/v1-conversation-service.types.ts b/frontend/src/api/conversation-service/v1-conversation-service.types.tsindex 789925047d..621283c274 100644--- a/frontend/src/api/conversation-service/v1-conversation-service.types.ts+++ b/frontend/src/api/conversation-service/v1-conversation-service.types.ts@@ -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 {diff --git a/frontend/src/hooks/use-send-message.ts b/frontend/src/hooks/use-send-message.tsindex 1e1d627181..c6655b8230 100644--- a/frontend/src/hooks/use-send-message.ts+++ b/frontend/src/hooks/use-send-message.ts@@ -41,13 +41,11 @@ export function useSendMessage() {},];- // Add images if present+ // Add images if present - using SDK's ImageContent formatif (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,});}