Timothy Jaeryang Baek 1 month ago
parent
commit
d7e9b0828b
2 changed files with 10 additions and 0 deletions
  1. 10 0
      src/lib/components/chat/Chat.svelte
  2. 0 0
      static/pyodide/pyodide-lock.json

+ 10 - 0
src/lib/components/chat/Chat.svelte

@@ -2085,6 +2085,7 @@
 
 	const MAX_DRAFT_LENGTH = 5000;
 	let saveDraftTimeout = null;
+
 	const saveDraft = async (draft, chatId = null) => {
 		if (saveDraftTimeout) {
 			clearTimeout(saveDraftTimeout);
@@ -2101,6 +2102,13 @@
 			sessionStorage.removeItem(`chat-input${chatId ? `-${chatId}` : ''}`);
 		}
 	};
+
+	const clearDraft = async (chatId = null) => {
+		if (saveDraftTimeout) {
+			clearTimeout(saveDraftTimeout);
+		}
+		await sessionStorage.removeItem(`chat-input${chatId ? `-${chatId}` : ''}`);
+	};
 </script>
 
 <svelte:head>
@@ -2252,6 +2260,7 @@
 										}
 									}}
 									on:submit={async (e) => {
+										clearDraft();
 										if (e.detail || files.length > 0) {
 											await tick();
 											submitPrompt(
@@ -2304,6 +2313,7 @@
 										}
 									}}
 									on:submit={async (e) => {
+										clearDraft();
 										if (e.detail || files.length > 0) {
 											await tick();
 											submitPrompt(

File diff suppressed because it is too large
+ 0 - 0
static/pyodide/pyodide-lock.json


Some files were not shown because too many files changed in this diff