Quick fix: Chatbot change event (#5827)

* fix

* add changeset

* add dequal to dependency

* package

* lint

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
This commit is contained in:
Dawood Khan 2023-10-06 14:16:59 -04:00 committed by GitHub
parent 7b63db2716
commit 48e09ee887
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 5 deletions

View File

@ -0,0 +1,6 @@
---
"@gradio/chatbot": patch
"gradio": patch
---
fix:Quick fix: Chatbot change event

View File

@ -17,7 +17,8 @@
"@gradio/utils": "workspace:^",
"@types/dompurify": "^3.0.2",
"@types/katex": "^0.16.0",
"@types/prismjs": "1.26.1"
"@types/prismjs": "1.26.1",
"dequal": "^2.0.2"
},
"main_changeset": true,
"exports": {

View File

@ -2,6 +2,7 @@
import { format_chat_for_sharing } from "../utils";
import { copy } from "@gradio/utils";
import { dequal } from "dequal/lite";
import { beforeUpdate, afterUpdate, createEventDispatcher } from "svelte";
import { ShareButton } from "@gradio/atoms";
import type { SelectData, LikeData } from "@gradio/utils";
@ -68,7 +69,7 @@
});
$: {
if (value !== old_value) {
if (!dequal(value, old_value)) {
old_value = value;
dispatch("change");
}
@ -81,7 +82,7 @@
): void {
dispatch("select", {
index: [i, j],
value: message,
value: message
});
}
@ -94,7 +95,7 @@
dispatch("like", {
index: [i, j],
value: message,
liked: liked,
liked: liked
});
}
</script>

5
pnpm-lock.yaml generated
View File

@ -601,6 +601,9 @@ importers:
'@types/prismjs':
specifier: 1.26.1
version: 1.26.1
dequal:
specifier: ^2.0.2
version: 2.0.2
js/checkbox:
dependencies:
@ -6437,7 +6440,7 @@ packages:
peerDependencies:
'@sveltejs/kit': ^1.0.0
dependencies:
'@sveltejs/kit': 1.16.3(svelte@3.59.2)(vite@4.3.9)
'@sveltejs/kit': 1.16.3(svelte@3.57.0)(vite@4.3.5)
import-meta-resolve: 3.0.0
dev: true