[PR #22195] [MERGED] perf: guard TTS sentence parsing behind showCallOverlay check #81418

Closed
opened 2026-05-13 15:46:29 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/22195
Author: @Classic298
Created: 3/3/2026
Status: ✅ Merged
Merged: 3/6/2026
Merged by: @tjbck

Base: dev ← Head: perf/guard-tts-parsing-during-streaming


📝 Commits (1)

  • a9272d8 perf: guard TTS sentence parsing behind showCallOverlay check

📊 Changes

1 file changed (+58 additions, -52 deletions)

View changed files

📝 src/lib/components/chat/Chat.svelte (+58 -52)

📄 Description

The chatCompletionEventHandler runs getMessageContentParts() and removeAllDetails() on every streaming token to extract sentences for real-time TTS dispatch via CustomEvent('chat'). These functions perform multiple O(n) regex passes over the full accumulated message content, resulting in O(n^2) total work over a streaming response.

The only consumer of these events is CallOverlay.svelte, which is only mounted when showCallOverlay is true. Without the overlay open, the parsing runs but the dispatched events have no listeners.

Wrap all three TTS parsing blocks in an if () guard so the expensive regex work is skipped entirely for the vast majority of users who are not using the voice call feature.

This PR was tested extensively

with normal conversations

with call-mode conversations

with mixed conversations

TTS and STT

all work.

Contributor License Agreement

By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/22195 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 3/3/2026 **Status:** ✅ Merged **Merged:** 3/6/2026 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `perf/guard-tts-parsing-during-streaming` --- ### 📝 Commits (1) - [`a9272d8`](https://github.com/open-webui/open-webui/commit/a9272d859131679b000087259266b2e3677e90f9) perf: guard TTS sentence parsing behind showCallOverlay check ### 📊 Changes **1 file changed** (+58 additions, -52 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/components/chat/Chat.svelte` (+58 -52) </details> ### 📄 Description The chatCompletionEventHandler runs getMessageContentParts() and removeAllDetails() on every streaming token to extract sentences for real-time TTS dispatch via CustomEvent('chat'). These functions perform multiple O(n) regex passes over the full accumulated message content, resulting in O(n^2) total work over a streaming response. <ins>**The only consumer of these events is CallOverlay.svelte, which is only mounted when showCallOverlay is true. Without the overlay open, the parsing runs but the dispatched events have no listeners.**</ins> Wrap all three TTS parsing blocks in an if () guard so the expensive regex work is skipped entirely for the vast majority of users who are not using the voice call feature. # This PR was tested extensively with normal conversations with call-mode conversations with mixed conversations TTS and STT all work. ### Contributor License Agreement <!-- 🚨 DO NOT DELETE THE TEXT BELOW 🚨 Keep the "Contributor License Agreement" confirmation text intact. Deleting it will trigger the CLA-Bot to INVALIDATE your PR. --> By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. > [!NOTE] > Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-13 15:46:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#81418