From 9d9a60afecc7a4fb6267c19d101546366bc22d9b Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Tue, 19 Nov 2024 16:50:45 -0800 Subject: [PATCH 01/12] refac --- src/lib/apis/models/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/apis/models/index.ts b/src/lib/apis/models/index.ts index fdce03f84..70003741e 100644 --- a/src/lib/apis/models/index.ts +++ b/src/lib/apis/models/index.ts @@ -3,7 +3,7 @@ import { WEBUI_API_BASE_URL } from '$lib/constants'; export const getModels = async (token: string = '') => { let error = null; - const res = await fetch(`${WEBUI_API_BASE_URL}/models`, { + const res = await fetch(`${WEBUI_API_BASE_URL}/models/`, { method: 'GET', headers: { Accept: 'application/json', From 00e41790bff71dc0d0c64c9e34d2f285c0289ffa Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Tue, 19 Nov 2024 17:10:43 -0800 Subject: [PATCH 02/12] enh: show tool description on hover --- src/lib/components/chat/MessageInput.svelte | 22 +++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index a7ff37354..a869a1d99 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -321,12 +321,22 @@ -
- {selectedToolIds - .map((id) => { - return $tools ? $tools.find((tool) => tool.id === id)?.name : id; - }) - .join(', ')} +
+ {#each selectedToolIds.map((id) => { + return $tools ? $tools.find((t) => t.id === id) : { id: id, name: id }; + }) as tool, toolIdx (toolIdx)} + + {tool.name} + + + {#if toolIdx !== selectedToolIds.length - 1} + , + {/if} + {/each}
From 7f7b1b18cd3e7b9d1e840c66f787304a924e26f3 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Tue, 19 Nov 2024 17:27:34 -0800 Subject: [PATCH 03/12] doc: changelog --- CHANGELOG.md | 11 +++++++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 765ca6fc8..7749c0aa1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ 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.4.1] - 2024-11-19 + +### Added + +- **🛠️ Tool Descriptions on Hover**: When enabled, tool descriptions now appear upon hovering over the tool icon in the message input, giving you more context instantly and improving workflow fluidity. + +### Fixed + +- **🚫 Graceful Handling of Deleted Users**: Resolved an issue where deleted users caused models, knowledge, prompts, or tools to fail loading in the workspace, ensuring smoother operation and fewer interruptions. +- **🔗 Proxy Fix for HTTPS Models Endpoint**: Fixed issues with proxies affecting the secure `/api/v1/models/` endpoint, ensuring stable connections and reliable access. + ## [0.4.0] - 2024-11-19 ### Added diff --git a/package-lock.json b/package-lock.json index 66eb9c019..d2114a6ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "open-webui", - "version": "0.4.0", + "version": "0.4.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "open-webui", - "version": "0.4.0", + "version": "0.4.1", "dependencies": { "@codemirror/lang-javascript": "^6.2.2", "@codemirror/lang-python": "^6.1.6", diff --git a/package.json b/package.json index fbb732549..47e232773 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "open-webui", - "version": "0.4.0", + "version": "0.4.1", "private": true, "scripts": { "dev": "npm run pyodide:fetch && vite dev --host", From 2c2c2ea9e1350e097d8f04f297eeaf0ca714941d Mon Sep 17 00:00:00 2001 From: bx Date: Wed, 20 Nov 2024 10:15:40 +0800 Subject: [PATCH 04/12] fix(workflow): fix huggingface deploy errors and track .jpg file types --- .github/workflows/deploy-to-hf-spaces.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/deploy-to-hf-spaces.yml b/.github/workflows/deploy-to-hf-spaces.yml index aa8bbcfce..7fc66acf5 100644 --- a/.github/workflows/deploy-to-hf-spaces.yml +++ b/.github/workflows/deploy-to-hf-spaces.yml @@ -28,6 +28,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + lfs: true - name: Remove git history run: rm -rf .git @@ -52,7 +54,9 @@ jobs: - name: Set up Git and push to Space run: | git init --initial-branch=main + git lfs install git lfs track "*.ttf" + git lfs track "*.jpg" rm demo.gif git add . git commit -m "GitHub deploy: ${{ github.sha }}" From 206a4877c7a52007e96fb7a0d0ebfdc9db346e2c Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Tue, 19 Nov 2024 18:17:38 -0800 Subject: [PATCH 05/12] fix: api key creation --- backend/open_webui/apps/webui/routers/auths.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/open_webui/apps/webui/routers/auths.py b/backend/open_webui/apps/webui/routers/auths.py index 630a8bcbf..262a2bb86 100644 --- a/backend/open_webui/apps/webui/routers/auths.py +++ b/backend/open_webui/apps/webui/routers/auths.py @@ -739,7 +739,7 @@ async def update_ldap_config( # create api key @router.post("/api_key", response_model=ApiKey) async def create_api_key(request: Request, user=Depends(get_current_user)): - if not request.app.config.state.ENABLE_API_KEY: + if not request.app.state.config.ENABLE_API_KEY: raise HTTPException( status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.API_KEY_CREATION_NOT_ALLOWED, From 70c6d3bf9f781504abe1bbab8044f9577c5d020d Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Tue, 19 Nov 2024 18:21:55 -0800 Subject: [PATCH 06/12] fix --- backend/open_webui/apps/webui/routers/auths.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/open_webui/apps/webui/routers/auths.py b/backend/open_webui/apps/webui/routers/auths.py index 262a2bb86..63ee5e3b0 100644 --- a/backend/open_webui/apps/webui/routers/auths.py +++ b/backend/open_webui/apps/webui/routers/auths.py @@ -738,7 +738,7 @@ async def update_ldap_config( # create api key @router.post("/api_key", response_model=ApiKey) -async def create_api_key(request: Request, user=Depends(get_current_user)): +async def generate_api_key(request: Request, user=Depends(get_current_user)): if not request.app.state.config.ENABLE_API_KEY: raise HTTPException( status.HTTP_403_FORBIDDEN, From cbcd14cdbf8ff9bd4b2fa5c2df8a2fe52f7bd9b9 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Tue, 19 Nov 2024 18:22:45 -0800 Subject: [PATCH 07/12] doc: changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7749c0aa1..1b0f72608 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **🚫 Graceful Handling of Deleted Users**: Resolved an issue where deleted users caused models, knowledge, prompts, or tools to fail loading in the workspace, ensuring smoother operation and fewer interruptions. - **🔗 Proxy Fix for HTTPS Models Endpoint**: Fixed issues with proxies affecting the secure `/api/v1/models/` endpoint, ensuring stable connections and reliable access. +- **🔒 API Key Creation**: Addressed a bug that previously prevented API keys from being created. ## [0.4.0] - 2024-11-19 From 7c5b845d16eec5a01853300d82d20122762d796a Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Tue, 19 Nov 2024 18:26:01 -0800 Subject: [PATCH 08/12] refac: add citations to outlet/actions form Co-Authored-By: Alex Morgan --- src/lib/components/chat/Chat.svelte | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index bfc9800fe..8a1ef2d91 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -663,7 +663,8 @@ role: m.role, content: m.content, info: m.info ? m.info : undefined, - timestamp: m.timestamp + timestamp: m.timestamp, + ...(m.citations ? { citations: m.citations } : {}) })), chat_id: chatId, session_id: $socket?.id, @@ -716,7 +717,8 @@ role: m.role, content: m.content, info: m.info ? m.info : undefined, - timestamp: m.timestamp + timestamp: m.timestamp, + ...(m.citations ? { citations: m.citations } : {}) })), ...(event ? { event: event } : {}), chat_id: chatId, From 796636710707970b338fc389993192409696c830 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Tue, 19 Nov 2024 18:45:26 -0800 Subject: [PATCH 09/12] refac: models api --- backend/open_webui/apps/webui/routers/models.py | 9 +++++---- src/lib/apis/models/index.ts | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/backend/open_webui/apps/webui/routers/models.py b/backend/open_webui/apps/webui/routers/models.py index 576df8d94..6a8085385 100644 --- a/backend/open_webui/apps/webui/routers/models.py +++ b/backend/open_webui/apps/webui/routers/models.py @@ -83,7 +83,8 @@ async def create_new_model( ########################### -@router.get("/id/{id}", response_model=Optional[ModelResponse]) +# Note: We're not using the typical url path param here, but instead using a query parameter to allow '/' in the id +@router.get("/model", response_model=Optional[ModelResponse]) async def get_model_by_id(id: str, user=Depends(get_verified_user)): model = Models.get_model_by_id(id) if model: @@ -105,7 +106,7 @@ async def get_model_by_id(id: str, user=Depends(get_verified_user)): ############################ -@router.post("/id/{id}/toggle", response_model=Optional[ModelResponse]) +@router.post("/model/toggle", response_model=Optional[ModelResponse]) async def toggle_model_by_id(id: str, user=Depends(get_verified_user)): model = Models.get_model_by_id(id) if model: @@ -140,7 +141,7 @@ async def toggle_model_by_id(id: str, user=Depends(get_verified_user)): ############################ -@router.post("/id/{id}/update", response_model=Optional[ModelModel]) +@router.post("/model/update", response_model=Optional[ModelModel]) async def update_model_by_id( id: str, form_data: ModelForm, @@ -163,7 +164,7 @@ async def update_model_by_id( ############################ -@router.delete("/id/{id}/delete", response_model=bool) +@router.delete("/model/delete", response_model=bool) async def delete_model_by_id(id: str, user=Depends(get_verified_user)): model = Models.get_model_by_id(id) if not model: diff --git a/src/lib/apis/models/index.ts b/src/lib/apis/models/index.ts index 70003741e..5880874bb 100644 --- a/src/lib/apis/models/index.ts +++ b/src/lib/apis/models/index.ts @@ -97,7 +97,7 @@ export const getModelById = async (token: string, id: string) => { const searchParams = new URLSearchParams(); searchParams.append('id', id); - const res = await fetch(`${WEBUI_API_BASE_URL}/models/id/${id}`, { + const res = await fetch(`${WEBUI_API_BASE_URL}/models/model?${searchParams.toString()}`, { method: 'GET', headers: { Accept: 'application/json', @@ -132,7 +132,7 @@ export const toggleModelById = async (token: string, id: string) => { const searchParams = new URLSearchParams(); searchParams.append('id', id); - const res = await fetch(`${WEBUI_API_BASE_URL}/models/id/${id}/toggle`, { + const res = await fetch(`${WEBUI_API_BASE_URL}/models/model/toggle?${searchParams.toString()}`, { method: 'POST', headers: { Accept: 'application/json', @@ -167,7 +167,7 @@ export const updateModelById = async (token: string, id: string, model: object) const searchParams = new URLSearchParams(); searchParams.append('id', id); - const res = await fetch(`${WEBUI_API_BASE_URL}/models/id/${id}/update`, { + const res = await fetch(`${WEBUI_API_BASE_URL}/models/model/update?${searchParams.toString()}`, { method: 'POST', headers: { Accept: 'application/json', @@ -203,7 +203,7 @@ export const deleteModelById = async (token: string, id: string) => { const searchParams = new URLSearchParams(); searchParams.append('id', id); - const res = await fetch(`${WEBUI_API_BASE_URL}/models/id/${id}/delete`, { + const res = await fetch(`${WEBUI_API_BASE_URL}/models/model/delete?${searchParams.toString()}`, { method: 'DELETE', headers: { Accept: 'application/json', From e54879aeb17920afc3aa009d09e0e7546582d47a Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Tue, 19 Nov 2024 20:12:22 -0800 Subject: [PATCH 10/12] enh: detailed 1-10 rating --- .../chat/Messages/RateComment.svelte | 141 ++++++++++++------ .../chat/Messages/ResponseMessage.svelte | 15 +- 2 files changed, 97 insertions(+), 59 deletions(-) diff --git a/src/lib/components/chat/Messages/RateComment.svelte b/src/lib/components/chat/Messages/RateComment.svelte index 2cccf20d8..39ae17318 100644 --- a/src/lib/components/chat/Messages/RateComment.svelte +++ b/src/lib/components/chat/Messages/RateComment.svelte @@ -38,6 +38,7 @@ let selectedReason = null; let comment = ''; + let detailedRating = null; let selectedModel = null; $: if (message?.annotation?.rating === 1) { @@ -56,6 +57,7 @@ tags = (message?.annotation?.tags ?? []).map((tag) => ({ name: tag })); + detailedRating = message?.annotation?.details?.rating ?? null; }; onMount(() => { @@ -79,7 +81,10 @@ dispatch('save', { reason: selectedReason, comment: comment, - tags: tags.map((tag) => tag.name) + tags: tags.map((tag) => tag.name), + details: { + rating: detailedRating + } }); toast.success($i18n.t('Thanks for your feedback!')); @@ -100,7 +105,9 @@ id="message-feedback-{message.id}" >
-
{$i18n.t('Tell us more:')}
+
{$i18n.t('How would you rate this response?')}
+ +
- {#if reasons.length > 0} -
- {#each reasons as reason} - - {/each} +
+
+
+ + {#each Array.from({ length: 10 }).map((_, i) => i + 1) as rating} + + {/each} +
+ +
+
+ 1 - {$i18n.t('Awful')} +
+ +
+ 10 - {$i18n.t('Amazing')} +
+
- {/if} +
+ +
+ {#if reasons.length > 0} +
{$i18n.t('Why?')}
+ +
+ {#each reasons as reason} + + {/each} +
+ {/if} +