diff --git a/.github/workflows/codespell.disabled b/.github/workflows/codespell.disabled new file mode 100644 index 0000000000000000000000000000000000000000..b2316674307b3032c92f5b190b3130750bd30d4d --- /dev/null +++ b/.github/workflows/codespell.disabled @@ -0,0 +1,25 @@ +# Codespell configuration is within pyproject.toml +--- +name: Codespell + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Annotate locations with typos + uses: codespell-project/codespell-problem-matcher@v1 + - name: Codespell + uses: codespell-project/actions-codespell@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index eaf0f6213a9808bb930491920d29cb5215c3e850..80f5f481e56c8c9bfb916ab858588b29d74424fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,33 @@ 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.5.4] - 2024-01-05 + +### Added + +- **🔄 Clone Shared Chats**: Effortlessly clone shared chats to save time and streamline collaboration, perfect for reusing insightful discussions or custom setups. +- **📣 Native Notifications for Channel Messages**: Stay informed with integrated desktop notifications for channel messages, ensuring you never miss important updates while multitasking. +- **🔥 Torch MPS Support**: MPS support for Mac users when Open WebUI is installed directly, offering better performance and compatibility for AI workloads. +- **🌍 Enhanced Translations**: Small improvements to various translations, ensuring a smoother global user experience. + +### Fixed + +- **🖼️ Image-Only Messages in Channels**: You can now send images without accompanying text or content in channels. +- **❌ Proper Exception Handling**: Enhanced error feedback by ensuring exceptions are raised clearly, reducing confusion and promoting smoother debugging. +- **🔍 RAG Query Generation Restored**: Fixed query generation issues for Retrieval-Augmented Generation, improving retrieval accuracy and ensuring seamless functionality. +- **📩 MOA Response Functionality Fixed**: Addressed an error with the MOA response generation feature. +- **💬 Channel Thread Loading with 50+ Messages**: Resolved an issue where channel threads stalled when exceeding 50 messages, ensuring smooth navigation in active discussions. +- **🔑 API Endpoint Restrictions Resolution**: Fixed a critical bug where the 'API_KEY_ALLOWED_ENDPOINTS' setting was not functioning as intended, ensuring API access is limited to specified endpoints for enhanced security. +- **🛠️ Action Functions Restored**: Corrected an issue preventing action functions from working, restoring their utility for customized automations and workflows. +- **📂 Temporary Chat JSON Export Fix**: Resolved a bug blocking temporary chats from being exported in JSON format, ensuring seamless data portability. + +### Changed + +- **🎛️ Sidebar UI Tweaks**: Chat folders, including pinned folders, now display below the Chats section for better organization; the "New Folder" button has been relocated to the Chats section for a more intuitive workflow. +- **🏗️ Real-Time Save Disabled by Default**: The 'ENABLE_REALTIME_CHAT_SAVE' setting is now off by default, boosting response speed for users who prioritize performance in high-paced workflows or less critical scenarios. +- **🎤 Audio Input Echo Cancellation**: Audio input now features echo cancellation enabled by default, reducing audio feedback for improved clarity during conversations or voice-based interactions. +- **🔧 General Reliability Improvements**: Numerous under-the-hood enhancements have been made to improve platform stability, boost overall performance, and ensure a more seamless, dependable experience across workflows. + ## [0.5.3] - 2024-12-31 ### Added diff --git a/README.md b/README.md index 28bf76d51b2dce6d845c3dd53d0b9f346a8ae5ec..6b2576fd3c5d5c53c17bde0e22bf0f83fc25b00c 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ app_port: 8080 [![Discord](https://img.shields.io/badge/Discord-Open_WebUI-blue?logo=discord&logoColor=white)](https://discord.gg/5rJgQTnV4s) [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/tjbck) -**Open WebUI is an [extensible](https://docs.openwebui.com/features/plugin/), feature-rich, and user-friendly self-hosted AI platform designed to operate entirely offline.** It supports various LLM runners like Ollama and OpenAI-compatible APIs, with built-in embedding model inference engine for RAG, making it a powerful AI deployment solution. +**Open WebUI is an [extensible](https://docs.openwebui.com/features/plugin/), feature-rich, and user-friendly self-hosted AI platform designed to operate entirely offline.** It supports various LLM runners like **Ollama** and **OpenAI-compatible APIs**, with **built-in inference engine** for RAG, making it a **powerful AI deployment solution**. For more information, be sure to check out our [Open WebUI Documentation](https://docs.openwebui.com/). diff --git a/backend/open_webui/env.py b/backend/open_webui/env.py index 9bdfb0012386fca68948c8f7eb33b5c663b164ff..f16f2ea6efdb3b699fefad44b897b7043b91515d 100644 --- a/backend/open_webui/env.py +++ b/backend/open_webui/env.py @@ -53,6 +53,11 @@ if USE_CUDA.lower() == "true": else: DEVICE_TYPE = "cpu" +try: + if torch.backends.mps.is_available() and torch.backends.mps.is_built(): + DEVICE_TYPE = "mps" +except Exception: + pass #################################### # LOGGING diff --git a/backend/open_webui/models/chats.py b/backend/open_webui/models/chats.py index 18f802afe9899d9f4ce0d29faeb14c9c2cc528f4..8e721da78762588f6b93ba4114cae30c531e270b 100644 --- a/backend/open_webui/models/chats.py +++ b/backend/open_webui/models/chats.py @@ -469,6 +469,8 @@ class ChatTable: def get_chat_by_share_id(self, id: str) -> Optional[ChatModel]: try: with get_db() as db: + # it is possible that the shared link was deleted. hence, + # we check if the chat is still shared by checkng if a chat with the share_id exists chat = db.query(Chat).filter_by(share_id=id).first() if chat: diff --git a/backend/open_webui/routers/chats.py b/backend/open_webui/routers/chats.py index 5e0e75e24b5589f8ff80442d93346347f19b703e..a001dd01f274ae65d0b7e30255f8ae541381cae6 100644 --- a/backend/open_webui/routers/chats.py +++ b/backend/open_webui/routers/chats.py @@ -463,6 +463,30 @@ async def clone_chat_by_id(id: str, user=Depends(get_verified_user)): ) +############################ +# CloneSharedChatById +############################ + + +@router.post("/{id}/clone/shared", response_model=Optional[ChatResponse]) +async def clone_shared_chat_by_id(id: str, user=Depends(get_verified_user)): + chat = Chats.get_chat_by_share_id(id) + if chat: + updated_chat = { + **chat.chat, + "originalChatId": chat.id, + "branchPointMessageId": chat.chat["history"]["currentId"], + "title": f"Clone of {chat.title}", + } + + chat = Chats.insert_new_chat(user.id, ChatForm(**{"chat": updated_chat})) + return ChatResponse(**chat.model_dump()) + else: + raise HTTPException( + status_code=status.HTTP_401_UNAUTHORIZED, detail=ERROR_MESSAGES.DEFAULT() + ) + + ############################ # ArchiveChat ############################ diff --git a/backend/requirements.txt b/backend/requirements.txt index 5c5e2635cd164c7fb2dcc8377888317338be508b..6d97a1939d2522ca2f15d1a1dccd71f824cbedd0 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -106,4 +106,4 @@ googleapis-common-protos==1.63.2 ldap3==2.9.1 gnupg -huggingface_hub \ No newline at end of file +huggingface_hub diff --git a/package-lock.json b/package-lock.json index 1afeaecbecc2cb87fe2b61cf2deee18822a19958..0d78397efa7958a71991e86cb9e9585e3f9b1c26 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "open-webui", - "version": "0.5.3", + "version": "0.5.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "open-webui", - "version": "0.5.3", + "version": "0.5.4", "dependencies": { "@codemirror/lang-javascript": "^6.2.2", "@codemirror/lang-python": "^6.1.6", diff --git a/package.json b/package.json index 71fd418a7eac5cd62b2a23897f11bdb1386ee4dc..6a0f451fc934552f2c3b0551eea33b635302654d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "open-webui", - "version": "0.5.3", + "version": "0.5.4", "private": true, "scripts": { "dev": "npm run pyodide:fetch && vite dev --host", diff --git a/pyproject.toml b/pyproject.toml index 2aa69204e0e86a55e1fa0e52f4bf5f09e5a55cbd..63a97e69aad8a505dc909ad64e14b892e5d62800 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ dependencies = [ "pydantic==2.9.2", "python-multipart==0.0.18", - "Flask==3.0.3", + "Flask==3.1.0", "Flask-Cors==5.0.0", "python-socketio==5.11.3", @@ -26,7 +26,7 @@ dependencies = [ "sqlalchemy==2.0.32", "alembic==1.14.0", - "peewee==3.17.6", + "peewee==3.17.8", "peewee-migrate==1.12.2", "psycopg2-binary==2.9.9", "pgvector==0.3.5", @@ -61,7 +61,7 @@ dependencies = [ "ftfy==6.2.3", "pypdf==4.3.1", - "fpdf2==2.7.9", + "fpdf2==2.8.2", "pymdown-extensions==10.11.2", "docx2txt==0.8", "python-pptx==1.0.0", @@ -73,7 +73,7 @@ dependencies = [ "openpyxl==3.1.5", "pyxlsb==1.0.10", "xlrd==2.0.1", - "validators==0.33.0", + "validators==0.34.0", "psutil", "sentencepiece", "soundfile==0.12.1", @@ -84,7 +84,7 @@ dependencies = [ "faster-whisper==1.0.3", - "PyJWT[crypto]==2.9.0", + "PyJWT[crypto]==2.10.1", "authlib==1.3.2", "black==24.8.0", diff --git a/src/lib/apis/chats/index.ts b/src/lib/apis/chats/index.ts index d93d21c73abf4d2726dbc38f67ea5d8398c1217b..1772529d39df18692799c0aed5ad0666e44daf40 100644 --- a/src/lib/apis/chats/index.ts +++ b/src/lib/apis/chats/index.ts @@ -618,6 +618,44 @@ export const cloneChatById = async (token: string, id: string) => { return res; }; +export const cloneSharedChatById = async (token: string, id: string) => { + let error = null; + + const res = await fetch(`${WEBUI_API_BASE_URL}/chats/${id}/clone/shared`, { + method: 'POST', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + ...(token && { authorization: `Bearer ${token}` }) + } + }) + .then(async (res) => { + if (!res.ok) throw await res.json(); + return res.json(); + }) + .then((json) => { + return json; + }) + .catch((err) => { + error = err; + + if ('detail' in err) { + error = err.detail; + } else { + error = err; + } + + console.log(err); + return null; + }); + + if (error) { + throw error; + } + + return res; +}; + export const shareChatById = async (token: string, id: string) => { let error = null; diff --git a/src/lib/components/admin/Settings/Models.svelte b/src/lib/components/admin/Settings/Models.svelte index f084de65aa9386eb98c65c5d38132dcc22137a9e..580f3dcfd4251cc23258eef39910d419990bcedc 100644 --- a/src/lib/components/admin/Settings/Models.svelte +++ b/src/lib/components/admin/Settings/Models.svelte @@ -128,7 +128,7 @@ await toggleModelById(localStorage.token, model.id); } - await init(); + // await init(); _models.set(await getModels(localStorage.token)); }; diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index d5982af90b599cf0daf44e03d7f97e547c5af77b..609a4ae6d3f83a24750a4199b29da7b1151c2dec 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -1151,13 +1151,6 @@ if (done) { message.done = true; - if ($settings.notificationEnabled && !document.hasFocus()) { - new Notification(`${message.model}`, { - body: message.content, - icon: `${WEBUI_BASE_URL}/static/favicon.png` - }); - } - if ($settings.responseAutoCopy) { copyToClipboard(message.content); } diff --git a/src/lib/components/chat/Messages.svelte b/src/lib/components/chat/Messages.svelte index 2b0748dc7e06395c3130845a8ad9aa0c063d1308..4d6058bab95a4790745dbaa1c65805b8edf99230 100644 --- a/src/lib/components/chat/Messages.svelte +++ b/src/lib/components/chat/Messages.svelte @@ -16,6 +16,11 @@ const i18n = getContext('i18n'); +<<<<<<< HEAD +======= + export let className = 'h-full flex pt-8'; + +>>>>>>> c2b1693 (GitHub deploy: 1dfb479d367e5f5902f051c823f9aef836e04791) export let chatId = ''; export let user = $_user; @@ -333,7 +338,7 @@ }; -
+
{#if Object.keys(history?.messages ?? {}).length == 0}
-
+
{#if $config?.features.enable_community_sharing} +
+
+>>>>>>> c2b1693 (GitHub deploy: 1dfb479d367e5f5902f051c823f9aef836e04791)
{/if}