mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-16 11:57:51 +01:00
refac
This commit is contained in:
@@ -66,7 +66,7 @@
|
||||
|
||||
const editMessageHandler = async () => {
|
||||
edit = true;
|
||||
editedContent = message.content;
|
||||
editedContent = message?.content ?? '';
|
||||
editedFiles = message.files;
|
||||
|
||||
await tick();
|
||||
@@ -80,6 +80,11 @@
|
||||
};
|
||||
|
||||
const editMessageConfirmHandler = async (submit = true) => {
|
||||
if (!editedContent && editedFiles.length === 0) {
|
||||
toast.error($i18n.t('Please enter a message or attach a file.'));
|
||||
return;
|
||||
}
|
||||
|
||||
editMessage(message.id, { content: editedContent, files: editedFiles }, submit);
|
||||
|
||||
edit = false;
|
||||
@@ -186,7 +191,6 @@
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{#if message.content !== ''}
|
||||
{#if edit === true}
|
||||
<div class=" w-full bg-gray-50 dark:bg-gray-800 rounded-3xl px-5 py-3 mb-2">
|
||||
{#if (editedFiles ?? []).length > 0}
|
||||
@@ -308,7 +312,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
{:else if message.content !== ''}
|
||||
<div class="w-full">
|
||||
<div class="flex {($settings?.chatBubble ?? true) ? 'justify-end pb-1' : 'w-full'}">
|
||||
<div
|
||||
@@ -325,7 +329,6 @@
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{#if edit !== true}
|
||||
<div
|
||||
@@ -453,6 +456,7 @@
|
||||
</Tooltip>
|
||||
{/if}
|
||||
|
||||
{#if message?.content}
|
||||
<Tooltip content={$i18n.t('Copy')} placement="bottom">
|
||||
<button
|
||||
class="invisible group-hover:visible p-1.5 hover:bg-black/5 dark:hover:bg-white/5 rounded-lg dark:hover:text-white hover:text-black transition"
|
||||
@@ -476,6 +480,7 @@
|
||||
</svg>
|
||||
</button>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
|
||||
{#if !readOnly && (!isFirstMessage || siblings.length > 1)}
|
||||
<Tooltip content={$i18n.t('Delete')} placement="bottom">
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
<ImagePreview bind:show={showImagePreview} src={_src} {alt} />
|
||||
|
||||
<div class=" relative group w-fit">
|
||||
<div class=" relative group w-fit flex items-center">
|
||||
<button
|
||||
class={className}
|
||||
on:click={() => {
|
||||
|
||||
Reference in New Issue
Block a user