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
0def6f87
Commit
0def6f87
authored
Mar 03, 2024
by
Carlos Daniel Vilaseca
Browse files
rf: dom queries in ChatCompletion component
parent
15e0f9de
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
src/lib/components/playground/ChatCompletion.svelte
src/lib/components/playground/ChatCompletion.svelte
+6
-6
No files found.
src/lib/components/playground/ChatCompletion.svelte
View file @
0def6f87
...
...
@@ -2,10 +2,9 @@
import { onMount } from 'svelte';
export let messages = [];
let textareaElement: HTMLTextAreaElement;
onMount(() => {
messages.forEach((message, idx) => {
let textareaElement = document.getElementById(`${message.role}-${idx}-textarea`);
textareaElement.style.height = '';
textareaElement.style.height = textareaElement.scrollHeight + 'px';
});
...
...
@@ -27,16 +26,17 @@
<div class="flex-1">
<textarea
id="{message.role}-{idx}-textarea"
bind:this={textareaElement}
class="w-full bg-transparent outline-none rounded-lg p-2 text-sm resize-none overflow-hidden"
placeholder="Enter {message.role === 'user' ? 'a user' : 'an assistant'} message here"
rows="1"
on:input={(e) => {
e.targe
t.style.height = '';
e.targe
t.style.height =
e.targe
t.scrollHeight + 'px';
textareaElemen
t.style.height = '';
textareaElemen
t.style.height =
textareaElemen
t.scrollHeight + 'px';
}}
on:focus={(e) => {
e.targe
t.style.height = '';
e.targe
t.style.height =
e.targe
t.scrollHeight + 'px';
textareaElemen
t.style.height = '';
textareaElemen
t.style.height =
textareaElemen
t.scrollHeight + 'px';
// e.target.style.height = Math.min(e.target.scrollHeight, 200) + 'px';
}}
...
...
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