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

View File

@ -16,7 +16,6 @@
import Markdown from './Markdown.svelte'; import Markdown from './Markdown.svelte';
import Name from './Name.svelte'; import Name from './Name.svelte';
import Skeleton from './Skeleton.svelte'; import Skeleton from './Skeleton.svelte';
const i18n = getContext('i18n'); const i18n = getContext('i18n');
export let chatId; export let chatId;
@ -155,7 +154,6 @@
await tick(); await tick();
const messageElement = document.getElementById(`message-${messageId}`); const messageElement = document.getElementById(`message-${messageId}`);
console.log(messageElement);
if (messageElement) { if (messageElement) {
messageElement.scrollIntoView({ block: 'start' }); messageElement.scrollIntoView({ block: 'start' });
} }
@ -237,7 +235,7 @@
{/each} {/each}
</div> </div>
{#if !readOnly && isLastMessage} {#if !readOnly}
{#if !Object.keys(groupedMessageIds).find((modelIdx) => { {#if !Object.keys(groupedMessageIds).find((modelIdx) => {
const { messageIds } = groupedMessageIds[modelIdx]; const { messageIds } = groupedMessageIds[modelIdx];
const _messageId = messageIds[groupedMessageIdsIdx[modelIdx]]; const _messageId = messageIds[groupedMessageIdsIdx[modelIdx]];
@ -272,6 +270,7 @@
{/if} {/if}
</div> </div>
{#if isLastMessage}
<div class=" flex-shrink-0 text-gray-600 dark:text-gray-500 mt-1"> <div class=" flex-shrink-0 text-gray-600 dark:text-gray-500 mt-1">
<Tooltip content={$i18n.t('Merge Responses')} placement="bottom"> <Tooltip content={$i18n.t('Merge Responses')} placement="bottom">
<button <button
@ -288,6 +287,7 @@
</button> </button>
</Tooltip> </Tooltip>
</div> </div>
{/if}
</div> </div>
{/if} {/if}
{/if} {/if}