feat: support uploaded images in debug voice preview
Allow paste/drag temporary image assets so vision turns work without a live camera frame. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -61,7 +61,9 @@ export type UserInputPart =
|
||||
| { type: "input_text"; text: string }
|
||||
| {
|
||||
type: "input_image";
|
||||
source: { type: "camera_frame"; frame: "current" };
|
||||
source:
|
||||
| { type: "camera_frame"; frame: "current" }
|
||||
| { type: "uploaded_asset"; asset_token: string };
|
||||
};
|
||||
export type UserInputResult = {
|
||||
inputId: string;
|
||||
@@ -880,7 +882,12 @@ export function useVoicePreview(
|
||||
);
|
||||
|
||||
const appendUserImage = useCallback(
|
||||
(inputId: string, imageUrl: string, timestamp: string) => {
|
||||
(
|
||||
inputId: string,
|
||||
imageUrl: string,
|
||||
timestamp: string,
|
||||
content = "",
|
||||
) => {
|
||||
messageSeqRef.current += 1;
|
||||
const sequence = messageSeqRef.current;
|
||||
setMessages((previous) =>
|
||||
@@ -889,7 +896,7 @@ export function useVoicePreview(
|
||||
{
|
||||
id: `user-image-${inputId}`,
|
||||
role: "user",
|
||||
content: "",
|
||||
content: content.trim(),
|
||||
timestamp,
|
||||
sequence,
|
||||
attachments: [
|
||||
@@ -897,7 +904,7 @@ export function useVoicePreview(
|
||||
id: `image-${inputId}`,
|
||||
type: "image",
|
||||
url: imageUrl,
|
||||
alt: "用户拍摄的照片",
|
||||
alt: "用户提交的图片",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user