Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
462aca56
Unverified
Commit
462aca56
authored
Nov 11, 2023
by
Timothy Jaeryang Baek
Committed by
GitHub
Nov 11, 2023
Browse files
Merge pull request #95 from ollama-webui/dev
feat: scroll to bottom button added
parents
1681dcae
5ad9488e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
183 additions
and
155 deletions
+183
-155
src/routes/+page.svelte
src/routes/+page.svelte
+183
-155
No files found.
src/routes/+page.svelte
View file @
462aca56
...
@@ -259,6 +259,7 @@
...
@@ -259,6 +259,7 @@
const
createNewChat
=
async
(
init
=
false
)
=>
{
const
createNewChat
=
async
(
init
=
false
)
=>
{
if
(
init
||
messages
.
length
>
0
)
{
if
(
init
||
messages
.
length
>
0
)
{
chatId
=
uuidv4
();
chatId
=
uuidv4
();
autoScroll
=
true
;
messages
=
[];
messages
=
[];
title
=
''
;
title
=
''
;
...
@@ -1331,178 +1332,205 @@
...
@@ -1331,178 +1332,205 @@
</div>
</div>
<div
class=
"fixed bottom-0 w-full"
>
<div
class=
"fixed bottom-0 w-full"
>
<div
class=
"
bg-gradient-to-t from-white dark:from-gray-800 from-40%
pt-5"
>
<div
class=
" pt-5"
>
<div
class=
"max-w-3xl px-2.5 pt-2.5
pb-2
-mb-0.5 mx-auto inset-x-0"
>
<div
class=
"max-w-3xl px-2.5 pt-2.5 -mb-0.5 mx-auto inset-x-0"
>
{#if messages.length == 0
&&
suggestions !== 'false'}
{#if messages.length == 0
&&
suggestions !== 'false'}
<Suggestions
{
submitPrompt
}
/>
<Suggestions
{
submitPrompt
}
/>
{/if}
{/if}
<form
class=
" flex relative w-full"
{#if autoScroll === false}
on:submit
|
preventDefault=
{()
=
>
{
<div
class=
" flex justify-center mb-4"
>
submitPrompt(prompt);
<button
}}
class=
" bg-white/20 p-1.5 rounded-full"
>
on:click=
{()
=
>
{
<textarea
window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' });
id=
"chat-textarea"
}}
class=
"rounded-xl dark:bg-gray-800 dark:text-gray-100 outline-none border dark:border-gray-600 w-full py-3
>
{fileUploadEnabled ? 'pl-12' : 'pl-5'} {speechRecognitionEnabled ? 'pr-20' : 'pr-12'} resize-none"
<svg
placeholder=
{speechRecognitionListening
?
'
Listening...
'
:
'
Send
a
message
'}
xmlns=
"http://www.w3.org/2000/svg"
bind:value=
{prompt}
viewBox=
"0 0 20 20"
on:keypress=
{(e)
=
>
{
fill=
"currentColor"
if (e.keyCode == 13
&&
!e.shiftKey) {
class=
"w-5 h-5"
e.preventDefault();
>
}
<path
if (prompt !== ''
&&
e.keyCode == 13
&&
!e.shiftKey) {
fill-rule=
"evenodd"
submitPrompt(prompt);
d=
"M10 3a.75.75 0 01.75.75v10.638l3.96-4.158a.75.75 0 111.08 1.04l-5.25 5.5a.75.75 0 01-1.08 0l-5.25-5.5a.75.75 0 111.08-1.04l3.96 4.158V3.75A.75.75 0 0110 3z"
}
clip-rule=
"evenodd"
}}
/>
rows="1"
</svg>
on:input={(e) => {
</button>
e.target.style.height = '';
</div>
e.target.style.height = Math.min(e.target.scrollHeight, 200) + 2 + 'px';
{/if}
<div
class=
"bg-gradient-to-t from-white dark:from-gray-800 from-40% pb-2"
>
<form
class=
" flex relative w-full"
on:submit
|
preventDefault=
{()
=
>
{
submitPrompt(prompt);
}}
}}
/>
>
<textarea
{#if fileUploadEnabled}
id=
"chat-textarea"
<div
class=
" absolute left-0 bottom-0"
>
class=
"rounded-xl dark:bg-gray-800 dark:text-gray-100 outline-none border dark:border-gray-600 w-full py-3
<div
class=
"pl-2.5 pb-[9px]"
>
{fileUploadEnabled ? 'pl-12' : 'pl-5'} {speechRecognitionEnabled ? 'pr-20' : 'pr-12'} resize-none"
<button
placeholder=
{speechRecognitionListening
?
'
Listening...
'
:
'
Send
a
message
'}
class=
" text-gray-600 dark:text-gray-200 transition rounded-lg p-1.5"
bind:value=
{prompt}
type=
"button"
on:keypress=
{(e)
=
>
{
on:click=
{()
=
>
{
if (e.keyCode == 13
&&
!e.shiftKey) {
console.log('file');
e.preventDefault();
}}
}
>
if (prompt !== ''
&&
e.keyCode == 13
&&
!e.shiftKey) {
<svg
submitPrompt(prompt);
xmlns=
"http://www.w3.org/2000/svg"
}
viewBox=
"0 0 20 20"
}}
fill=
"currentColor"
rows="1"
class=
"w-5 h-5"
on:input={(e) => {
>
e.target.style.height = '';
<path
e.target.style.height = Math.min(e.target.scrollHeight, 200) + 2 + 'px';
fill-rule=
"evenodd"
}}
d=
"M15.621 4.379a3 3 0 00-4.242 0l-7 7a3 3 0 004.241 4.243h.001l.497-.5a.75.75 0 011.064 1.057l-.498.501-.002.002a4.5 4.5 0 01-6.364-6.364l7-7a4.5 4.5 0 016.368 6.36l-3.455 3.553A2.625 2.625 0 119.52 9.52l3.45-3.451a.75.75 0 111.061 1.06l-3.45 3.451a1.125 1.125 0 001.587 1.595l3.454-3.553a3 3 0 000-4.242z"
/>
clip-rule=
"evenodd"
/>
</svg>
</button>
</div>
</div>
{/if}
<div
class=
" absolute right-0 bottom-0"
>
{#if fileUploadEnabled}
<div
class=
"pr-2.5 pb-[9px]"
>
<div
class=
" absolute left-0 bottom-0"
>
{#if messages.length == 0 || messages.at(-1).done == true}
<div
class=
"pl-2.5 pb-[9px]"
>
{#if speechRecognitionEnabled}
<button
<button
class=
" text-gray-600 dark:text-gray-
3
00 transition rounded-lg p-1
mr-0
.5"
class=
"
text-gray-600 dark:text-gray-
2
00 transition rounded-lg p-1.5"
type=
"button"
type=
"button"
on:click=
{()
=
>
{
on:click=
{()
=
>
{
speechRecognitionHandler(
);
console.log('file'
);
}}
}}
>
>
{#if speechRecognitionListening}
<svg
<svg
xmlns=
"http://www.w3.org/2000/svg"
class=
" w-5 h-5 translate-y-[0.5px]"
viewBox=
"0 0 20 20"
fill=
"currentColor"
fill=
"currentColor"
viewBox=
"0 0 24 24"
class=
"w-5 h-5"
xmlns=
"http://www.w3.org/2000/svg"
>
><style>
<path
.spinner_qM83
{
fill-rule=
"evenodd"
animation
:
spinner_8HQG
1.05s
infinite
;
d=
"M15.621 4.379a3 3 0 00-4.242 0l-7 7a3 3 0 004.241 4.243h.001l.497-.5a.75.75 0 011.064 1.057l-.498.501-.002.002a4.5 4.5 0 01-6.364-6.364l7-7a4.5 4.5 0 016.368 6.36l-3.455 3.553A2.625 2.625 0 119.52 9.52l3.45-3.451a.75.75 0 111.061 1.06l-3.45 3.451a1.125 1.125 0 001.587 1.595l3.454-3.553a3 3 0 000-4.242z"
}
clip-rule=
"evenodd"
.spinner_oXPr
{
/>
animation-delay
:
0.1s
;
</svg>
}
</button>
.spinner_ZTLf
{
</div>
animation-delay
:
0.2s
;
</div>
}
{/if}
@keyframes
spinner_8HQG
{
0
%,
<div
class=
" absolute right-0 bottom-0"
>
57
.
14
%
{
<div
class=
"pr-2.5 pb-[9px]"
>
animation-timing-function
:
cubic-bezier
(
0.33
,
0.66
,
0.66
,
1
);
{#if messages.length == 0 || messages.at(-1).done == true}
transform
:
translate
(
0
);
{#if speechRecognitionEnabled}
<button
class=
" text-gray-600 dark:text-gray-300 transition rounded-lg p-1 mr-0.5"
type=
"button"
on:click=
{()
=
>
{
speechRecognitionHandler();
}}
>
{#if speechRecognitionListening}
<svg
class=
" w-5 h-5 translate-y-[0.5px]"
fill=
"currentColor"
viewBox=
"0 0 24 24"
xmlns=
"http://www.w3.org/2000/svg"
><style>
.spinner_qM83
{
animation
:
spinner_8HQG
1.05s
infinite
;
}
}
28
.
57
%
{
.spinner_oXPr
{
animation-timing-function
:
cubic-bezier
(
0.33
,
0
,
0.66
,
0.33
);
animation-delay
:
0.1s
;
transform
:
translateY
(
-6px
);
}
}
100
%
{
.spinner_ZTLf
{
transform
:
translate
(
0
)
;
animation-delay
:
0.2s
;
}
}
}
@keyframes
spinner_8HQG
{
</style><circle
class=
"spinner_qM83"
cx=
"4"
cy=
"12"
r=
"2.5"
/><circle
0
%,
class=
"spinner_qM83 spinner_oXPr"
57
.
14
%
{
cx=
"12"
animation-timing-function
:
cubic-bezier
(
0.33
,
0.66
,
0.66
,
1
);
cy=
"12"
transform
:
translate
(
0
);
r=
"2.5"
}
/><circle
28
.
57
%
{
class=
"spinner_qM83 spinner_ZTLf"
animation-timing-function
:
cubic-bezier
(
0.33
,
0
,
0.66
,
0.33
);
cx=
"20"
transform
:
translateY
(
-6px
);
cy=
"12"
}
r=
"2.5"
100
%
{
/></svg
transform
:
translate
(
0
);
>
}
{:else}
}
<svg
</style><circle
class=
"spinner_qM83"
cx=
"4"
cy=
"12"
r=
"2.5"
/><circle
xmlns=
"http://www.w3.org/2000/svg"
class=
"spinner_qM83 spinner_oXPr"
viewBox=
"0 0 20 20"
cx=
"12"
fill=
"currentColor"
cy=
"12"
class=
"w-5 h-5 translate-y-[0.5px]"
r=
"2.5"
>
/><circle
<path
d=
"M7 4a3 3 0 016 0v6a3 3 0 11-6 0V4z"
/>
class=
"spinner_qM83 spinner_ZTLf"
<path
cx=
"20"
d=
"M5.5 9.643a.75.75 0 00-1.5 0V10c0 3.06 2.29 5.585 5.25 5.954V17.5h-1.5a.75.75 0 000 1.5h4.5a.75.75 0 000-1.5h-1.5v-1.546A6.001 6.001 0 0016 10v-.357a.75.75 0 00-1.5 0V10a4.5 4.5 0 01-9 0v-.357z"
cy=
"12"
/>
r=
"2.5"
</svg>
/></svg
{/if}
>
</button>
{:else}
{/if}
<svg
<button
xmlns=
"http://www.w3.org/2000/svg"
class=
"{prompt !== ''
viewBox=
"0 0 20 20"
? 'bg-black text-white hover:bg-gray-900 dark:bg-white dark:text-black dark:hover:bg-gray-100 '
fill=
"currentColor"
: 'text-white bg-gray-100 dark:text-gray-800 dark:bg-gray-600 disabled'} transition rounded-lg p-1"
class=
"w-5 h-5 translate-y-[0.5px]"
type=
"submit"
>
disabled=
{prompt
===
''}
<path
d=
"M7 4a3 3 0 016 0v6a3 3 0 11-6 0V4z"
/>
>
<path
<svg
d=
"M5.5 9.643a.75.75 0 00-1.5 0V10c0 3.06 2.29 5.585 5.25 5.954V17.5h-1.5a.75.75 0 000 1.5h4.5a.75.75 0 000-1.5h-1.5v-1.546A6.001 6.001 0 0016 10v-.357a.75.75 0 00-1.5 0V10a4.5 4.5 0 01-9 0v-.357z"
xmlns=
"http://www.w3.org/2000/svg"
/>
viewBox=
"0 0 20 20"
</svg>
fill=
"currentColor"
{/if}
class=
"w-5 h-5"
</button>
{/if}
<button
class=
"{prompt !== ''
? 'bg-black text-white hover:bg-gray-900 dark:bg-white dark:text-black dark:hover:bg-gray-100 '
: 'text-white bg-gray-100 dark:text-gray-800 dark:bg-gray-600 disabled'} transition rounded-lg p-1"
type=
"submit"
disabled=
{prompt
===
''}
>
>
<
path
<
svg
fill-rule=
"evenodd
"
xmlns=
"http://www.w3.org/2000/svg
"
d=
"M10 17a.75.75 0 01-.75-.75V5.612L5.29 9.77a.75.75 0 01-1.08-1.04l5.25-5.5a.75.75 0 011.08 0l5.25 5.5a.75.75 0 11-1.08 1.04l-3.96-4.158V16.25A.75.75 0 0110 17z
"
viewBox=
"0 0 20 20
"
clip-rule=
"evenodd
"
fill=
"currentColor
"
/>
class=
"w-5 h-5"
</svg
>
>
</button>
<path
{:else}
fill-rule=
"evenodd"
<button
d=
"M10 17a.75.75 0 01-.75-.75V5.612L5.29 9.77a.75.75 0 01-1.08-1.04l5.25-5.5a.75.75 0 011.08 0l5.25 5.5a.75.75 0 11-1.08 1.04l-3.96-4.158V16.25A.75.75 0 0110 17z"
class=
"bg-white hover:bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-white dark:hover:bg-gray-800 transition rounded-lg p-1.5
"
clip-rule=
"evenodd
"
on:click=
{stopResponse}
/>
>
</svg
>
<
svg
<
/button>
xmlns=
"http://www.w3.org/2000/svg"
{:else}
viewBox=
"0 0 24 24"
<button
fill=
"currentColor
"
class=
"bg-white hover:bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-white dark:hover:bg-gray-800 transition rounded-lg p-1.5
"
class=
"w-5 h-5"
on:click=
{stopResponse}
>
>
<path
<svg
fill-rule=
"evenodd"
xmlns=
"http://www.w3.org/2000/svg"
d=
"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm6-2.438c0-.724.588-1.312 1.313-1.312h4.874c.725 0 1.313.588 1.313 1.313v4.874c0 .725-.588 1.313-1.313 1.313H9.564a1.312 1.312 0 01-1.313-1.313V9.564z"
viewBox=
"0 0 24 24"
clip-rule=
"evenodd"
fill=
"currentColor"
/>
class=
"w-5 h-5"
</svg>
>
</button>
<path
{/if}
fill-rule=
"evenodd"
d=
"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm6-2.438c0-.724.588-1.312 1.313-1.312h4.874c.725 0 1.313.588 1.313 1.313v4.874c0 .725-.588 1.313-1.313 1.313H9.564a1.312 1.312 0 01-1.313-1.313V9.564z"
clip-rule=
"evenodd"
/>
</svg>
</button>
{/if}
</div>
</div>
</div>
</div>
</form>
</form>
<div
class=
"mt-1.5 text-xs text-gray-500 text-center"
>
<div
class=
"mt-1.5 text-xs text-gray-500 text-center"
>
LLMs can make mistakes. Verify important information.
LLMs can make mistakes. Verify important information.
</div>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment