diff --git a/src/lib/components/chat/Messages/RateComment.svelte b/src/lib/components/chat/Messages/RateComment.svelte index c3fee03e5..8dfc9afcc 100644 --- a/src/lib/components/chat/Messages/RateComment.svelte +++ b/src/lib/components/chat/Messages/RateComment.svelte @@ -3,6 +3,7 @@ import { createEventDispatcher, onMount, getContext } from 'svelte'; import { config, models } from '$lib/stores'; + import Tags from '$lib/components/common/Tags.svelte'; const i18n = getContext('i18n'); @@ -14,24 +15,28 @@ let LIKE_REASONS = []; let DISLIKE_REASONS = []; + let tags = []; + function loadReasons() { LIKE_REASONS = [ - $i18n.t('Accurate information'), - $i18n.t('Followed instructions perfectly'), - $i18n.t('Showcased creativity'), - $i18n.t('Positive attitude'), - $i18n.t('Attention to detail'), - $i18n.t('Thorough explanation'), - $i18n.t('Other') + 'accurate_information', + 'followed_instructions_perfectly', + 'showcased_creativity', + 'positive_attitude', + 'attention_to_detail', + 'thorough_explanation', + 'other' ]; DISLIKE_REASONS = [ - $i18n.t("Don't like the style"), - $i18n.t('Not factually correct'), - $i18n.t("Didn't fully follow instructions"), - $i18n.t("Refused when it shouldn't have"), - $i18n.t('Being lazy'), - $i18n.t('Other') + 'dont_like_the_style', + 'too_verbose', + 'not_helpful', + 'not_factually_correct', + 'didnt_fully_follow_instructions', + 'refused_when_it_shouldnt_have', + 'being_lazy', + 'other' ]; } @@ -50,6 +55,9 @@ onMount(() => { selectedReason = message?.annotation?.reason ?? ''; comment = message?.annotation?.comment ?? ''; + tags = (message?.annotation?.tags ?? []).map((tag) => ({ + name: tag + })); if (message?.arena) { selectedModel = $models.find((m) => m.id === message.selectedModelId); @@ -66,14 +74,15 @@ const saveHandler = () => { console.log('saveHandler'); - if (!selectedReason) { - toast.error($i18n.t('Please select a reason')); - return; - } + // if (!selectedReason) { + // toast.error($i18n.t('Please select a reason')); + // return; + // } dispatch('save', { reason: selectedReason, - comment: comment + comment: comment, + tags: tags }); toast.success($i18n.t('Thanks for your feedback!')); @@ -82,7 +91,7 @@ {#if message?.arena} -
+
{$i18n.t('This response was generated by "{{model}}"', { model: selectedModel ? (selectedModel?.name ?? selectedModel.id) : message.selectedModelId })} @@ -115,10 +124,10 @@
{#if reasons.length > 0} -
+
{#each reasons as reason} {/each}
@@ -137,22 +176,26 @@ bind:value={comment} class="w-full text-sm px-1 py-2 bg-transparent outline-none resize-none rounded-xl" placeholder={$i18n.t('Feel free to add specific details')} - rows="2" + rows="3" />
-
- + on:add={(e) => { + tags = [...tags, { name: e.detail }]; + }} + /> +