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
8461b92f
Commit
8461b92f
authored
Mar 01, 2024
by
Jannik Streidl
Browse files
show chat in browser title + scroll to bottom
parent
5745b9c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
src/routes/(app)/+page.svelte
src/routes/(app)/+page.svelte
+15
-1
src/routes/(app)/c/[id]/+page.svelte
src/routes/(app)/c/[id]/+page.svelte
+14
-0
No files found.
src/routes/(app)/+page.svelte
View file @
8461b92f
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
chats
,
chats
,
chatId
,
chatId
,
config
,
config
,
WEBUI_NAME
,
tags
as
_tags
tags
as
_tags
}
from
'$lib/stores'
;
}
from
'$lib/stores'
;
import
{
copyToClipboard
,
splitStream
}
from
'$lib/utils'
;
import
{
copyToClipboard
,
splitStream
}
from
'$lib/utils'
;
...
@@ -38,7 +39,6 @@
...
@@ -38,7 +39,6 @@
import
{
RAGTemplate
}
from
'$lib/utils/rag'
;
import
{
RAGTemplate
}
from
'$lib/utils/rag'
;
import
{
LITELLM_API_BASE_URL
,
OPENAI_API_BASE_URL
}
from
'$lib/constants'
;
import
{
LITELLM_API_BASE_URL
,
OPENAI_API_BASE_URL
}
from
'$lib/constants'
;
import
{
WEBUI_BASE_URL
}
from
'$lib/constants'
;
import
{
WEBUI_BASE_URL
}
from
'$lib/constants'
;
let
stopResponseFlag
=
false
;
let
stopResponseFlag
=
false
;
let
autoScroll
=
true
;
let
autoScroll
=
true
;
let
processing
=
''
;
let
processing
=
''
;
...
@@ -69,6 +69,7 @@
...
@@ -69,6 +69,7 @@
let
tags
=
[];
let
tags
=
[];
let
title
=
''
;
let
title
=
''
;
let
pageTitle
=
WEBUI_NAME
;
let
prompt
=
''
;
let
prompt
=
''
;
let
files
=
[];
let
files
=
[];
let
messages
=
[];
let
messages
=
[];
...
@@ -77,6 +78,13 @@
...
@@ -77,6 +78,13 @@
currentId
:
null
currentId
:
null
};
};
$:
if
(
title
)
{
const
trimmedTitle
=
title
.
length
>
30
?
`${
title
.
slice
(
0
,
30
)}...`
:
title
;
pageTitle
=
`${
trimmedTitle
}
|
${$
WEBUI_NAME
}`;
}
else
{
pageTitle
=
$
WEBUI_NAME
;
}
$:
if
(
history
.
currentId
!== null) {
$:
if
(
history
.
currentId
!== null) {
let
_messages
=
[];
let
_messages
=
[];
...
@@ -809,6 +817,12 @@
...
@@ -809,6 +817,12 @@
};
};
</
script
>
</
script
>
<
svelte
:
head
>
<
title
>
{
pageTitle
}
</
title
>
</
svelte
:
head
>
<
div
class
=
"h-screen max-h-[100dvh] w-full flex flex-col"
>
<
div
class
=
"h-screen max-h-[100dvh] w-full flex flex-col"
>
<
Navbar
{
title
}
shareEnabled
={
messages
.
length
>
0
}
{
initNewChat
}
{
tags
}
{
addTag
}
{
deleteTag
}
/>
<
Navbar
{
title
}
shareEnabled
={
messages
.
length
>
0
}
{
initNewChat
}
{
tags
}
{
addTag
}
{
deleteTag
}
/>
<
div
class
=
"flex flex-col flex-auto"
>
<
div
class
=
"flex flex-col flex-auto"
>
...
...
src/routes/(app)/c/[id]/+page.svelte
View file @
8461b92f
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
chats
,
chats
,
chatId
,
chatId
,
config
,
config
,
WEBUI_NAME
,
tags
as
_tags
tags
as
_tags
}
from
'$lib/stores'
;
}
from
'$lib/stores'
;
import
{
copyToClipboard
,
splitStream
,
convertMessagesToHistory
}
from
'$lib/utils'
;
import
{
copyToClipboard
,
splitStream
,
convertMessagesToHistory
}
from
'$lib/utils'
;
...
@@ -71,6 +72,7 @@
...
@@ -71,6 +72,7 @@
let
tags
=
[];
let
tags
=
[];
let
title
=
''
;
let
title
=
''
;
let
pageTitle
=
WEBUI_NAME
;
let
prompt
=
''
;
let
prompt
=
''
;
let
files
=
[];
let
files
=
[];
...
@@ -80,6 +82,13 @@
...
@@ -80,6 +82,13 @@
currentId
:
null
currentId
:
null
};
};
$:
if
(
title
)
{
const
trimmedTitle
=
title
.
length
>
30
?
`${
title
.
slice
(
0
,
30
)}...`
:
title
;
pageTitle
=
`${
trimmedTitle
}
|
${$
WEBUI_NAME
}`;
}
else
{
pageTitle
=
$
WEBUI_NAME
;
}
$:
if
(
history
.
currentId
!== null) {
$:
if
(
history
.
currentId
!== null) {
let
_messages
=
[];
let
_messages
=
[];
...
@@ -100,6 +109,7 @@
...
@@ -100,6 +109,7 @@
await
tick
();
await
tick
();
loaded
=
true
;
loaded
=
true
;
window
.
setTimeout
(()
=>
scrollToBottom
(),
0
);
const
chatInput
=
document
.
getElementById
(
'chat-textarea'
);
const
chatInput
=
document
.
getElementById
(
'chat-textarea'
);
chatInput
?.
focus
();
chatInput
?.
focus
();
}
else
{
}
else
{
...
@@ -823,6 +833,10 @@
...
@@ -823,6 +833,10 @@
});
});
</
script
>
</
script
>
<
svelte
:
head
>
<
title
>{
pageTitle
}</
title
>
</
svelte
:
head
>
{#
if
loaded
}
{#
if
loaded
}
<
div
class
=
"min-h-screen max-h-screen w-full flex flex-col"
>
<
div
class
=
"min-h-screen max-h-screen w-full flex flex-col"
>
<
Navbar
<
Navbar
...
...
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