mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-28 05:27:35 +00:00
refac
This commit is contained in:
parent
d864669b59
commit
c4c4ab57e3
5 changed files with 41 additions and 4 deletions
|
|
@ -136,6 +136,7 @@
|
|||
|
||||
let loading = true;
|
||||
$: chatContainerId = embedded ? 'note-chat-container' : 'chat-container';
|
||||
$: messageInputDropzoneId = embedded ? 'note-chat-input-dropzone' : 'chat-pane';
|
||||
const embeddedSuggestedPrompts = [
|
||||
'Enhance this note and update it.',
|
||||
'Summarize this note.',
|
||||
|
|
@ -3750,7 +3751,10 @@
|
|||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div class=" pb-2 {dragged ? 'z-0' : 'z-10'}">
|
||||
<div
|
||||
id={embedded ? messageInputDropzoneId : undefined}
|
||||
class=" pb-2 {dragged ? 'z-0' : 'z-10'}"
|
||||
>
|
||||
<MessageInput
|
||||
bind:this={messageInput}
|
||||
{history}
|
||||
|
|
@ -3769,6 +3773,7 @@
|
|||
bind:atSelectedModel
|
||||
bind:showCommands
|
||||
bind:dragged
|
||||
dropzoneId={messageInputDropzoneId}
|
||||
chatId={$chatId}
|
||||
{contextUsage}
|
||||
compactHandler={handleManualCompact}
|
||||
|
|
@ -3862,7 +3867,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pb-2 z-10">
|
||||
<div id={embedded ? messageInputDropzoneId : undefined} class="pb-2 z-10">
|
||||
<MessageInput
|
||||
bind:this={messageInput}
|
||||
{history}
|
||||
|
|
@ -3881,6 +3886,7 @@
|
|||
bind:atSelectedModel
|
||||
bind:showCommands
|
||||
bind:dragged
|
||||
dropzoneId={messageInputDropzoneId}
|
||||
chatId={$chatId}
|
||||
{contextUsage}
|
||||
compactHandler={handleManualCompact}
|
||||
|
|
|
|||
|
|
@ -507,6 +507,7 @@
|
|||
let showInputModal = false;
|
||||
|
||||
export let dragged = false;
|
||||
export let dropzoneId = 'chat-pane';
|
||||
let shiftKey = false;
|
||||
|
||||
let user = null;
|
||||
|
|
@ -1216,7 +1217,7 @@
|
|||
await tick();
|
||||
if (isDestroyed) return;
|
||||
|
||||
dropzoneElement = document.getElementById('chat-pane');
|
||||
dropzoneElement = document.getElementById(dropzoneId);
|
||||
if (dropzoneElement) {
|
||||
dropzoneElement.addEventListener('dragover', onDragOver, true);
|
||||
dropzoneElement.addEventListener('drop', onDrop, true);
|
||||
|
|
|
|||
|
|
@ -648,6 +648,20 @@ ${content}
|
|||
});
|
||||
};
|
||||
|
||||
const uploadNoteFilesHandler = () => {
|
||||
const input = document.createElement('input');
|
||||
input.type = 'file';
|
||||
input.multiple = true;
|
||||
input.click();
|
||||
|
||||
input.onchange = async () => {
|
||||
const inputFiles = Array.from(input.files ?? []);
|
||||
if (inputFiles.length > 0) {
|
||||
await inputFilesHandler(inputFiles);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const openNoteChat = async () => {
|
||||
console.info('[note-chat] open requested', {
|
||||
noteId: note?.id,
|
||||
|
|
@ -1170,6 +1184,7 @@ ${content}
|
|||
{/if}
|
||||
|
||||
<NoteMenu
|
||||
onUploadFiles={note?.write_access ? uploadNoteFilesHandler : null}
|
||||
onDownload={(type) => {
|
||||
downloadHandler(type);
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
show = false;
|
||||
}}
|
||||
>
|
||||
<div class=" px-3.5 py-2.5 h-screen max-h-dvh flex flex-col">
|
||||
<div class=" h-screen max-h-dvh flex flex-col">
|
||||
<slot />
|
||||
</div>
|
||||
</Drawer>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
import Link from '$lib/components/icons/Link.svelte';
|
||||
import Pin from '$lib/components/icons/Pin.svelte';
|
||||
import PinSlash from '$lib/components/icons/PinSlash.svelte';
|
||||
import CloudArrowUp from '$lib/components/icons/CloudArrowUp.svelte';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
|
|
@ -21,6 +22,7 @@
|
|||
export let onDelete = () => {};
|
||||
export let onPin = null;
|
||||
export let isPinned = false;
|
||||
export let onUploadFiles = null;
|
||||
|
||||
export let onCopyLink = null;
|
||||
export let onCopyToClipboard = null;
|
||||
|
|
@ -77,6 +79,19 @@
|
|||
</button>
|
||||
</DropdownSub>
|
||||
|
||||
{#if onUploadFiles}
|
||||
<button
|
||||
class="select-none flex h-[1.6875rem] w-full cursor-pointer items-center gap-2 rounded-xl bg-transparent px-2 text-[13px] hover:text-gray-900 dark:hover:text-gray-100"
|
||||
on:click={() => {
|
||||
onUploadFiles();
|
||||
show = false;
|
||||
}}
|
||||
>
|
||||
<CloudArrowUp className="size-3.5" strokeWidth="2" />
|
||||
<div class="flex items-center">{$i18n.t('Upload files')}</div>
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
{#if onCopyLink || onCopyToClipboard}
|
||||
<DropdownSub contentClass="select-none z-50">
|
||||
<button
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue