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
f347d664
Unverified
Commit
f347d664
authored
Feb 27, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Feb 27, 2024
Browse files
Merge pull request #941 from jannikstdl/autofocus-chat
fix: added focus selector
parents
8f2d5809
260a8b8b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
8 deletions
+16
-8
src/lib/components/chat/MessageInput.svelte
src/lib/components/chat/MessageInput.svelte
+3
-0
src/lib/components/layout/Sidebar.svelte
src/lib/components/layout/Sidebar.svelte
+7
-8
src/routes/(app)/+page.svelte
src/routes/(app)/+page.svelte
+3
-0
src/routes/(app)/c/[id]/+page.svelte
src/routes/(app)/c/[id]/+page.svelte
+3
-0
No files found.
src/lib/components/chat/MessageInput.svelte
View file @
f347d664
...
@@ -293,6 +293,9 @@
...
@@ -293,6 +293,9 @@
};
};
onMount(() => {
onMount(() => {
const chatInput = document.getElementById('chat-textarea');
window.setTimeout(() => chatInput?.focus(), 0);
const dropZone = document.querySelector('body');
const dropZone = document.querySelector('body');
const onDragOver = (e) => {
const onDragOver = (e) => {
...
...
src/lib/components/layout/Sidebar.svelte
View file @
f347d664
...
@@ -102,17 +102,16 @@
...
@@ -102,17 +102,16 @@
: 'invisible'}"
: 'invisible'}"
>
>
<div class="px-2 flex justify-center space-x-2">
<div class="px-2 flex justify-center space-x-2">
<
button
<
a
id="sidebar-new-chat-button"
id="sidebar-new-chat-button"
class="flex-grow flex justify-between rounded-xl px-3.5 py-2 hover:bg-gray-900 transition"
class="flex-grow flex justify-between rounded-xl px-3.5 py-2 hover:bg-gray-900 transition"
href="/"
on:click={async () => {
on:click={async () => {
goto('/');
await goto('/');
const newChatButton = document.getElementById('new-chat-button');
const newChatButton = document.getElementById('new-chat-button');
setTimeout(() => {
if (newChatButton) {
newChatButton?.click();
newChatButton.click();
}, 0);
}
}}
}}
>
>
<div class="flex self-center">
<div class="flex self-center">
...
@@ -142,7 +141,7 @@
...
@@ -142,7 +141,7 @@
/>
/>
</svg>
</svg>
</div>
</div>
</
button
>
</
a
>
</div>
</div>
{#if $user?.role === 'admin'}
{#if $user?.role === 'admin'}
...
...
src/routes/(app)/+page.svelte
View file @
f347d664
...
@@ -134,6 +134,9 @@
...
@@ -134,6 +134,9 @@
settings
.
set
({
settings
.
set
({
...
_settings
...
_settings
});
});
const
chatInput
=
document
.
getElementById
(
'chat-textarea'
);
setTimeout
(()
=>
chatInput
?.
focus
(),
0
);
};
};
const
scrollToBottom
=
()
=>
{
const
scrollToBottom
=
()
=>
{
...
...
src/routes/(app)/c/[id]/+page.svelte
View file @
f347d664
...
@@ -99,6 +99,9 @@
...
@@ -99,6 +99,9 @@
if
(
await
loadChat
())
{
if
(
await
loadChat
())
{
await
tick
();
await
tick
();
loaded
=
true
;
loaded
=
true
;
const
chatInput
=
document
.
getElementById
(
'chat-textarea'
);
chatInput
?.
focus
();
}
else
{
}
else
{
await
goto
(
'/'
);
await
goto
(
'/'
);
}
}
...
...
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