generated from nhcarrigan/template
feat: add temp file management system for file uploads (#62)
Implements the foundation for file upload support by adding a temp file management system that tracks files per conversation. - Add temp_manager.rs module with TempFileManager struct - Add Tauri commands: save_temp_file, register_temp_file, get_temp_files, cleanup_temp_files, cleanup_all_temp_files, cleanup_orphaned_temp_files - Clean up orphaned files from previous sessions on app startup - Clean up temp files when conversation is deleted - Store temp files in /tmp/hikari-uploads/ with unique UUIDs
This commit is contained in:
@@ -272,7 +272,7 @@ function createConversationsStore() {
|
||||
return newConv.id;
|
||||
},
|
||||
|
||||
deleteConversation: (id: string) => {
|
||||
deleteConversation: async (id: string) => {
|
||||
ensureInitialized();
|
||||
const convs = get(conversations);
|
||||
const activeId = get(activeConversationId);
|
||||
@@ -282,8 +282,8 @@ function createConversationsStore() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clean up tracking for this conversation
|
||||
cleanupConversationTracking(id);
|
||||
// Clean up tracking for this conversation (including temp files)
|
||||
await cleanupConversationTracking(id);
|
||||
|
||||
conversations.update((c) => {
|
||||
c.delete(id);
|
||||
|
||||
+8
-1
@@ -107,8 +107,15 @@ interface WorkingDirectoryPayload {
|
||||
conversation_id?: string;
|
||||
}
|
||||
|
||||
export function cleanupConversationTracking(conversationId: string) {
|
||||
export async function cleanupConversationTracking(conversationId: string) {
|
||||
connectedConversations.delete(conversationId);
|
||||
|
||||
// Clean up any temp files associated with this conversation
|
||||
try {
|
||||
await invoke("cleanup_temp_files", { conversationId });
|
||||
} catch (error) {
|
||||
console.error("Failed to cleanup temp files for conversation:", error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function initializeTauriListeners() {
|
||||
|
||||
Reference in New Issue
Block a user