Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: Preserve chat history during autosave (#5278)
Lee Jackson19f305238e61
diff --git a/studio/frontend/src/features/chat/utils/delete-thread-message.ts b/studio/frontend/src/features/chat/utils/delete-thread-message.tsindex e13da606307..d410c37a34a 100644--- a/studio/frontend/src/features/chat/utils/delete-thread-message.ts+++ b/studio/frontend/src/features/chat/utils/delete-thread-message.ts@@ -71,21 +71,24 @@ function exportedItemToRecord(}/**- * Persist the exact message list represented by `exp` for this thread, removing- * Dexie rows that are no longer present (e.g. after a delete).+ * Persist exported messages, pruning only for explicit delete flows.*/export async function syncExportedRepositoryToDexie(remoteId: string,exp: ExportedMessageRepository,+ options: { pruneMissing?: boolean } = {},): Promise<void> {await db.transaction("rw", db.messages, async () => {- const keepIds = new Set(exp.messages.map((x) => x.message.id));- const existing = await db.messages.where("threadId").equals(remoteId).toArray();- const idsToDelete = existing- .filter((m) => !keepIds.has(m.id))- .map((m) => m.id);- if (idsToDelete.length > 0) {- await db.messages.bulkDelete(idsToDelete);+ if (options.pruneMissing) {+ const keepIds = new Set(exp.messages.map((x) => x.message.id));+ const existingIds = await db.messages+ .where("threadId")+ .equals(remoteId)+ .primaryKeys();+ const idsToDelete = existingIds.filter((id) => !keepIds.has(String(id)));+ if (idsToDelete.length > 0) {+ await db.messages.bulkDelete(idsToDelete);+ }}await db.messages.bulkPut(exp.messages.map(({ message, parentId }) =>@@ -115,7 +118,7 @@ export async function deleteThreadMessage(args: {repo.deleteMessage(messageId);const next = repo.export();if (remoteId) {- await syncExportedRepositoryToDexie(remoteId, next);+ await syncExportedRepositoryToDexie(remoteId, next, { pruneMissing: true });}thread.import(next);}