mirror of
https://github.com/open-webui/open-webui
synced 2024-11-07 17:19:53 +00:00
fix: compare message
This commit is contained in:
parent
f77073410e
commit
a55d6e6077
@ -100,64 +100,68 @@
|
|||||||
class="flex snap-x snap-mandatory overflow-x-auto scrollbar-hidden"
|
class="flex snap-x snap-mandatory overflow-x-auto scrollbar-hidden"
|
||||||
id="responses-container-{parentMessage.id}"
|
id="responses-container-{parentMessage.id}"
|
||||||
>
|
>
|
||||||
{#each Object.keys(groupedMessages) as model}
|
{#key currentMessageId}
|
||||||
{#if groupedMessagesIdx[model] !== undefined && groupedMessages[model].messages.length > 0}
|
{#each Object.keys(groupedMessages) as model}
|
||||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
{#if groupedMessagesIdx[model] !== undefined && groupedMessages[model].messages.length > 0}
|
||||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||||
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||||
|
{@const message = groupedMessages[model].messages[groupedMessagesIdx[model]]}
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class=" snap-center min-w-80 w-full max-w-full m-1 border {history.messages[
|
class=" snap-center min-w-80 w-full max-w-full m-1 border {history.messages[
|
||||||
currentMessageId
|
currentMessageId
|
||||||
].model === model
|
].model === model
|
||||||
? 'border-gray-100 dark:border-gray-850 border-[1.5px]'
|
? 'border-gray-100 dark:border-gray-800 border-[1.5px]'
|
||||||
: 'border-gray-50 dark:border-gray-850 '} transition p-5 rounded-3xl"
|
: 'border-gray-50 dark:border-gray-850 '} transition p-5 rounded-3xl"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
currentMessageId = groupedMessages[model].messages[groupedMessagesIdx[model]].id;
|
if (currentMessageId != message.id) {
|
||||||
|
currentMessageId = message.id;
|
||||||
|
let messageId = message.id;
|
||||||
|
console.log(messageId);
|
||||||
|
|
||||||
let messageId = groupedMessages[model].messages[groupedMessagesIdx[model]].id;
|
//
|
||||||
|
let messageChildrenIds = history.messages[messageId].childrenIds;
|
||||||
|
while (messageChildrenIds.length !== 0) {
|
||||||
|
messageId = messageChildrenIds.at(-1);
|
||||||
|
messageChildrenIds = history.messages[messageId].childrenIds;
|
||||||
|
}
|
||||||
|
|
||||||
console.log(messageId);
|
history.currentId = messageId;
|
||||||
let messageChildrenIds = history.messages[messageId].childrenIds;
|
dispatch('change');
|
||||||
|
}
|
||||||
while (messageChildrenIds.length !== 0) {
|
|
||||||
messageId = messageChildrenIds.at(-1);
|
|
||||||
messageChildrenIds = history.messages[messageId].childrenIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
history.currentId = messageId;
|
|
||||||
dispatch('change');
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ResponseMessage
|
|
||||||
message={groupedMessages[model].messages[groupedMessagesIdx[model]]}
|
|
||||||
siblings={groupedMessages[model].messages.map((m) => m.id)}
|
|
||||||
isLastMessage={true}
|
|
||||||
{updateChatMessages}
|
|
||||||
{confirmEditResponseMessage}
|
|
||||||
showPreviousMessage={() => showPreviousMessage(model)}
|
|
||||||
showNextMessage={() => showNextMessage(model)}
|
|
||||||
{readOnly}
|
|
||||||
{rateMessage}
|
|
||||||
{copyToClipboard}
|
|
||||||
{continueGeneration}
|
|
||||||
regenerateResponse={async (message) => {
|
|
||||||
regenerateResponse(message);
|
|
||||||
await tick();
|
|
||||||
groupedMessagesIdx[model] = groupedMessages[model].messages.length - 1;
|
|
||||||
}}
|
}}
|
||||||
on:save={async (e) => {
|
>
|
||||||
console.log('save', e);
|
<ResponseMessage
|
||||||
|
message={groupedMessages[model].messages[groupedMessagesIdx[model]]}
|
||||||
|
siblings={groupedMessages[model].messages.map((m) => m.id)}
|
||||||
|
isLastMessage={true}
|
||||||
|
{updateChatMessages}
|
||||||
|
{confirmEditResponseMessage}
|
||||||
|
showPreviousMessage={() => showPreviousMessage(model)}
|
||||||
|
showNextMessage={() => showNextMessage(model)}
|
||||||
|
{readOnly}
|
||||||
|
{rateMessage}
|
||||||
|
{copyToClipboard}
|
||||||
|
{continueGeneration}
|
||||||
|
regenerateResponse={async (message) => {
|
||||||
|
regenerateResponse(message);
|
||||||
|
await tick();
|
||||||
|
groupedMessagesIdx[model] = groupedMessages[model].messages.length - 1;
|
||||||
|
}}
|
||||||
|
on:save={async (e) => {
|
||||||
|
console.log('save', e);
|
||||||
|
|
||||||
const message = e.detail;
|
const message = e.detail;
|
||||||
history.messages[message.id] = message;
|
history.messages[message.id] = message;
|
||||||
await updateChatById(localStorage.token, chatId, {
|
await updateChatById(localStorage.token, chatId, {
|
||||||
messages: messages,
|
messages: messages,
|
||||||
history: history
|
history: history
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
|
{/key}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user