From de4e086bd58e6013ee65572e25244fc32138e473 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Tue, 31 Dec 2024 02:48:43 -0800 Subject: [PATCH] refac --- .../components/chat/Messages/RateComment.svelte | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/lib/components/chat/Messages/RateComment.svelte b/src/lib/components/chat/Messages/RateComment.svelte index c774738c5..b30892faf 100644 --- a/src/lib/components/chat/Messages/RateComment.svelte +++ b/src/lib/components/chat/Messages/RateComment.svelte @@ -52,12 +52,21 @@ } const init = () => { - selectedReason = message?.annotation?.reason ?? ''; - comment = message?.annotation?.comment ?? ''; + if (!selectedReason) { + selectedReason = message?.annotation?.reason ?? ''; + } + + if (!comment) { + comment = message?.annotation?.comment ?? ''; + } + tags = (message?.annotation?.tags ?? []).map((tag) => ({ name: tag })); - detailedRating = message?.annotation?.details?.rating ?? null; + + if (!detailedRating) { + detailedRating = message?.annotation?.details?.rating ?? null; + } }; onMount(() => {