From be3ab88c88b120bdf144b7ab56c95799ad4e6867 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 12 Mar 2024 00:26:14 -0700 Subject: [PATCH 01/14] fix: error handling --- backend/apps/ollama/main.py | 17 +++++++++++++---- backend/constants.py | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/backend/apps/ollama/main.py b/backend/apps/ollama/main.py index 5ecbaa297..039c570b5 100644 --- a/backend/apps/ollama/main.py +++ b/backend/apps/ollama/main.py @@ -123,6 +123,7 @@ async def get_all_models(): map(lambda response: response["models"], responses) ) } + app.state.MODELS = {model["model"]: model for model in models["models"]} return models @@ -181,11 +182,19 @@ async def get_ollama_versions(url_idx: Optional[int] = None): responses = await asyncio.gather(*tasks) responses = list(filter(lambda x: x is not None, responses)) - lowest_version = min( - responses, key=lambda x: tuple(map(int, x["version"].split("."))) - ) + print(responses) - return {"version": lowest_version["version"]} + if len(responses) > 0: + lowest_version = min( + responses, key=lambda x: tuple(map(int, x["version"].split("."))) + ) + + return {"version": lowest_version["version"]} + else: + raise HTTPException( + status_code=500, + detail=ERROR_MESSAGES.OLLAMA_NOT_FOUND, + ) else: url = app.state.OLLAMA_BASE_URLS[url_idx] try: diff --git a/backend/constants.py b/backend/constants.py index eacf8a20f..05bdebc54 100644 --- a/backend/constants.py +++ b/backend/constants.py @@ -52,3 +52,4 @@ class ERROR_MESSAGES(str, Enum): MODEL_NOT_FOUND = lambda name="": f"Model '{name}' was not found" OPENAI_NOT_FOUND = lambda name="": f"OpenAI API was not found" + OLLAMA_NOT_FOUND = "WebUI could not connect to Ollama" From 26a187f5ac2ebc28849f90127d2b96b6935ae56f Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 12 Mar 2024 00:26:53 -0700 Subject: [PATCH 02/14] refac: print removed --- backend/apps/ollama/main.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/backend/apps/ollama/main.py b/backend/apps/ollama/main.py index 039c570b5..2e236f343 100644 --- a/backend/apps/ollama/main.py +++ b/backend/apps/ollama/main.py @@ -182,8 +182,6 @@ async def get_ollama_versions(url_idx: Optional[int] = None): responses = await asyncio.gather(*tasks) responses = list(filter(lambda x: x is not None, responses)) - print(responses) - if len(responses) > 0: lowest_version = min( responses, key=lambda x: tuple(map(int, x["version"].split("."))) From 97842d037ee537478a345ee53e7c97cc16c83fb3 Mon Sep 17 00:00:00 2001 From: Silentoplayz <50341825+Silentoplayz@users.noreply.github.com> Date: Tue, 12 Mar 2024 05:34:00 -0400 Subject: [PATCH 03/14] Update tailwind.css - Combined font-family declaration: Instead of repeating the font-family declaration for both `html` and `pre`, it's combined into one declaration to save space and avoid repetition. - Removed unnecessary `pre` styling: The `pre` styling for `font-family` is removed as the font-family is already defined in the `html` rule. The code is more concise and easier to read. --- src/tailwind.css | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/tailwind.css b/src/tailwind.css index 60b6b04c4..6c69643d5 100644 --- a/src/tailwind.css +++ b/src/tailwind.css @@ -3,16 +3,13 @@ @tailwind utilities; @layer base { - html { - font-family: -apple-system, 'Arimo', ui-sans-serif, system-ui, 'Segoe UI', Roboto, Ubuntu, - Cantarell, 'Noto Sans', sans-serif, 'Helvetica Neue', Arial, 'Apple Color Emoji', - 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; - } + html, pre { + font-family: -apple-system, 'Arimo', ui-sans-serif, system-ui, 'Segoe UI', Roboto, Ubuntu, + Cantarell, 'Noto Sans', sans-serif, 'Helvetica Neue', Arial, 'Apple Color Emoji', + 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; + } - pre { - font-family: -apple-system, 'Arimo', ui-sans-serif, system-ui, 'Segoe UI', Roboto, Ubuntu, - Cantarell, 'Noto Sans', sans-serif, 'Helvetica Neue', Arial, 'Apple Color Emoji', - 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; - white-space: pre-wrap; - } + pre { + white-space: pre-wrap; + } } From cc4b82a3f3df323d3103341c1533a24661b841b0 Mon Sep 17 00:00:00 2001 From: Silentoplayz <50341825+Silentoplayz@users.noreply.github.com> Date: Tue, 12 Mar 2024 06:08:03 -0400 Subject: [PATCH 04/14] Update tailwind.css Fix spacing --- src/tailwind.css | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tailwind.css b/src/tailwind.css index 6c69643d5..10aca3482 100644 --- a/src/tailwind.css +++ b/src/tailwind.css @@ -3,11 +3,11 @@ @tailwind utilities; @layer base { - html, pre { - font-family: -apple-system, 'Arimo', ui-sans-serif, system-ui, 'Segoe UI', Roboto, Ubuntu, - Cantarell, 'Noto Sans', sans-serif, 'Helvetica Neue', Arial, 'Apple Color Emoji', - 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; - } + html, pre { + font-family: -apple-system, 'Arimo', ui-sans-serif, system-ui, 'Segoe UI', Roboto, Ubuntu, + Cantarell, 'Noto Sans', sans-serif, 'Helvetica Neue', Arial, 'Apple Color Emoji', + 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; + } pre { white-space: pre-wrap; From 7f78e584883994c7b8bb12d0d8ec88289074def7 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 12 Mar 2024 13:35:30 -0700 Subject: [PATCH 05/14] refac: image generation error handling --- backend/apps/images/main.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/backend/apps/images/main.py b/backend/apps/images/main.py index 31bfc0f5d..e14b0f6a7 100644 --- a/backend/apps/images/main.py +++ b/backend/apps/images/main.py @@ -293,6 +293,7 @@ def generate_image( "size": form_data.size if form_data.size else app.state.IMAGE_SIZE, "response_format": "b64_json", } + r = requests.post( url=f"https://api.openai.com/v1/images/generations", json=data, @@ -300,7 +301,6 @@ def generate_image( ) r.raise_for_status() - res = r.json() images = [] @@ -356,7 +356,10 @@ def generate_image( return images except Exception as e: - print(e) - if r: - print(r.json()) - raise HTTPException(status_code=400, detail=ERROR_MESSAGES.DEFAULT(e)) + error = e + + if r != None: + data = r.json() + if "error" in data: + error = data["error"]["message"] + raise HTTPException(status_code=400, detail=ERROR_MESSAGES.DEFAULT(error)) From 5a567ce4d0cd2fe65316000f935764d4e63a4c4b Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 12 Mar 2024 13:43:49 -0700 Subject: [PATCH 06/14] fix: message after image generation --- src/routes/(app)/+page.svelte | 5 +++-- src/routes/(app)/c/[id]/+page.svelte | 12 +++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/routes/(app)/+page.svelte b/src/routes/(app)/+page.svelte index 07fcc1768..924d0c5bd 100644 --- a/src/routes/(app)/+page.svelte +++ b/src/routes/(app)/+page.svelte @@ -308,7 +308,7 @@ .map((file) => file.url.slice(file.url.indexOf(',') + 1)); // Add images array only if it contains elements - if (imageUrls && imageUrls.length > 0) { + if (imageUrls && imageUrls.length > 0 && message.role === 'user') { baseMessage.images = imageUrls; } @@ -532,7 +532,8 @@ .filter((message) => message) .map((message, idx, arr) => ({ role: message.role, - ...(message.files?.filter((file) => file.type === 'image').length > 0 ?? false + ...((message.files?.filter((file) => file.type === 'image').length > 0 ?? false) && + message.role === 'user' ? { content: [ { diff --git a/src/routes/(app)/c/[id]/+page.svelte b/src/routes/(app)/c/[id]/+page.svelte index 4bc6acfa2..56bd2f89b 100644 --- a/src/routes/(app)/c/[id]/+page.svelte +++ b/src/routes/(app)/c/[id]/+page.svelte @@ -321,7 +321,7 @@ .map((file) => file.url.slice(file.url.indexOf(',') + 1)); // Add images array only if it contains elements - if (imageUrls && imageUrls.length > 0) { + if (imageUrls && imageUrls.length > 0 && message.role === 'user') { baseMessage.images = imageUrls; } @@ -545,7 +545,8 @@ .filter((message) => message) .map((message, idx, arr) => ({ role: message.role, - ...(message.files?.filter((file) => file.type === 'image').length > 0 ?? false + ...((message.files?.filter((file) => file.type === 'image').length > 0 ?? false) && + message.role === 'user' ? { content: [ { @@ -688,7 +689,12 @@ if (messages.length == 2) { window.history.replaceState(history.state, '', `/c/${_chatId}`); - await setChatTitle(_chatId, userPrompt); + + if ($settings?.titleAutoGenerateModel) { + await generateChatTitle(_chatId, userPrompt); + } else { + await setChatTitle(_chatId, userPrompt); + } } }; From 3790790a18f565f64df090ba911e3f04781fa332 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 12 Mar 2024 13:47:49 -0700 Subject: [PATCH 07/14] fix: possible fix for #1139 --- src/routes/(app)/+page.svelte | 4 +++- src/routes/(app)/c/[id]/+page.svelte | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/routes/(app)/+page.svelte b/src/routes/(app)/+page.svelte index 924d0c5bd..926681b14 100644 --- a/src/routes/(app)/+page.svelte +++ b/src/routes/(app)/+page.svelte @@ -140,7 +140,9 @@ }; const scrollToBottom = () => { - messagesContainerElement.scrollTop = messagesContainerElement.scrollHeight; + if (messagesContainerElement) { + messagesContainerElement.scrollTop = messagesContainerElement.scrollHeight; + } }; ////////////////////////// diff --git a/src/routes/(app)/c/[id]/+page.svelte b/src/routes/(app)/c/[id]/+page.svelte index 56bd2f89b..081dac761 100644 --- a/src/routes/(app)/c/[id]/+page.svelte +++ b/src/routes/(app)/c/[id]/+page.svelte @@ -160,7 +160,9 @@ }; const scrollToBottom = () => { - messagesContainerElement.scrollTop = messagesContainerElement.scrollHeight; + if (messagesContainerElement) { + messagesContainerElement.scrollTop = messagesContainerElement.scrollHeight; + } }; ////////////////////////// From 9ee0feae3249644327b0f350c4af04319a2f5764 Mon Sep 17 00:00:00 2001 From: Joseph C Wang Date: Thu, 14 Mar 2024 17:17:52 +0800 Subject: [PATCH 08/14] fix typo in uploading blob to ollama --- backend/apps/web/routers/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/apps/web/routers/utils.py b/backend/apps/web/routers/utils.py index fbb350cf2..0d34b0405 100644 --- a/backend/apps/web/routers/utils.py +++ b/backend/apps/web/routers/utils.py @@ -75,7 +75,7 @@ async def download_file_stream(url, file_path, file_name, chunk_size=1024 * 1024 hashed = calculate_sha256(file) file.seek(0) - url = f"{OLLAMA_BASE_URLS[0]}/blobs/sha256:{hashed}" + url = f"{OLLAMA_BASE_URLS[0]}/api/blobs/sha256:{hashed}" response = requests.post(url, data=file) if response.ok: From cd92cf0da5302bf3bc7694866e76b811f35b1ab0 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Fri, 15 Mar 2024 02:40:44 -0700 Subject: [PATCH 09/14] fix: image settings save issue --- src/lib/components/chat/Settings/Images.svelte | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/components/chat/Settings/Images.svelte b/src/lib/components/chat/Settings/Images.svelte index a6463691f..8f75c0c92 100644 --- a/src/lib/components/chat/Settings/Images.svelte +++ b/src/lib/components/chat/Settings/Images.svelte @@ -116,11 +116,13 @@ class="flex flex-col h-full justify-between space-y-3 text-sm" on:submit|preventDefault={async () => { loading = true; - await updateOpenAIKey(localStorage.token, OPENAI_API_KEY); + + if (imageGenerationEngine === 'openai') { + await updateOpenAIKey(localStorage.token, OPENAI_API_KEY); + } await updateDefaultImageGenerationModel(localStorage.token, selectedModel); - await updateDefaultImageGenerationModel(localStorage.token, selectedModel); await updateImageSize(localStorage.token, imageSize).catch((error) => { toast.error(error); return null; From 072b499a50a8ec2387b5215e27afb3b3fe3b8123 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Fri, 15 Mar 2024 13:34:52 -0700 Subject: [PATCH 10/14] fix: backslash rag content issue --- backend/apps/rag/utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/apps/rag/utils.py b/backend/apps/rag/utils.py index b2da7d90c..a3537d4d3 100644 --- a/backend/apps/rag/utils.py +++ b/backend/apps/rag/utils.py @@ -91,9 +91,8 @@ def query_collection( def rag_template(template: str, context: str, query: str): - template = re.sub(r"\[context\]", context, template) - template = re.sub(r"\[query\]", query, template) - + template = template.replace("[context]", context) + template = template.replace("[query]", query) return template From 51ef5cfa45b8595ed3130d8da82751bdb1716a6c Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Fri, 15 Mar 2024 13:46:43 -0700 Subject: [PATCH 11/14] doc: changelog --- CHANGELOG.md | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d57ba400c..638417b98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.112] - 2024-03-15 + +### Fixed + +- 🗨️ Resolved chat malfunction after image generation. +- 🎨 Fixed various RAG issues. +- 🧪 Rectified experimental broken GGUF upload logic. + ## [0.1.111] - 2024-03-10 ### Added diff --git a/package.json b/package.json index 572443a54..d7be99999 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "open-webui", - "version": "0.1.111", + "version": "0.1.112", "private": true, "scripts": { "dev": "vite dev --host", From 91efd6cb636bb2836c8cff78221f538104d0216f Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Fri, 15 Mar 2024 23:52:37 -0700 Subject: [PATCH 12/14] fix: file upload encoding issue --- backend/apps/rag/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/apps/rag/main.py b/backend/apps/rag/main.py index b21724cc9..5fc38b4a8 100644 --- a/backend/apps/rag/main.py +++ b/backend/apps/rag/main.py @@ -400,9 +400,9 @@ def get_loader(filename: str, file_content_type: str, file_path: str): elif file_ext in known_source_ext or ( file_content_type and file_content_type.find("text/") >= 0 ): - loader = TextLoader(file_path) + loader = TextLoader(file_path, autodetect_encoding=True) else: - loader = TextLoader(file_path) + loader = TextLoader(file_path, autodetect_encoding=True) known_type = False return loader, known_type From d6905d6297fe0861ccdf47a73e8a09a3162b9f30 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 16 Mar 2024 00:27:29 -0700 Subject: [PATCH 13/14] feat: sidebar ui update --- src/lib/components/layout/Sidebar.svelte | 287 +++++++++++------------ 1 file changed, 143 insertions(+), 144 deletions(-) diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte index 40de5c66a..014dfcf6d 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/Sidebar.svelte @@ -82,7 +82,10 @@ }); if (res) { - goto('/'); + if ($chatId === id) { + goto('/'); + } + await chats.set(await getChatList(localStorage.token)); } }; @@ -370,22 +373,22 @@ return title.includes(query) || contentMatches; } }) as chat, i} -
+
{#if chatTitleEditId === chat.id}
{:else} { if (window.innerWidth < 1024) { @@ -395,156 +398,152 @@ draggable="false" >
-
+
{chat.title}
{/if} - {#if chat.id === $chatId} -
- {#if chatTitleEditId === chat.id} -
- - + -
- {:else if chatDeleteId === chat.id} -
- +
+ {:else if chatDeleteId === chat.id} +
+ - + -
- {:else} -
- +
+ {:else} +
+ - + -
- {/if} -
- {/if} + + + +
+ {/if} +
{/each} From 71def5c4cb6632e8c32065353b64906f74bc0c55 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 16 Mar 2024 01:57:26 -0700 Subject: [PATCH 14/14] feat: sidebar ui update --- package-lock.json | 265 +++++++++++++++--- package.json | 3 +- src/lib/components/common/Dropdown.svelte | 30 ++ src/lib/components/icons/GarbageBin.svelte | 19 ++ src/lib/components/icons/Pencil.svelte | 19 ++ src/lib/components/layout/Sidebar.svelte | 94 +++---- .../components/layout/Sidebar/ChatMenu.svelte | 43 +++ 7 files changed, 390 insertions(+), 83 deletions(-) create mode 100644 src/lib/components/common/Dropdown.svelte create mode 100644 src/lib/components/icons/GarbageBin.svelte create mode 100644 src/lib/components/icons/Pencil.svelte create mode 100644 src/lib/components/layout/Sidebar/ChatMenu.svelte diff --git a/package-lock.json b/package-lock.json index 43deeace9..d95224dea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,16 @@ { "name": "open-webui", - "version": "0.1.106", + "version": "0.1.112", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "open-webui", - "version": "0.1.106", + "version": "0.1.112", "dependencies": { "@sveltejs/adapter-node": "^1.3.1", "async": "^3.2.5", + "bits-ui": "^0.19.7", "dayjs": "^1.11.10", "file-saver": "^2.0.5", "highlight.js": "^11.9.0", @@ -150,13 +151,35 @@ } }, "node_modules/@fastify/busboy": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.0.0.tgz", - "integrity": "sha512-JUFJad5lv7jxj926GPgymrWQxxjPYuJNiNjNMzqT+HiuP6Vl3dk5xzG+8sTX96np0ZAluvaMzPsjhHZ5rNuNQQ==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", "engines": { "node": ">=14" } }, + "node_modules/@floating-ui/core": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.0.tgz", + "integrity": "sha512-PcF++MykgmTj3CIyOQbKA/hDzOAiqI3mhuoN44WRCopIs1sgoDoU4oty4Jtqaj/y3oDU6fnVSm4QG0a3t5i0+g==", + "dependencies": { + "@floating-ui/utils": "^0.2.1" + } + }, + "node_modules/@floating-ui/dom": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.6.3.tgz", + "integrity": "sha512-RnDthu3mzPlQ31Ss/BTwQ1zjzIhr3lk1gZB1OC56h/1vEtaXkESrOqL5fQVMfXpwGtRwX+YsZBdyHtJMQnkArw==", + "dependencies": { + "@floating-ui/core": "^1.0.0", + "@floating-ui/utils": "^0.2.0" + } + }, + "node_modules/@floating-ui/utils": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.1.tgz", + "integrity": "sha512-9TANp6GPoMtYzQdt54kfAyMmz1+osLlXdg2ENroU7zzrtflTLrrC/lgrIfaSe+Wu0b89GKccT7vxXA0MoAIO+Q==" + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.13", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", @@ -190,6 +213,14 @@ "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", "dev": true }, + "node_modules/@internationalized/date": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/@internationalized/date/-/date-3.5.2.tgz", + "integrity": "sha512-vo1yOMUt2hzp63IutEaTUxROdvQg1qlMRsbCvbay2AK2Gai7wIgCyK5weEX3nHkiLgo4qCXHijFNC/ILhlRpOQ==", + "dependencies": { + "@swc/helpers": "^0.5.0" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", @@ -233,6 +264,39 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@melt-ui/svelte": { + "version": "0.76.0", + "resolved": "https://registry.npmjs.org/@melt-ui/svelte/-/svelte-0.76.0.tgz", + "integrity": "sha512-X1ktxKujjLjOBt8LBvfckHGDMrkHWceRt1jdsUTf0EH76ikNPP1ofSoiV0IhlduDoCBV+2YchJ8kXCDfDXfC9Q==", + "dependencies": { + "@floating-ui/core": "^1.3.1", + "@floating-ui/dom": "^1.4.5", + "@internationalized/date": "^3.5.0", + "dequal": "^2.0.3", + "focus-trap": "^7.5.2", + "nanoid": "^5.0.4" + }, + "peerDependencies": { + "svelte": ">=3 <5" + } + }, + "node_modules/@melt-ui/svelte/node_modules/nanoid": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.6.tgz", + "integrity": "sha512-rRq0eMHoGZxlvaFOUdK1Ev83Bd1IgzzR+WJ3IbDJ7QOSdAxYjlurSPqFs9s4lJg29RT6nPwizFtJhQS6V5xgiA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.js" + }, + "engines": { + "node": "^18 || >=20" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -472,9 +536,9 @@ } }, "node_modules/@sveltejs/kit": { - "version": "1.30.3", - "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.30.3.tgz", - "integrity": "sha512-0DzVXfU4h+tChFvoc8C61IqErCyskD4ydSIDjpKS2lYlEzIYrtYrY7juSqACFxqcvZAnOEXvSY+zZ8br0+ZMMg==", + "version": "1.30.4", + "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.30.4.tgz", + "integrity": "sha512-JSQIQT6XvdchCRQEm7BABxPC56WP5RYVONAi+09S8tmzeP43fBsRlr95bFmsTQM2RHBldfgQk+jgdnsKI75daA==", "hasInstallScript": true, "dependencies": { "@sveltejs/vite-plugin-svelte": "^2.5.0", @@ -489,7 +553,7 @@ "set-cookie-parser": "^2.6.0", "sirv": "^2.0.2", "tiny-glob": "^0.2.9", - "undici": "~5.26.2" + "undici": "^5.28.3" }, "bin": { "svelte-kit": "svelte-kit.js" @@ -539,6 +603,14 @@ "vite": "^4.0.0" } }, + "node_modules/@swc/helpers": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.6.tgz", + "integrity": "sha512-aYX01Ke9hunpoCexYAgQucEpARGQ5w/cqHFrIR+e9gdKb1QWTsVJuTJ2ozQzIAxLyRQe/m+2RqzkyOOGiMKRQA==", + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@tailwindcss/typography": { "version": "0.5.10", "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.10.tgz", @@ -1001,6 +1073,36 @@ "node": ">=8" } }, + "node_modules/bits-ui": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/bits-ui/-/bits-ui-0.19.7.tgz", + "integrity": "sha512-GHUpKvN7QyazhnZNkUy0lxg6W1M6KJHWSZ4a/UGCjPE6nQgk6vKbGysY67PkDtQMknZTZAzVoMj1Eic4IKeCRQ==", + "dependencies": { + "@internationalized/date": "^3.5.1", + "@melt-ui/svelte": "0.76.0", + "nanoid": "^5.0.5" + }, + "peerDependencies": { + "svelte": "^4.0.0" + } + }, + "node_modules/bits-ui/node_modules/nanoid": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.6.tgz", + "integrity": "sha512-rRq0eMHoGZxlvaFOUdK1Ev83Bd1IgzzR+WJ3IbDJ7QOSdAxYjlurSPqFs9s4lJg29RT6nPwizFtJhQS6V5xgiA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.js" + }, + "engines": { + "node": "^18 || >=20" + } + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1753,6 +1855,14 @@ "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", "dev": true }, + "node_modules/focus-trap": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/focus-trap/-/focus-trap-7.5.4.tgz", + "integrity": "sha512-N7kHdlgsO/v+iD/dMoJKtsSqs5Dz/dXZVebRgJw23LDk+jMi/974zyiOYDziY2JPp8xivq9BmUGwIJMiuSBi7w==", + "dependencies": { + "tabbable": "^6.2.0" + } + }, "node_modules/fraction.js": { "version": "4.3.6", "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.6.tgz", @@ -3304,6 +3414,11 @@ "svelte": ">=3 <5" } }, + "node_modules/tabbable": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz", + "integrity": "sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==" + }, "node_modules/tailwindcss": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.3.tgz", @@ -3464,8 +3579,7 @@ "node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "node_modules/type-check": { "version": "0.4.0", @@ -3505,9 +3619,9 @@ } }, "node_modules/undici": { - "version": "5.26.4", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.26.4.tgz", - "integrity": "sha512-OG+QOf0fTLtazL9P9X7yqWxQ+Z0395Wk6DSkyTxtaq3wQEjIroVe7Y4asCX/vcCxYpNGMnwz8F0qbRYUoaQVMw==", + "version": "5.28.3", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz", + "integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==", "dependencies": { "@fastify/busboy": "^2.0.0" }, @@ -3573,9 +3687,9 @@ } }, "node_modules/vite": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.1.tgz", - "integrity": "sha512-AXXFaAJ8yebyqzoNB9fu2pHoo/nWX+xZlaRwoeYUxEqBO+Zj4msE5G+BhGBll9lYEKv9Hfks52PAF2X7qDYXQA==", + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.2.tgz", + "integrity": "sha512-tBCZBNSBbHQkaGyhGCDUGqeo2ph8Fstyp6FMSvTtsXeZSPpSMGlviAOav2hxVTqFcx8Hj/twtWKsMJXNY0xI8w==", "dependencies": { "esbuild": "^0.18.10", "postcss": "^8.4.27", @@ -3754,9 +3868,31 @@ "dev": true }, "@fastify/busboy": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.0.0.tgz", - "integrity": "sha512-JUFJad5lv7jxj926GPgymrWQxxjPYuJNiNjNMzqT+HiuP6Vl3dk5xzG+8sTX96np0ZAluvaMzPsjhHZ5rNuNQQ==" + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==" + }, + "@floating-ui/core": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.0.tgz", + "integrity": "sha512-PcF++MykgmTj3CIyOQbKA/hDzOAiqI3mhuoN44WRCopIs1sgoDoU4oty4Jtqaj/y3oDU6fnVSm4QG0a3t5i0+g==", + "requires": { + "@floating-ui/utils": "^0.2.1" + } + }, + "@floating-ui/dom": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.6.3.tgz", + "integrity": "sha512-RnDthu3mzPlQ31Ss/BTwQ1zjzIhr3lk1gZB1OC56h/1vEtaXkESrOqL5fQVMfXpwGtRwX+YsZBdyHtJMQnkArw==", + "requires": { + "@floating-ui/core": "^1.0.0", + "@floating-ui/utils": "^0.2.0" + } + }, + "@floating-ui/utils": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.1.tgz", + "integrity": "sha512-9TANp6GPoMtYzQdt54kfAyMmz1+osLlXdg2ENroU7zzrtflTLrrC/lgrIfaSe+Wu0b89GKccT7vxXA0MoAIO+Q==" }, "@humanwhocodes/config-array": { "version": "0.11.13", @@ -3781,6 +3917,14 @@ "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", "dev": true }, + "@internationalized/date": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/@internationalized/date/-/date-3.5.2.tgz", + "integrity": "sha512-vo1yOMUt2hzp63IutEaTUxROdvQg1qlMRsbCvbay2AK2Gai7wIgCyK5weEX3nHkiLgo4qCXHijFNC/ILhlRpOQ==", + "requires": { + "@swc/helpers": "^0.5.0" + } + }, "@jridgewell/gen-mapping": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", @@ -3815,6 +3959,26 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "@melt-ui/svelte": { + "version": "0.76.0", + "resolved": "https://registry.npmjs.org/@melt-ui/svelte/-/svelte-0.76.0.tgz", + "integrity": "sha512-X1ktxKujjLjOBt8LBvfckHGDMrkHWceRt1jdsUTf0EH76ikNPP1ofSoiV0IhlduDoCBV+2YchJ8kXCDfDXfC9Q==", + "requires": { + "@floating-ui/core": "^1.3.1", + "@floating-ui/dom": "^1.4.5", + "@internationalized/date": "^3.5.0", + "dequal": "^2.0.3", + "focus-trap": "^7.5.2", + "nanoid": "^5.0.4" + }, + "dependencies": { + "nanoid": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.6.tgz", + "integrity": "sha512-rRq0eMHoGZxlvaFOUdK1Ev83Bd1IgzzR+WJ3IbDJ7QOSdAxYjlurSPqFs9s4lJg29RT6nPwizFtJhQS6V5xgiA==" + } + } + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -3981,9 +4145,9 @@ "requires": {} }, "@sveltejs/kit": { - "version": "1.30.3", - "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.30.3.tgz", - "integrity": "sha512-0DzVXfU4h+tChFvoc8C61IqErCyskD4ydSIDjpKS2lYlEzIYrtYrY7juSqACFxqcvZAnOEXvSY+zZ8br0+ZMMg==", + "version": "1.30.4", + "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.30.4.tgz", + "integrity": "sha512-JSQIQT6XvdchCRQEm7BABxPC56WP5RYVONAi+09S8tmzeP43fBsRlr95bFmsTQM2RHBldfgQk+jgdnsKI75daA==", "requires": { "@sveltejs/vite-plugin-svelte": "^2.5.0", "@types/cookie": "^0.5.1", @@ -3997,7 +4161,7 @@ "set-cookie-parser": "^2.6.0", "sirv": "^2.0.2", "tiny-glob": "^0.2.9", - "undici": "~5.26.2" + "undici": "^5.28.3" } }, "@sveltejs/vite-plugin-svelte": { @@ -4022,6 +4186,14 @@ "debug": "^4.3.4" } }, + "@swc/helpers": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.6.tgz", + "integrity": "sha512-aYX01Ke9hunpoCexYAgQucEpARGQ5w/cqHFrIR+e9gdKb1QWTsVJuTJ2ozQzIAxLyRQe/m+2RqzkyOOGiMKRQA==", + "requires": { + "tslib": "^2.4.0" + } + }, "@tailwindcss/typography": { "version": "0.5.10", "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.10.tgz", @@ -4334,6 +4506,23 @@ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, + "bits-ui": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/bits-ui/-/bits-ui-0.19.7.tgz", + "integrity": "sha512-GHUpKvN7QyazhnZNkUy0lxg6W1M6KJHWSZ4a/UGCjPE6nQgk6vKbGysY67PkDtQMknZTZAzVoMj1Eic4IKeCRQ==", + "requires": { + "@internationalized/date": "^3.5.1", + "@melt-ui/svelte": "0.76.0", + "nanoid": "^5.0.5" + }, + "dependencies": { + "nanoid": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.6.tgz", + "integrity": "sha512-rRq0eMHoGZxlvaFOUdK1Ev83Bd1IgzzR+WJ3IbDJ7QOSdAxYjlurSPqFs9s4lJg29RT6nPwizFtJhQS6V5xgiA==" + } + } + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -4878,6 +5067,14 @@ "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", "dev": true }, + "focus-trap": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/focus-trap/-/focus-trap-7.5.4.tgz", + "integrity": "sha512-N7kHdlgsO/v+iD/dMoJKtsSqs5Dz/dXZVebRgJw23LDk+jMi/974zyiOYDziY2JPp8xivq9BmUGwIJMiuSBi7w==", + "requires": { + "tabbable": "^6.2.0" + } + }, "fraction.js": { "version": "4.3.6", "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.6.tgz", @@ -5904,6 +6101,11 @@ "integrity": "sha512-jpPOgLtHwRaB6Vqo2dUQMv15/yUV/BQWTjKpEqQ11uqRSHKjAYUKZyGrHB2cQsGmyjR0JUzBD58btpgNqINQ/Q==", "requires": {} }, + "tabbable": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz", + "integrity": "sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==" + }, "tailwindcss": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.3.tgz", @@ -6023,8 +6225,7 @@ "tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "type-check": { "version": "0.4.0", @@ -6048,9 +6249,9 @@ "dev": true }, "undici": { - "version": "5.26.4", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.26.4.tgz", - "integrity": "sha512-OG+QOf0fTLtazL9P9X7yqWxQ+Z0395Wk6DSkyTxtaq3wQEjIroVe7Y4asCX/vcCxYpNGMnwz8F0qbRYUoaQVMw==", + "version": "5.28.3", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz", + "integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==", "requires": { "@fastify/busboy": "^2.0.0" } @@ -6086,9 +6287,9 @@ "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==" }, "vite": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.1.tgz", - "integrity": "sha512-AXXFaAJ8yebyqzoNB9fu2pHoo/nWX+xZlaRwoeYUxEqBO+Zj4msE5G+BhGBll9lYEKv9Hfks52PAF2X7qDYXQA==", + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.2.tgz", + "integrity": "sha512-tBCZBNSBbHQkaGyhGCDUGqeo2ph8Fstyp6FMSvTtsXeZSPpSMGlviAOav2hxVTqFcx8Hj/twtWKsMJXNY0xI8w==", "requires": { "esbuild": "^0.18.10", "fsevents": "~2.3.2", diff --git a/package.json b/package.json index d7be99999..1234aa4bc 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "dependencies": { "@sveltejs/adapter-node": "^1.3.1", "async": "^3.2.5", + "bits-ui": "^0.19.7", "dayjs": "^1.11.10", "file-saver": "^2.0.5", "highlight.js": "^11.9.0", @@ -53,4 +54,4 @@ "tippy.js": "^6.3.7", "uuid": "^9.0.1" } -} \ No newline at end of file +} diff --git a/src/lib/components/common/Dropdown.svelte b/src/lib/components/common/Dropdown.svelte new file mode 100644 index 000000000..580a95fda --- /dev/null +++ b/src/lib/components/common/Dropdown.svelte @@ -0,0 +1,30 @@ + + + + + + + + + + +
Profile
+
+ + +
Profile
+
+ + +
Profile
+
+
+
+
diff --git a/src/lib/components/icons/GarbageBin.svelte b/src/lib/components/icons/GarbageBin.svelte new file mode 100644 index 000000000..31530fc72 --- /dev/null +++ b/src/lib/components/icons/GarbageBin.svelte @@ -0,0 +1,19 @@ + + + + + diff --git a/src/lib/components/icons/Pencil.svelte b/src/lib/components/icons/Pencil.svelte new file mode 100644 index 000000000..42b60916c --- /dev/null +++ b/src/lib/components/icons/Pencil.svelte @@ -0,0 +1,19 @@ + + + + + diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte index 014dfcf6d..c8eaa4c0b 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/Sidebar.svelte @@ -20,6 +20,8 @@ import { slide } from 'svelte/transition'; import { WEBUI_BASE_URL } from '$lib/constants'; import Tooltip from '../common/Tooltip.svelte'; + import Dropdown from '../common/Dropdown.svelte'; + import ChatMenu from './Sidebar/ChatMenu.svelte'; let show = false; let navElement; @@ -27,6 +29,8 @@ let title: string = 'UI'; let search = ''; + let selectedChatId = null; + let chatDeleteId = null; let chatTitleEditId = null; let chatTitle = ''; @@ -376,21 +380,24 @@