mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
refac: input ui
This commit is contained in:
parent
f527f31d2b
commit
6d797820f5
@ -453,35 +453,9 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class=" flex">
|
<div class="px-3">
|
||||||
<div class="ml-1 self-end mb-1.5 flex space-x-1">
|
|
||||||
<InputMenu
|
|
||||||
{screenCaptureHandler}
|
|
||||||
uploadFilesHandler={() => {
|
|
||||||
filesInputElement.click();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
class="bg-transparent hover:bg-white/80 text-gray-800 dark:text-white dark:hover:bg-gray-800 transition rounded-full p-2 outline-none focus:outline-none"
|
|
||||||
type="button"
|
|
||||||
aria-label="More"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 20 20"
|
|
||||||
fill="currentColor"
|
|
||||||
class="size-5"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</InputMenu>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="scrollbar-hidden text-left bg-transparent dark:text-gray-100 outline-none w-full py-2.5 px-1 rounded-xl resize-none h-fit max-h-80 overflow-auto"
|
class="scrollbar-hidden text-left bg-transparent dark:text-gray-100 outline-none w-full pt-2.5 px-1 rounded-xl resize-none h-fit max-h-80 overflow-auto"
|
||||||
>
|
>
|
||||||
<RichTextInput
|
<RichTextInput
|
||||||
bind:value={content}
|
bind:value={content}
|
||||||
@ -528,6 +502,34 @@
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class=" flex justify-between">
|
||||||
|
<div class="ml-1 self-end mb-1.5 flex space-x-1">
|
||||||
|
<InputMenu
|
||||||
|
{screenCaptureHandler}
|
||||||
|
uploadFilesHandler={() => {
|
||||||
|
filesInputElement.click();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
class="bg-transparent hover:bg-white/80 text-gray-800 dark:text-white dark:hover:bg-gray-800 transition rounded-full p-2 outline-none focus:outline-none"
|
||||||
|
type="button"
|
||||||
|
aria-label="More"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
fill="currentColor"
|
||||||
|
class="size-5"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</InputMenu>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="self-end mb-1.5 flex space-x-1 mr-1">
|
<div class="self-end mb-1.5 flex space-x-1 mr-1">
|
||||||
{#if content === ''}
|
{#if content === ''}
|
||||||
|
@ -673,66 +673,10 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class=" flex">
|
<div class="px-3">
|
||||||
<div class="ml-1 self-end mb-1.5 flex space-x-1">
|
|
||||||
<InputMenu
|
|
||||||
bind:imageGenerationEnabled
|
|
||||||
bind:codeInterpreterEnabled
|
|
||||||
bind:webSearchEnabled
|
|
||||||
bind:selectedToolIds
|
|
||||||
{screenCaptureHandler}
|
|
||||||
uploadFilesHandler={() => {
|
|
||||||
filesInputElement.click();
|
|
||||||
}}
|
|
||||||
uploadGoogleDriveHandler={async () => {
|
|
||||||
try {
|
|
||||||
const fileData = await createPicker();
|
|
||||||
if (fileData) {
|
|
||||||
const file = new File([fileData.blob], fileData.name, {
|
|
||||||
type: fileData.blob.type
|
|
||||||
});
|
|
||||||
await uploadFileHandler(file);
|
|
||||||
} else {
|
|
||||||
console.log('No file was selected from Google Drive');
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Google Drive Error:', error);
|
|
||||||
toast.error(
|
|
||||||
$i18n.t('Error accessing Google Drive: {{error}}', {
|
|
||||||
error: error.message
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
onClose={async () => {
|
|
||||||
await tick();
|
|
||||||
|
|
||||||
const chatInput = document.getElementById('chat-input');
|
|
||||||
chatInput?.focus();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
class="bg-transparent hover:bg-white/80 text-gray-800 dark:text-white dark:hover:bg-gray-800 transition rounded-full p-2 outline-none focus:outline-none"
|
|
||||||
type="button"
|
|
||||||
aria-label="More"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 20 20"
|
|
||||||
fill="currentColor"
|
|
||||||
class="size-5"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</InputMenu>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{#if $settings?.richTextInput ?? true}
|
{#if $settings?.richTextInput ?? true}
|
||||||
<div
|
<div
|
||||||
class="scrollbar-hidden text-left bg-transparent dark:text-gray-100 outline-none w-full py-2.5 px-1 rounded-xl resize-none h-fit max-h-80 overflow-auto"
|
class="scrollbar-hidden text-left bg-transparent dark:text-gray-100 outline-none w-full pt-2.5 px-1 rounded-xl resize-none h-fit max-h-80 overflow-auto"
|
||||||
>
|
>
|
||||||
<RichTextInput
|
<RichTextInput
|
||||||
bind:this={chatInputElement}
|
bind:this={chatInputElement}
|
||||||
@ -936,7 +880,7 @@
|
|||||||
<textarea
|
<textarea
|
||||||
id="chat-input"
|
id="chat-input"
|
||||||
bind:this={chatInputElement}
|
bind:this={chatInputElement}
|
||||||
class="scrollbar-hidden bg-transparent dark:text-gray-100 outline-none w-full py-3 px-1 rounded-xl resize-none h-[48px]"
|
class="scrollbar-hidden bg-transparent dark:text-gray-100 outline-none w-full pt-3 px-1 rounded-xl resize-none h-[48px]"
|
||||||
placeholder={placeholder ? placeholder : $i18n.t('Send a Message')}
|
placeholder={placeholder ? placeholder : $i18n.t('Send a Message')}
|
||||||
bind:value={prompt}
|
bind:value={prompt}
|
||||||
on:keypress={(e) => {
|
on:keypress={(e) => {
|
||||||
@ -1125,6 +1069,64 @@
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class=" flex justify-between">
|
||||||
|
<div class="ml-1 self-end mb-1.5 flex space-x-1">
|
||||||
|
<InputMenu
|
||||||
|
bind:imageGenerationEnabled
|
||||||
|
bind:codeInterpreterEnabled
|
||||||
|
bind:webSearchEnabled
|
||||||
|
bind:selectedToolIds
|
||||||
|
{screenCaptureHandler}
|
||||||
|
uploadFilesHandler={() => {
|
||||||
|
filesInputElement.click();
|
||||||
|
}}
|
||||||
|
uploadGoogleDriveHandler={async () => {
|
||||||
|
try {
|
||||||
|
const fileData = await createPicker();
|
||||||
|
if (fileData) {
|
||||||
|
const file = new File([fileData.blob], fileData.name, {
|
||||||
|
type: fileData.blob.type
|
||||||
|
});
|
||||||
|
await uploadFileHandler(file);
|
||||||
|
} else {
|
||||||
|
console.log('No file was selected from Google Drive');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Google Drive Error:', error);
|
||||||
|
toast.error(
|
||||||
|
$i18n.t('Error accessing Google Drive: {{error}}', {
|
||||||
|
error: error.message
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onClose={async () => {
|
||||||
|
await tick();
|
||||||
|
|
||||||
|
const chatInput = document.getElementById('chat-input');
|
||||||
|
chatInput?.focus();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
class="bg-transparent hover:bg-white/80 text-gray-800 dark:text-white dark:hover:bg-gray-800 transition rounded-full p-2 outline-none focus:outline-none"
|
||||||
|
type="button"
|
||||||
|
aria-label="More"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
fill="currentColor"
|
||||||
|
class="size-5"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</InputMenu>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="self-end mb-1.5 flex space-x-1 mr-1">
|
<div class="self-end mb-1.5 flex space-x-1 mr-1">
|
||||||
{#if !history?.currentId || history.messages[history.currentId]?.done == true}
|
{#if !history?.currentId || history.messages[history.currentId]?.done == true}
|
||||||
|
Loading…
Reference in New Issue
Block a user