浏览代码

refac: add eventConfirmationInputValue handling in Chat.svelte

Peter De-Ath 9 月之前
父节点
当前提交
cbe3694b81
共有 2 个文件被更改,包括 4 次插入1 次删除
  1. 3 0
      src/lib/components/chat/Chat.svelte
  2. 1 1
      src/lib/components/common/ConfirmDialog.svelte

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

@@ -80,6 +80,7 @@
 	let eventConfirmationMessage = '';
 	let eventConfirmationInput = false;
 	let eventConfirmationInputPlaceholder = '';
+	let eventConfirmationInputValue = '';
 	let eventCallback = null;
 
 	let showModelSelector = true;
@@ -182,6 +183,7 @@
 				eventConfirmationTitle = data.title;
 				eventConfirmationMessage = data.message;
 				eventConfirmationInputPlaceholder = data.placeholder;
+				eventConfirmationInputValue = data?.value ?? '';
 			} else {
 				console.log('Unknown message type', data);
 			}
@@ -1489,6 +1491,7 @@
 	message={eventConfirmationMessage}
 	input={eventConfirmationInput}
 	inputPlaceholder={eventConfirmationInputPlaceholder}
+	inputValue={eventConfirmationInputValue}
 	on:confirm={(e) => {
 		if (e.detail) {
 			eventCallback(e.detail);

+ 1 - 1
src/lib/components/common/ConfirmDialog.svelte

@@ -15,12 +15,12 @@
 
 	export let input = false;
 	export let inputPlaceholder = '';
+	export let inputValue = '';
 
 	export let show = false;
 
 	let modalElement = null;
 	let mounted = false;
-	let inputValue = '';
 
 	const handleKeyDown = (event: KeyboardEvent) => {
 		if (event.key === 'Escape') {