fix: merged response should be used in messages payload

This commit is contained in:
Timothy J. Baek 2024-10-26 12:41:54 -07:00
parent badbe4ea06
commit f03629de61
2 changed files with 22 additions and 28 deletions

View File

@ -1070,7 +1070,7 @@
// Prepare the base message object
const baseMessage = {
role: message.role,
content: message.content
content: message?.merged?.content ?? message.content
};
// Extract and format image URLs if any exist
@ -1535,10 +1535,7 @@
content: [
{
type: 'text',
text:
arr.length - 1 !== idx
? message.content
: (message?.raContent ?? message.content)
text: message?.merged?.content ?? message.content
},
...message.files
.filter((file) => file.type === 'image')
@ -1551,10 +1548,7 @@
]
}
: {
content:
arr.length - 1 !== idx
? message.content
: (message?.raContent ?? message.content)
content: message?.merged?.content ?? message.content
})
})),
seed: params?.seed ?? $settings?.params?.seed ?? undefined,

View File

@ -16,7 +16,6 @@
import Markdown from './Markdown.svelte';
import Name from './Name.svelte';
import Skeleton from './Skeleton.svelte';
const i18n = getContext('i18n');
export let chatId;
@ -155,7 +154,6 @@
await tick();
const messageElement = document.getElementById(`message-${messageId}`);
console.log(messageElement);
if (messageElement) {
messageElement.scrollIntoView({ block: 'start' });
}
@ -237,7 +235,7 @@
{/each}
</div>
{#if !readOnly && isLastMessage}
{#if !readOnly}
{#if !Object.keys(groupedMessageIds).find((modelIdx) => {
const { messageIds } = groupedMessageIds[modelIdx];
const _messageId = messageIds[groupedMessageIdsIdx[modelIdx]];
@ -272,22 +270,24 @@
{/if}
</div>
<div class=" flex-shrink-0 text-gray-600 dark:text-gray-500 mt-1">
<Tooltip content={$i18n.t('Merge Responses')} placement="bottom">
<button
type="button"
id="merge-response-button"
class="{true
? 'visible'
: 'invisible group-hover:visible'} p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg dark:hover:text-white hover:text-black transition regenerate-response-button"
on:click={() => {
mergeResponsesHandler();
}}
>
<Merge className=" size-5 " />
</button>
</Tooltip>
</div>
{#if isLastMessage}
<div class=" flex-shrink-0 text-gray-600 dark:text-gray-500 mt-1">
<Tooltip content={$i18n.t('Merge Responses')} placement="bottom">
<button
type="button"
id="merge-response-button"
class="{true
? 'visible'
: 'invisible group-hover:visible'} p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg dark:hover:text-white hover:text-black transition regenerate-response-button"
on:click={() => {
mergeResponsesHandler();
}}
>
<Merge className=" size-5 " />
</button>
</Tooltip>
</div>
{/if}
</div>
{/if}
{/if}