fix: rate responses

This commit is contained in:
Timothy J. Baek 2024-09-24 14:02:41 +02:00
parent 85e9e231ed
commit 299b3d72cf
2 changed files with 15 additions and 8 deletions

View File

@ -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 @@
<div
class=" my-2.5 rounded-xl px-4 py-3 border dark:border-gray-850"
id="message-feedback-{messageId}"
id="message-feedback-{message.id}"
>
<div class="flex justify-between items-center">
<div class=" text-sm">{$i18n.t('Tell us more:')}</div>

View File

@ -1035,11 +1035,17 @@
{#if message.done && showRateComment}
<RateComment
messageId={message.id}
bind:show={showRateComment}
bind:message
bind:show={showRateComment}
on:submit={(e) => {
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) => {