refactor: Store pasted images in memory as base64 data URLs
- Remove save_clipboard_image and cleanup_temp_images backend commands - Update FloatingPromptInput to store pasted images as data URLs in the prompt - Update ImagePreview component to handle both file paths and data URLs - Update extractImagePaths to properly handle quoted data URLs - Update handleRemoveImage to handle data URL removal This eliminates file system operations for pasted images and stores them directly in the prompt as base64 data URLs (e.g., @"data:image/png;base64,..."). Images are now fully self-contained within the session without creating temp files.
This commit is contained in:
@@ -20,7 +20,6 @@ import { api, type Session } from "@/lib/api";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { open } from "@tauri-apps/plugin-dialog";
|
||||
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { StreamMessage } from "./StreamMessage";
|
||||
import { FloatingPromptInput, type FloatingPromptInputRef } from "./FloatingPromptInput";
|
||||
import { ErrorBoundary } from "./ErrorBoundary";
|
||||
@@ -828,16 +827,6 @@ export const ClaudeCodeSession: React.FC<ClaudeCodeSessionProps> = ({
|
||||
api.clearCheckpointManager(effectiveSession.id).catch(err => {
|
||||
console.error("Failed to clear checkpoint manager:", err);
|
||||
});
|
||||
|
||||
// Clean up temporary images
|
||||
if (projectPath) {
|
||||
invoke('cleanup_temp_images', {
|
||||
projectPath,
|
||||
sessionId: effectiveSession.id
|
||||
}).catch((err: any) => {
|
||||
console.error("Failed to cleanup temp images:", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}, [effectiveSession, projectPath]);
|
||||
|
Reference in New Issue
Block a user