Skip to content

Commit 8d7d79d

Browse files
tjbcksilentoplayzShirasawaSamaIthaniljmleksan
authored
* feat: improve ollama model management experience This commit introduces several improvements to the Ollama model management modal: - Adds a cancel button to the model pulling operation, using the existing 'x' button pattern. - Adds a cancel button to the "Update All" models operation, allowing the user to cancel the update for the currently processing model. - Cleans up toast notifications when updating all models. A single toast is now shown at the beginning and a summary toast at the end, preventing notification spam. - Refactors the `ManageOllama.svelte` component to support these new cancellation features. - Adds tooltips to all buttons in the modal to improve clarity. - Disables buttons when their corresponding input fields are empty to prevent accidental clicks. * fix * i18n: improve Chinese translation * fix: handle non‑UTF8 chars in third‑party responses without error * German translation of new strings in i18n * log web search queries only with level 'debug' instead of 'info' * Tool calls now only include text and dont inlcude other content like image b64 * fix onedrive * fix: discovery url * fix: default permissions not being loaded * fix: ai hallucination * fix: non rich text input copy * refac: rm print statements * refac: disable direct models from model editors * refac/fix: do not process xlsx files with azure doc intelligence * Update pull_request_template.md * Update generated image translation in DE-de * added missing danish translations * feat(onedrive): Enable search and "My Organization" pivot * style(onedrive): Formatting fix * feat: Implement toggling for vertical and horizontal flow layouts This commit introduces the necessary logic and UI controls to allow users to switch the Flow component layout between vertical and horizontal orientations. * **`Flow.svelte` Refactoring:** * Updates logic for calculating level offsets and node positions to consistently respect the current flow orientation. * Adds a control panel using `<Controls>` and `<SwitchButton>` components. * Provides user interface elements to easily switch the flow layout between horizontal and vertical orientations. * build(deps): bump pydantic from 2.11.7 to 2.11.9 in /backend Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.11.7 to 2.11.9. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/v2.11.9/HISTORY.md) - [Commits](pydantic/pydantic@v2.11.7...v2.11.9) --- updated-dependencies: - dependency-name: pydantic dependency-version: 2.11.9 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * build(deps): bump black from 25.1.0 to 25.9.0 in /backend Bumps [black](https://github.com/psf/black) from 25.1.0 to 25.9.0. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](psf/black@25.1.0...25.9.0) --- updated-dependencies: - dependency-name: black dependency-version: 25.9.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * build(deps): bump markdown from 3.8.2 to 3.9 in /backend Bumps [markdown](https://github.com/Python-Markdown/markdown) from 3.8.2 to 3.9. - [Release notes](https://github.com/Python-Markdown/markdown/releases) - [Changelog](https://github.com/Python-Markdown/markdown/blob/master/docs/changelog.md) - [Commits](Python-Markdown/markdown@3.8.2...3.9.0) --- updated-dependencies: - dependency-name: markdown dependency-version: '3.9' dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * build(deps): bump chromadb from 1.0.20 to 1.1.0 in /backend Bumps [chromadb](https://github.com/chroma-core/chroma) from 1.0.20 to 1.1.0. - [Release notes](https://github.com/chroma-core/chroma/releases) - [Changelog](https://github.com/chroma-core/chroma/blob/main/RELEASE_PROCESS.md) - [Commits](chroma-core/chroma@1.0.20...1.1.0) --- updated-dependencies: - dependency-name: chromadb dependency-version: 1.1.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * build(deps): bump opentelemetry-api from 1.36.0 to 1.37.0 Bumps [opentelemetry-api](https://github.com/open-telemetry/opentelemetry-python) from 1.36.0 to 1.37.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-python/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-python/blob/main/CHANGELOG.md) - [Commits](open-telemetry/opentelemetry-python@v1.36.0...v1.37.0) --- updated-dependencies: - dependency-name: opentelemetry-api dependency-version: 1.37.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * refac: ollama embed form data * fix: non rich text handling * fix: oauth client registration * refac * chore: dep bump * chore: fastapi bump * chore/refac: bump bcrypt and remove passlib * Improving Korean Translation * refac * Improving Korean Translation * feat: PWA share_target implementation Co-Authored-By: gjveld <[email protected]> * refac: message input mobile detection behaviour * feat: model_ids per folder * Update translation.json (pt-BR) inclusion of new translations of items that have been added * refac * refac * refac * refac * refac/fix: temp chat * refac * refac: stop task * refac/fix: azure audio escape * refac: external tool validation * refac/enh: start.sh additional args support * refac * refac: styling * refac/fix: direct connection floating action buttons * refac/fix: system prompt duplication * refac/enh: openai tts additional params support * refac * feat: load data in parallel to accelerate page loading speed * i18n: improve Chinese translation * refac * refac: model selector * UPD: i18n es-ES Translation v0.6.33 UPD: i18n es-ES Translation v0.6.33 Updated new strings. * refac * improved query pref by querying only relevant columns * refac/enh: docling params * refac * refac: openai additional headers support * refac * FEAT: Add Vega Char Visualizer Renderer ### FEAT: Add Vega Char Visualizer Renderer Feature required in open-webui#18022 Added npm vega lib to package.json Added function for visualization renderer to src/libs/utils/index.ts Added logic to src/lib/components/chat/Messages/CodeBlock.svelte The treatment is similar as for mermaid diagrams. Reference: https://vega.github.io/vega/ * refac * chore * refac * FEAT: Add Vega-Lite Char Visualizer Renderer ### FEAT: Add Vega Char Visualizer Renderer Add suport for Vega-Lite Specifications. Vega-Lite is a "compiled" version of Vega Char Visualizer. For be rendered with Vega it have to be compiled. This PR add the check and compile if necessary, is a complement of recent Vega Renderer Feature added. * refac * refac/fix: switch * enh/refac: url input handling * refac * refac: styling * UPD: Add Validators & Error Toast for Mermaid & Vega diagrams ### UPD: Feat: Add Validators & Error Toast for Mermaid & Vega diagrams Description: As many time the diagrams generated or entered have syntax errors the diagrams are not rendered due to that errors, but as there isn't any notification is difficult to know what happend. This PR add validator and toast notification when error on Mermaid and Vega/Vega-Lite diagrams, helping the user to fix its. * removed redundant knowledge API call * Fix Code Format * refac: model workspace view * refac * refac: knowledge * refac: prompts * refac: tools * refac * feat: attach folder * refac: make tencentcloud-sdk-python optional * refac/fix: oauth * enh: ENABLE_OAUTH_EMAIL_FALLBACK * refac/fix: folders * Update requirements.txt * Update pyproject.toml * UPD: Add Validators & Error Toast for Mermaid & Vega diagrams ### UPD: Feat: Add Validators & Error Toast for Mermaid & Vega diagrams Description: As many time the diagrams generated or entered have syntax errors the diagrams are not rendered due to that errors, but as there isn't any notification is difficult to know what happend. This PR add validator and toast notification when error on Mermaid and Vega/Vega-Lite diagrams, helping the user to fix its. Note: Another possibility of integrating this Graph Visualizer is through its svelte component: https://github.com/vega/svelte-vega/tree/main/packages/svelte-vega * Removed unused toast import & Code Format * refac * refac: external tool server view * refac * refac: overview * refac: styling * refac * Update bug_report.yaml * refac * refac * refac * refac * refac: oauth client fallback * Fixed: Cannot handle batch sizes > 1 if no padding token is defined Fixes Cannot handle batch sizes > 1 if no padding token is defined For reranker models that do not have this defined in their config by using the eos_token_id if present as pad_token_id. * refac: fallback to reasoning content * fix(i18n): corrected typo in Spanish translation for "Reasoning Tags" Typo fixed in Spanish translation file at line 1240 of `open-webui/src/lib/i18n/locales/es-ES/translation.json`: - Incorrect: "Eriquetas de Razonamiento" - Correct: "Etiquetas de Razonamiento" This improves clarity and consistency in the UI. * refac/fix: ENABLE_STAR_SESSIONS_MIDDLEWARE * refac/fix: redirect * refac * refac * refac * refac: web search error handling * refac: source parsing * refac: functions * refac * refac/enh: note pdf export * refac/fix: mcp oauth2.1 * chore: format * chore: Changelog (open-webui#17995) * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * refac * chore: dep bump --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: silentoplayz <[email protected]> Co-authored-by: Shirasawa <[email protected]> Co-authored-by: Jan Kessler <[email protected]> Co-authored-by: Jacob Leksan <[email protected]> Co-authored-by: Classic298 <[email protected]> Co-authored-by: sinejespersen <[email protected]> Co-authored-by: Selene Blok <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cyp <[email protected]> Co-authored-by: gjveld <[email protected]> Co-authored-by: joaoback <[email protected]> Co-authored-by: _00_ <[email protected]> Co-authored-by: expruc <[email protected]> Co-authored-by: YetheSamartaka <[email protected]> Co-authored-by: Akutangulo <[email protected]>
1 parent 4d7fdda commit 8d7d79d

File tree

156 files changed

+6069
-3148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+6069
-3148
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ body:
1313
1414
- **Before submitting a bug report**: Please check the [Issues](https://github.com/open-webui/open-webui/issues) and [Discussions](https://github.com/open-webui/open-webui/discussions) sections to see if a similar issue has already been reported. If unsure, start a discussion first, as this helps us efficiently focus on improving the project. Duplicates may be closed without notice. **Please search for existing issues and discussions.**
1515
16+
- Check for opened, **but also for (recently) CLOSED issues** as the issue you are trying to report **might already have been fixed!**
17+
1618
- **Respectful collaboration**: Open WebUI is a volunteer-driven project with a single maintainer and contributors who also have full-time jobs. Please be constructive and respectful in your communication.
1719
1820
- **Contributing**: If you encounter an issue, consider submitting a pull request or forking the project. We prioritize preventing contributor burnout to maintain Open WebUI's quality.

.github/pull_request_template.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44

55
**Before submitting, make sure you've checked the following:**
66

7-
- [ ] **Target branch:** Please verify that the pull request targets the `dev` branch.
7+
- [ ] **Target branch:** Verify that the pull request targets the `dev` branch. Not targeting the `dev` branch may lead to immediate closure of the PR.
88
- [ ] **Description:** Provide a concise description of the changes made in this pull request.
99
- [ ] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description.
10-
- [ ] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources?
10+
- [ ] **Documentation:** If necessary, update relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs) like environment variables, the tutorials, or other documentation sources.
1111
- [ ] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation?
12-
- [ ] **Testing:** Have you written and run sufficient tests to validate the changes?
12+
- [ ] **Testing:** Perform manual tests to verify the implemented fix/feature works as intended AND does not break any other functionality. Take this as an opportunity to make screenshots of the feature/fix and include it in the PR description.
13+
- [ ] **Agentic AI Code:**: Confirm this Pull Request is **not written by any AI Agent** or has at least gone through additional human review **and** manual testing. If any AI Agent is the co-author of this PR, it may lead to immediate closure of the PR.
1314
- [ ] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
14-
- [ ] **Prefix:** To clearly categorize this pull request, prefix the pull request title using one of the following:
15+
- [ ] **Title Prefix:** To clearly categorize this pull request, prefix the pull request title using one of the following:
1516
- **BREAKING CHANGE**: Significant changes that may affect compatibility
1617
- **build**: Changes that affect the build system or external dependencies
1718
- **ci**: Changes to our continuous integration processes or workflows

CHANGELOG.md

Lines changed: 69 additions & 0 deletions
Large diffs are not rendered by default.

backend/open_webui/config.py

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,8 @@ def load_oauth_providers():
605605
OAUTH_PROVIDERS.clear()
606606
if GOOGLE_CLIENT_ID.value and GOOGLE_CLIENT_SECRET.value:
607607

608-
def google_oauth_register(client: OAuth):
609-
client.register(
608+
def google_oauth_register(oauth: OAuth):
609+
client = oauth.register(
610610
name="google",
611611
client_id=GOOGLE_CLIENT_ID.value,
612612
client_secret=GOOGLE_CLIENT_SECRET.value,
@@ -621,6 +621,7 @@ def google_oauth_register(client: OAuth):
621621
},
622622
redirect_uri=GOOGLE_REDIRECT_URI.value,
623623
)
624+
return client
624625

625626
OAUTH_PROVIDERS["google"] = {
626627
"redirect_uri": GOOGLE_REDIRECT_URI.value,
@@ -633,8 +634,8 @@ def google_oauth_register(client: OAuth):
633634
and MICROSOFT_CLIENT_TENANT_ID.value
634635
):
635636

636-
def microsoft_oauth_register(client: OAuth):
637-
client.register(
637+
def microsoft_oauth_register(oauth: OAuth):
638+
client = oauth.register(
638639
name="microsoft",
639640
client_id=MICROSOFT_CLIENT_ID.value,
640641
client_secret=MICROSOFT_CLIENT_SECRET.value,
@@ -649,6 +650,7 @@ def microsoft_oauth_register(client: OAuth):
649650
},
650651
redirect_uri=MICROSOFT_REDIRECT_URI.value,
651652
)
653+
return client
652654

653655
OAUTH_PROVIDERS["microsoft"] = {
654656
"redirect_uri": MICROSOFT_REDIRECT_URI.value,
@@ -658,8 +660,8 @@ def microsoft_oauth_register(client: OAuth):
658660

659661
if GITHUB_CLIENT_ID.value and GITHUB_CLIENT_SECRET.value:
660662

661-
def github_oauth_register(client: OAuth):
662-
client.register(
663+
def github_oauth_register(oauth: OAuth):
664+
client = oauth.register(
663665
name="github",
664666
client_id=GITHUB_CLIENT_ID.value,
665667
client_secret=GITHUB_CLIENT_SECRET.value,
@@ -677,6 +679,7 @@ def github_oauth_register(client: OAuth):
677679
},
678680
redirect_uri=GITHUB_CLIENT_REDIRECT_URI.value,
679681
)
682+
return client
680683

681684
OAUTH_PROVIDERS["github"] = {
682685
"redirect_uri": GITHUB_CLIENT_REDIRECT_URI.value,
@@ -690,7 +693,7 @@ def github_oauth_register(client: OAuth):
690693
and OPENID_PROVIDER_URL.value
691694
):
692695

693-
def oidc_oauth_register(client: OAuth):
696+
def oidc_oauth_register(oauth: OAuth):
694697
client_kwargs = {
695698
"scope": OAUTH_SCOPES.value,
696699
**(
@@ -716,14 +719,15 @@ def oidc_oauth_register(client: OAuth):
716719
% ("S256", OAUTH_CODE_CHALLENGE_METHOD.value)
717720
)
718721

719-
client.register(
722+
client = oauth.register(
720723
name="oidc",
721724
client_id=OAUTH_CLIENT_ID.value,
722725
client_secret=OAUTH_CLIENT_SECRET.value,
723726
server_metadata_url=OPENID_PROVIDER_URL.value,
724727
client_kwargs=client_kwargs,
725728
redirect_uri=OPENID_REDIRECT_URI.value,
726729
)
730+
return client
727731

728732
OAUTH_PROVIDERS["oidc"] = {
729733
"name": OAUTH_PROVIDER_NAME.value,
@@ -733,8 +737,8 @@ def oidc_oauth_register(client: OAuth):
733737

734738
if FEISHU_CLIENT_ID.value and FEISHU_CLIENT_SECRET.value:
735739

736-
def feishu_oauth_register(client: OAuth):
737-
client.register(
740+
def feishu_oauth_register(oauth: OAuth):
741+
client = oauth.register(
738742
name="feishu",
739743
client_id=FEISHU_CLIENT_ID.value,
740744
client_secret=FEISHU_CLIENT_SECRET.value,
@@ -752,6 +756,7 @@ def feishu_oauth_register(client: OAuth):
752756
},
753757
redirect_uri=FEISHU_REDIRECT_URI.value,
754758
)
759+
return client
755760

756761
OAUTH_PROVIDERS["feishu"] = {
757762
"register": feishu_oauth_register,
@@ -2310,6 +2315,18 @@ class BannerModel(BaseModel):
23102315
os.getenv("DOCLING_SERVER_URL", "http://docling:5001"),
23112316
)
23122317

2318+
docling_params = os.getenv("DOCLING_PARAMS", "")
2319+
try:
2320+
docling_params = json.loads(docling_params)
2321+
except json.JSONDecodeError:
2322+
docling_params = {}
2323+
2324+
DOCLING_PARAMS = PersistentConfig(
2325+
"DOCLING_PARAMS",
2326+
"rag.docling_params",
2327+
docling_params,
2328+
)
2329+
23132330
DOCLING_DO_OCR = PersistentConfig(
23142331
"DOCLING_DO_OCR",
23152332
"rag.docling_do_ocr",
@@ -3361,6 +3378,19 @@ class BannerModel(BaseModel):
33613378
os.getenv("AUDIO_TTS_OPENAI_API_KEY", OPENAI_API_KEY),
33623379
)
33633380

3381+
audio_tts_openai_params = os.getenv("AUDIO_TTS_OPENAI_PARAMS", "")
3382+
try:
3383+
audio_tts_openai_params = json.loads(audio_tts_openai_params)
3384+
except json.JSONDecodeError:
3385+
audio_tts_openai_params = {}
3386+
3387+
AUDIO_TTS_OPENAI_PARAMS = PersistentConfig(
3388+
"AUDIO_TTS_OPENAI_PARAMS",
3389+
"audio.tts.openai.params",
3390+
audio_tts_openai_params,
3391+
)
3392+
3393+
33643394
AUDIO_TTS_API_KEY = PersistentConfig(
33653395
"AUDIO_TTS_API_KEY",
33663396
"audio.tts.api_key",

backend/open_webui/env.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ def parse_section(section):
212212
os.environ.get("ENABLE_FORWARD_USER_INFO_HEADERS", "False").lower() == "true"
213213
)
214214

215+
# Experimental feature, may be removed in future
216+
ENABLE_STAR_SESSIONS_MIDDLEWARE = (
217+
os.environ.get("ENABLE_STAR_SESSIONS_MIDDLEWARE", "False").lower() == "true"
218+
)
219+
215220
####################################
216221
# WEBUI_BUILD_HASH
217222
####################################
@@ -468,7 +473,9 @@ def parse_section(section):
468473
####################################
469474
# OAUTH Configuration
470475
####################################
471-
476+
ENABLE_OAUTH_EMAIL_FALLBACK = (
477+
os.environ.get("ENABLE_OAUTH_EMAIL_FALLBACK", "False").lower() == "true"
478+
)
472479

473480
ENABLE_OAUTH_ID_TOKEN_COOKIE = (
474481
os.environ.get("ENABLE_OAUTH_ID_TOKEN_COOKIE", "True").lower() == "true"
@@ -482,7 +489,6 @@ def parse_section(section):
482489
"OAUTH_SESSION_TOKEN_ENCRYPTION_KEY", WEBUI_SECRET_KEY
483490
)
484491

485-
486492
####################################
487493
# SCIM Configuration
488494
####################################

backend/open_webui/main.py

Lines changed: 70 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import sys
99
import time
1010
import random
11+
import re
1112
from uuid import uuid4
1213

1314

@@ -174,13 +175,14 @@
174175
AUDIO_STT_AZURE_LOCALES,
175176
AUDIO_STT_AZURE_BASE_URL,
176177
AUDIO_STT_AZURE_MAX_SPEAKERS,
177-
AUDIO_TTS_API_KEY,
178178
AUDIO_TTS_ENGINE,
179179
AUDIO_TTS_MODEL,
180+
AUDIO_TTS_VOICE,
180181
AUDIO_TTS_OPENAI_API_BASE_URL,
181182
AUDIO_TTS_OPENAI_API_KEY,
183+
AUDIO_TTS_OPENAI_PARAMS,
184+
AUDIO_TTS_API_KEY,
182185
AUDIO_TTS_SPLIT_ON,
183-
AUDIO_TTS_VOICE,
184186
AUDIO_TTS_AZURE_SPEECH_REGION,
185187
AUDIO_TTS_AZURE_SPEECH_BASE_URL,
186188
AUDIO_TTS_AZURE_SPEECH_OUTPUT_FORMAT,
@@ -246,6 +248,7 @@
246248
EXTERNAL_DOCUMENT_LOADER_API_KEY,
247249
TIKA_SERVER_URL,
248250
DOCLING_SERVER_URL,
251+
DOCLING_PARAMS,
249252
DOCLING_DO_OCR,
250253
DOCLING_FORCE_OCR,
251254
DOCLING_OCR_ENGINE,
@@ -447,6 +450,7 @@
447450
ENABLE_OTEL,
448451
EXTERNAL_PWA_MANIFEST_URL,
449452
AIOHTTP_CLIENT_SESSION_SSL,
453+
ENABLE_STAR_SESSIONS_MIDDLEWARE,
450454
)
451455

452456

@@ -834,6 +838,7 @@ async def lifespan(app: FastAPI):
834838
app.state.config.EXTERNAL_DOCUMENT_LOADER_API_KEY = EXTERNAL_DOCUMENT_LOADER_API_KEY
835839
app.state.config.TIKA_SERVER_URL = TIKA_SERVER_URL
836840
app.state.config.DOCLING_SERVER_URL = DOCLING_SERVER_URL
841+
app.state.config.DOCLING_PARAMS = DOCLING_PARAMS
837842
app.state.config.DOCLING_DO_OCR = DOCLING_DO_OCR
838843
app.state.config.DOCLING_FORCE_OCR = DOCLING_FORCE_OCR
839844
app.state.config.DOCLING_OCR_ENGINE = DOCLING_OCR_ENGINE
@@ -1095,11 +1100,15 @@ async def lifespan(app: FastAPI):
10951100
app.state.config.AUDIO_STT_AZURE_BASE_URL = AUDIO_STT_AZURE_BASE_URL
10961101
app.state.config.AUDIO_STT_AZURE_MAX_SPEAKERS = AUDIO_STT_AZURE_MAX_SPEAKERS
10971102

1098-
app.state.config.TTS_OPENAI_API_BASE_URL = AUDIO_TTS_OPENAI_API_BASE_URL
1099-
app.state.config.TTS_OPENAI_API_KEY = AUDIO_TTS_OPENAI_API_KEY
11001103
app.state.config.TTS_ENGINE = AUDIO_TTS_ENGINE
1104+
11011105
app.state.config.TTS_MODEL = AUDIO_TTS_MODEL
11021106
app.state.config.TTS_VOICE = AUDIO_TTS_VOICE
1107+
1108+
app.state.config.TTS_OPENAI_API_BASE_URL = AUDIO_TTS_OPENAI_API_BASE_URL
1109+
app.state.config.TTS_OPENAI_API_KEY = AUDIO_TTS_OPENAI_API_KEY
1110+
app.state.config.TTS_OPENAI_PARAMS = AUDIO_TTS_OPENAI_PARAMS
1111+
11031112
app.state.config.TTS_API_KEY = AUDIO_TTS_API_KEY
11041113
app.state.config.TTS_SPLIT_ON = AUDIO_TTS_SPLIT_ON
11051114

@@ -1170,12 +1179,32 @@ async def dispatch(self, request: Request, call_next):
11701179
path = request.url.path
11711180
query_params = dict(parse_qs(urlparse(str(request.url)).query))
11721181

1182+
redirect_params = {}
1183+
11731184
# Check for the specific watch path and the presence of 'v' parameter
11741185
if path.endswith("/watch") and "v" in query_params:
11751186
# Extract the first 'v' parameter
1176-
video_id = query_params["v"][0]
1177-
encoded_video_id = urlencode({"youtube": video_id})
1178-
redirect_url = f"/?{encoded_video_id}"
1187+
youtube_video_id = query_params["v"][0]
1188+
redirect_params["youtube"] = youtube_video_id
1189+
1190+
if "shared" in query_params and len(query_params["shared"]) > 0:
1191+
# PWA share_target support
1192+
1193+
text = query_params["shared"][0]
1194+
if text:
1195+
urls = re.match(r"https://\S+", text)
1196+
if urls:
1197+
from open_webui.retrieval.loaders.youtube import _parse_video_id
1198+
1199+
if youtube_video_id := _parse_video_id(urls[0]):
1200+
redirect_params["youtube"] = youtube_video_id
1201+
else:
1202+
redirect_params["load-url"] = urls[0]
1203+
else:
1204+
redirect_params["q"] = text
1205+
1206+
if redirect_params:
1207+
redirect_url = f"/?{urlencode(redirect_params)}"
11791208
return RedirectResponse(url=redirect_url)
11801209

11811210
# Proceed with the normal flow of other requests
@@ -1474,7 +1503,7 @@ async def chat_completion(
14741503
}
14751504

14761505
if metadata.get("chat_id") and (user and user.role != "admin"):
1477-
if metadata["chat_id"] != "local":
1506+
if not metadata["chat_id"].startswith("local:"):
14781507
chat = Chats.get_chat_by_id_and_user_id(metadata["chat_id"], user.id)
14791508
if chat is None:
14801509
raise HTTPException(
@@ -1501,13 +1530,14 @@ async def process_chat(request, form_data, user, metadata, model):
15011530
response = await chat_completion_handler(request, form_data, user)
15021531
if metadata.get("chat_id") and metadata.get("message_id"):
15031532
try:
1504-
Chats.upsert_message_to_chat_by_id_and_message_id(
1505-
metadata["chat_id"],
1506-
metadata["message_id"],
1507-
{
1508-
"model": model_id,
1509-
},
1510-
)
1533+
if not metadata["chat_id"].startswith("local:"):
1534+
Chats.upsert_message_to_chat_by_id_and_message_id(
1535+
metadata["chat_id"],
1536+
metadata["message_id"],
1537+
{
1538+
"model": model_id,
1539+
},
1540+
)
15111541
except:
15121542
pass
15131543

@@ -1528,13 +1558,14 @@ async def process_chat(request, form_data, user, metadata, model):
15281558
if metadata.get("chat_id") and metadata.get("message_id"):
15291559
# Update the chat message with the error
15301560
try:
1531-
Chats.upsert_message_to_chat_by_id_and_message_id(
1532-
metadata["chat_id"],
1533-
metadata["message_id"],
1534-
{
1535-
"error": {"content": str(e)},
1536-
},
1537-
)
1561+
if not metadata["chat_id"].startswith("local:"):
1562+
Chats.upsert_message_to_chat_by_id_and_message_id(
1563+
metadata["chat_id"],
1564+
metadata["message_id"],
1565+
{
1566+
"error": {"content": str(e)},
1567+
},
1568+
)
15381569

15391570
event_emitter = get_event_emitter(metadata)
15401571
await event_emitter(
@@ -1903,13 +1934,20 @@ async def get_current_usage(user=Depends(get_verified_user)):
19031934
"oauth_client_info", ""
19041935
)
19051936

1906-
oauth_client_info = decrypt_data(oauth_client_info)
1907-
app.state.oauth_client_manager.add_client(
1908-
f"mcp:{server_id}", OAuthClientInformationFull(**oauth_client_info)
1909-
)
1937+
try:
1938+
oauth_client_info = decrypt_data(oauth_client_info)
1939+
app.state.oauth_client_manager.add_client(
1940+
f"mcp:{server_id}",
1941+
OAuthClientInformationFull(**oauth_client_info),
1942+
)
1943+
except Exception as e:
1944+
log.error(
1945+
f"Error adding OAuth client for MCP tool server {server_id}: {e}"
1946+
)
1947+
pass
19101948

19111949
try:
1912-
if REDIS_URL:
1950+
if ENABLE_STAR_SESSIONS_MIDDLEWARE:
19131951
redis_session_store = RedisStore(
19141952
url=REDIS_URL,
19151953
prefix=(f"{REDIS_KEY_PREFIX}:session:" if REDIS_KEY_PREFIX else "session:"),
@@ -2004,6 +2042,11 @@ async def get_manifest_json():
20042042
"purpose": "maskable",
20052043
},
20062044
],
2045+
"share_target": {
2046+
"action": "/",
2047+
"method": "GET",
2048+
"params": {"text": "shared"},
2049+
},
20072050
}
20082051

20092052

0 commit comments

Comments
 (0)