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
4bf38e52
"...git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "83107c8ea52983c9582ea13d2de0a151e32abe8e"
Commit
4bf38e52
authored
Mar 28, 2024
by
Ased Mammad
Browse files
feat: Add autocomplete to chat tags
parent
c42cb438
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
src/lib/components/common/Tags/TagInput.svelte
src/lib/components/common/Tags/TagInput.svelte
+19
-10
No files found.
src/lib/components/common/Tags/TagInput.svelte
View file @
4bf38e52
<script lang="ts">
<script lang="ts">
import { createEventDispatcher, getContext } from 'svelte';
import { createEventDispatcher, getContext } from 'svelte';
import { tags } from '$lib/stores';
const dispatch = createEventDispatcher();
const dispatch = createEventDispatcher();
const i18n = getContext('i18n');
const i18n = getContext('i18n');
let showTagInput = false;
let showTagInput = false;
let tagName = '';
let tagName = '';
const addTagHandler = async () => {
dispatch('add', tagName);
tagName = '';
showTagInput = false;
};
</script>
</script>
<div class="flex space-x-1 pl-1.5">
<div class="flex space-x-1 pl-1.5">
{#if showTagInput}
{#if showTagInput}
<div class="flex items-center">
<div class="flex items-center">
<button
<button type="button" on:click={addTagHandler}>
type="button"
on:click={() => {
dispatch('add', tagName);
tagName = '';
showTagInput = false;
}}
>
<svg
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16"
viewBox="0 0 16 16"
...
@@ -36,10 +36,19 @@
...
@@ -36,10 +36,19 @@
bind:value={tagName}
bind:value={tagName}
class=" pl-2 cursor-pointer self-center text-xs h-fit bg-transparent outline-none line-clamp-1 w-[8rem]"
class=" pl-2 cursor-pointer self-center text-xs h-fit bg-transparent outline-none line-clamp-1 w-[8rem]"
placeholder={$i18n.t('Add a tag')}
placeholder={$i18n.t('Add a tag')}
list="tagOptions"
on:keydown={(event) => {
if (event.key === 'Enter') {
addTagHandler();
}
}}
/>
/>
<datalist id="tagOptions">
{#each $tags as tag}
<option value={tag.name} />
{/each}
</datalist>
</div>
</div>
<!-- TODO: Tag Suggestions -->
{/if}
{/if}
<button
<button
...
...
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