forked from open-webui/open-webui
Merge pull request #341 from ollama-webui/edit-message-fix
fix: edit message issue
This commit is contained in:
commit
9937b5e467
3 changed files with 38 additions and 43 deletions
|
@ -215,42 +215,44 @@
|
||||||
{#if messages.length == 0}
|
{#if messages.length == 0}
|
||||||
<Placeholder models={selectedModels} modelfiles={selectedModelfiles} />
|
<Placeholder models={selectedModels} modelfiles={selectedModelfiles} />
|
||||||
{:else}
|
{:else}
|
||||||
{#each messages as message, messageIdx}
|
{#key chatId}
|
||||||
<div class=" w-full">
|
{#each messages as message, messageIdx}
|
||||||
<div class="flex justify-between px-5 mb-3 max-w-3xl mx-auto rounded-lg group">
|
<div class=" w-full">
|
||||||
{#if message.role === 'user'}
|
<div class="flex justify-between px-5 mb-3 max-w-3xl mx-auto rounded-lg group">
|
||||||
<UserMessage
|
{#if message.role === 'user'}
|
||||||
user={$user}
|
<UserMessage
|
||||||
{message}
|
user={$user}
|
||||||
siblings={message.parentId !== null
|
{message}
|
||||||
? history.messages[message.parentId]?.childrenIds ?? []
|
siblings={message.parentId !== null
|
||||||
: Object.values(history.messages)
|
? history.messages[message.parentId]?.childrenIds ?? []
|
||||||
.filter((message) => message.parentId === null)
|
: Object.values(history.messages)
|
||||||
.map((message) => message.id) ?? []}
|
.filter((message) => message.parentId === null)
|
||||||
{confirmEditMessage}
|
.map((message) => message.id) ?? []}
|
||||||
{showPreviousMessage}
|
{confirmEditMessage}
|
||||||
{showNextMessage}
|
{showPreviousMessage}
|
||||||
{copyToClipboard}
|
{showNextMessage}
|
||||||
/>
|
{copyToClipboard}
|
||||||
{:else}
|
/>
|
||||||
<ResponseMessage
|
{:else}
|
||||||
{message}
|
<ResponseMessage
|
||||||
modelfiles={selectedModelfiles}
|
{message}
|
||||||
siblings={history.messages[message.parentId]?.childrenIds ?? []}
|
modelfiles={selectedModelfiles}
|
||||||
isLastMessage={messageIdx + 1 === messages.length}
|
siblings={history.messages[message.parentId]?.childrenIds ?? []}
|
||||||
{confirmEditResponseMessage}
|
isLastMessage={messageIdx + 1 === messages.length}
|
||||||
{showPreviousMessage}
|
{confirmEditResponseMessage}
|
||||||
{showNextMessage}
|
{showPreviousMessage}
|
||||||
{rateMessage}
|
{showNextMessage}
|
||||||
{copyToClipboard}
|
{rateMessage}
|
||||||
{regenerateResponse}
|
{copyToClipboard}
|
||||||
/>
|
{regenerateResponse}
|
||||||
{/if}
|
/>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{/each}
|
||||||
{/each}
|
|
||||||
|
|
||||||
{#if bottomPadding}
|
{#if bottomPadding}
|
||||||
<div class=" mb-10" />
|
<div class=" mb-10" />
|
||||||
{/if}
|
{/if}
|
||||||
|
{/key}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -33,8 +33,6 @@
|
||||||
let speaking = null;
|
let speaking = null;
|
||||||
|
|
||||||
$: if (message) {
|
$: if (message) {
|
||||||
edit = false;
|
|
||||||
editedContent = '';
|
|
||||||
renderStyling();
|
renderStyling();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,11 +39,6 @@
|
||||||
edit = false;
|
edit = false;
|
||||||
editedContent = '';
|
editedContent = '';
|
||||||
};
|
};
|
||||||
|
|
||||||
$: if (message) {
|
|
||||||
edit = false;
|
|
||||||
editedContent = '';
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class=" flex w-full">
|
<div class=" flex w-full">
|
||||||
|
|
Loading…
Reference in a new issue