[GH-ISSUE #19861] issue: Sentence skipping in voice mode #57686

Open
opened 2026-05-05 21:24:02 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @QuitHub on GitHub (Dec 10, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/19861

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Git Clone

Open WebUI Version

v0.6.41

Ollama Version (if applicable)

No response

Operating System

macOS 15.7.1

Browser (if applicable)

No response

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

In voice mode you would expect that the TTS function would read all the lines of the response.

Actual Behavior

Some sentences get skipped.

The TTS event dispatching logic only tracks the last dispatched sentence using message.lastSentence and
only dispatches the second-to-last sentence from each update. This causes sentences to be skipped when:

  • Multiple sentences arrived in quick succession during streaming
  • Sentences were never in the "second-to-last" position during the streaming process
  • The single-sentence comparison couldn't track multiple complete sentences between updates

Steps to Reproduce

Ask gemini 3 pro in voice mode to read the first page of the bible (or alternative log text) with line numbers.

Logs & Screenshots

Example of skipping pattern:

Stream Update 1: [sentence1, sentence2] → dispatches sentence1 ✅
Stream Update 2: [sentence1-4] → dispatches sentence3 ✅ (sentence2 SKIPPED ❌)
Stream Update 3: [sentence1-7] → dispatches sentence6 ✅ (sentences 4, 5 SKIPPED ❌)

Additional Information

I have a fix:

Index-Based Sentence Tracking

Implemented an index-based sentence tracking system that:

  1. Maintains message.lastDispatchedIndex to track the array position of the last sentence that was dispatched
  2. Continues to remove the last (potentially incomplete) sentence during streaming
  3. Iterates through sentences from lastDispatchedIndex + 1 onwards and dispatches all new sentences
  4. Updates the index after each dispatch to prevent duplicates

This ensures every sentence is dispatched for TTS exactly once, including repeated sentences. For example, if the AI
says "Hello. Goodbye. Hello." all three sentences will be spoken.

Before (Stream Handler):

const messageContentParts = getMessageContentParts(/*...*/);
messageContentParts.pop();

if (messageContentParts.length > 0 &&
	messageContentParts[messageContentParts.length - 1] !== message.lastSentence) {
	message.lastSentence = messageContentParts[messageContentParts.length - 1];
	eventTarget.dispatchEvent(new CustomEvent('chat', {/*...*/ }));
}

After (Stream Handler):

const messageContentParts = getMessageContentParts(/*...*/);
messageContentParts.pop(); // Remove incomplete sentence

// Track last dispatched index instead of content to allow repeated sentences
if (message.lastDispatchedIndex === undefined) {
	message.lastDispatchedIndex = -1;
}

// Dispatch all new sentences from last dispatched index onwards
for (let i = message.lastDispatchedIndex + 1; i < messageContentParts.length; i++) {
	eventTarget.dispatchEvent(
		new CustomEvent('chat', {
			detail: { id: message.id, content: messageContentParts[i] }
		})
	);
	message.lastDispatchedIndex = i;
}
Originally created by @QuitHub on GitHub (Dec 10, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/19861 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!). - [x] I am using the latest version of Open WebUI. ### Installation Method Git Clone ### Open WebUI Version v0.6.41 ### Ollama Version (if applicable) _No response_ ### Operating System macOS 15.7.1 ### Browser (if applicable) _No response_ ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior In voice mode you would expect that the TTS function would read all the lines of the response. ### Actual Behavior Some sentences get skipped. The TTS event dispatching logic only tracks the last dispatched sentence using `message.lastSentence` and only dispatches the second-to-last sentence from each update. This causes sentences to be skipped when: - Multiple sentences arrived in quick succession during streaming - Sentences were never in the "second-to-last" position during the streaming process - The single-sentence comparison couldn't track multiple complete sentences between updates ### Steps to Reproduce Ask gemini 3 pro in voice mode to read the first page of the bible (or alternative log text) with line numbers. ### Logs & Screenshots **Example of skipping pattern:** ``` Stream Update 1: [sentence1, sentence2] → dispatches sentence1 ✅ Stream Update 2: [sentence1-4] → dispatches sentence3 ✅ (sentence2 SKIPPED ❌) Stream Update 3: [sentence1-7] → dispatches sentence6 ✅ (sentences 4, 5 SKIPPED ❌) ``` ### Additional Information I have a fix: Index-Based Sentence Tracking Implemented an **index-based sentence tracking system** that: 1. Maintains `message.lastDispatchedIndex` to track the array position of the last sentence that was dispatched 2. Continues to remove the last (potentially incomplete) sentence during streaming 3. Iterates through sentences from `lastDispatchedIndex + 1` onwards and dispatches all new sentences 4. Updates the index after each dispatch to prevent duplicates This ensures every sentence is dispatched for TTS exactly once, **including repeated sentences**. For example, if the AI says "Hello. Goodbye. Hello." all three sentences will be spoken. **Before (Stream Handler):** ```javascript const messageContentParts = getMessageContentParts(/*...*/); messageContentParts.pop(); if (messageContentParts.length > 0 && messageContentParts[messageContentParts.length - 1] !== message.lastSentence) { message.lastSentence = messageContentParts[messageContentParts.length - 1]; eventTarget.dispatchEvent(new CustomEvent('chat', {/*...*/ })); } ``` **After (Stream Handler):** ```javascript const messageContentParts = getMessageContentParts(/*...*/); messageContentParts.pop(); // Remove incomplete sentence // Track last dispatched index instead of content to allow repeated sentences if (message.lastDispatchedIndex === undefined) { message.lastDispatchedIndex = -1; } // Dispatch all new sentences from last dispatched index onwards for (let i = message.lastDispatchedIndex + 1; i < messageContentParts.length; i++) { eventTarget.dispatchEvent( new CustomEvent('chat', { detail: { id: message.id, content: messageContentParts[i] } }) ); message.lastDispatchedIndex = i; } ```
GiteaMirror added the bug label 2026-05-05 21:24:02 -05:00
Author
Owner

@owui-terminator[bot] commented on GitHub (Dec 10, 2025):

🔍 Similar Issues Found

I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions:

  1. #19777 issue:
    by Yaute7 • Dec 05, 2025 • bug

  2. #19563 issue:
    by naruto7g • Nov 28, 2025 • bug

  3. #19752 issue: minor UI Bug: knowledge sharing
    by mahenning • Dec 04, 2025 • bug

  4. #19211 issue:
    by Byrnes9 • Nov 16, 2025 • bug

  5. #14440 issue:
    by ehsan8203 • May 28, 2025 • bug

Show 5 more related issues
  1. #19417 issue: v0.6.37 SQL Error
    by AKHYP • Nov 24, 2025 • bug

  2. #19047 issue: followup questions sometimes fail to generate
    by avidwriter • Nov 08, 2025 • bug

  3. #19170 issue: Settings not honored or understood
    by itguy327 • Nov 13, 2025 • bug

  4. #16959 issue:
    by Te-eMster • Aug 27, 2025 • bug

  5. #17388 issue:
    by abxis • Sep 12, 2025 • bug


💡 Tips:

  • If this is a duplicate, please consider closing this issue and adding any additional details to the existing one
  • If you found a solution in any of these issues, please share it here to help others

This comment was generated automatically by a bot. Please react with a 👍 if this comment was helpful, or a 👎 if it was not.

<!-- gh-comment-id:3637423592 --> @owui-terminator[bot] commented on GitHub (Dec 10, 2025): 🔍 **Similar Issues Found** I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions: 1. [#19777](https://github.com/open-webui/open-webui/issues/19777) **issue:** *by Yaute7 • Dec 05, 2025 • `bug`* 2. [#19563](https://github.com/open-webui/open-webui/issues/19563) **issue:** *by naruto7g • Nov 28, 2025 • `bug`* 3. [#19752](https://github.com/open-webui/open-webui/issues/19752) **issue: minor UI Bug: knowledge sharing** *by mahenning • Dec 04, 2025 • `bug`* 4. [#19211](https://github.com/open-webui/open-webui/issues/19211) **issue:** *by Byrnes9 • Nov 16, 2025 • `bug`* 5. [#14440](https://github.com/open-webui/open-webui/issues/14440) **issue:** *by ehsan8203 • May 28, 2025 • `bug`* <details> <summary>Show 5 more related issues</summary> 6. [#19417](https://github.com/open-webui/open-webui/issues/19417) **issue: v0.6.37 SQL Error** *by AKHYP • Nov 24, 2025 • `bug`* 7. [#19047](https://github.com/open-webui/open-webui/issues/19047) **issue: followup questions sometimes fail to generate** *by avidwriter • Nov 08, 2025 • `bug`* 8. [#19170](https://github.com/open-webui/open-webui/issues/19170) **issue: Settings not honored or understood** *by itguy327 • Nov 13, 2025 • `bug`* 9. [#16959](https://github.com/open-webui/open-webui/issues/16959) **issue:** *by Te-eMster • Aug 27, 2025 • `bug`* 10. [#17388](https://github.com/open-webui/open-webui/issues/17388) **issue:** *by abxis • Sep 12, 2025 • `bug`* </details> --- 💡 **Tips:** - If this is a duplicate, please consider closing this issue and adding any additional details to the existing one - If you found a solution in any of these issues, please share it here to help others *This comment was generated automatically by a bot.* Please react with a 👍 if this comment was helpful, or a 👎 if it was not.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#57686