diff --git a/src/lib/components/chat/Messages/RateComment.svelte b/src/lib/components/chat/Messages/RateComment.svelte index 73261ce66..6bb8cfee2 100644 --- a/src/lib/components/chat/Messages/RateComment.svelte +++ b/src/lib/components/chat/Messages/RateComment.svelte @@ -7,9 +7,8 @@ const dispatch = createEventDispatcher(); - export let messageId = null; - export let show = false; export let message; + export let show = false; let LIKE_REASONS = []; let DISLIKE_REASONS = []; @@ -54,8 +53,10 @@ const submitHandler = () => { console.log('submitHandler'); - message.annotation.reason = selectedReason; - message.annotation.comment = comment; + if (!selectedReason) { + toast.error($i18n.t('Please select a reason')); + return; + } dispatch('submit', { reason: selectedReason, @@ -69,7 +70,7 @@
{$i18n.t('Tell us more:')}
diff --git a/src/lib/components/chat/Messages/ResponseMessage.svelte b/src/lib/components/chat/Messages/ResponseMessage.svelte index 6f1927b6f..ff1983cbd 100644 --- a/src/lib/components/chat/Messages/ResponseMessage.svelte +++ b/src/lib/components/chat/Messages/ResponseMessage.svelte @@ -1035,11 +1035,17 @@ {#if message.done && showRateComment} { - dispatch('update'); + dispatch('save', { + ...message, + annotation: { + ...message.annotation, + comment: e.detail.comment, + reason: e.detail.reason + } + }); (model?.actions ?? []) .filter((action) => action?.__webui__ ?? false) .forEach((action) => {