mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
Merge 6a8d870b8e
into 21d616f8ed
This commit is contained in:
commit
f0b307861f
@ -12,6 +12,24 @@
|
||||
show = false;
|
||||
onClose();
|
||||
};
|
||||
|
||||
$: prompt = (() => {
|
||||
const messages = selectedFeedback?.snapshot?.chat?.chat?.history?.messages;
|
||||
const messageId = selectedFeedback?.meta?.message_id;
|
||||
if (!messages || !messageId) return '';
|
||||
const assistantMsg = messages[messageId];
|
||||
if (!assistantMsg) return '';
|
||||
const userMsg = assistantMsg.parentId ? messages[assistantMsg.parentId] : null;
|
||||
return userMsg?.content ?? '';
|
||||
})();
|
||||
|
||||
$: response = (() => {
|
||||
const messages = selectedFeedback?.snapshot?.chat?.chat?.history?.messages;
|
||||
const messageId = selectedFeedback?.meta?.message_id;
|
||||
if (!messages || !messageId) return '';
|
||||
const assistantMsg = messages[messageId];
|
||||
return assistantMsg?.content ?? '';
|
||||
})();
|
||||
</script>
|
||||
|
||||
<Modal size="sm" bind:show>
|
||||
@ -65,6 +83,30 @@
|
||||
<span>{selectedFeedback?.data?.reason || '-'}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col w-full mb-2">
|
||||
<div class=" mb-1 text-xs text-gray-500">{$i18n.t('Comment')}</div>
|
||||
|
||||
<div class="flex-1 text-xs">
|
||||
<span>{selectedFeedback?.data?.comment || '-'}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col w-full mb-2">
|
||||
<div class="mb-1 text-xs text-gray-500">{$i18n.t('Prompt')}</div>
|
||||
<div
|
||||
class="flex-1 text-xs whitespace-pre-line break-words bg-gray-50 dark:bg-gray-900 rounded px-2 py-1"
|
||||
>
|
||||
<span>{prompt || '-'}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col w-full mb-2">
|
||||
<div class="mb-1 text-xs text-gray-500">{$i18n.t('Response')}</div>
|
||||
<div
|
||||
class="flex-1 text-xs whitespace-pre-line break-words bg-gray-50 dark:bg-gray-900 rounded px-2 py-1"
|
||||
>
|
||||
<span>{response || '-'}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end pt-2">
|
||||
<button
|
||||
|
@ -97,9 +97,15 @@
|
||||
let showFeedbackModal = false;
|
||||
let selectedFeedback = null;
|
||||
|
||||
const openFeedbackModal = (feedback) => {
|
||||
const openFeedbackModal = async (feedback) => {
|
||||
const all = await exportAllFeedbacks(localStorage.token).catch((err) => {
|
||||
toast.error(err);
|
||||
return null;
|
||||
});
|
||||
|
||||
const full = all.find((f) => f.id === feedback.id);
|
||||
showFeedbackModal = true;
|
||||
selectedFeedback = feedback;
|
||||
selectedFeedback = full || feedback;
|
||||
};
|
||||
|
||||
const closeFeedbackModal = () => {
|
||||
|
Loading…
Reference in New Issue
Block a user