[PR #8370] [MERGED] feat(tts): voice personas through existing character assignments #8322

Closed
opened 2026-10-27 06:07:42 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8370
Author: @SpicyMarinara
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/8369-persona-tts-voices


📝 Commits (3)

  • 1cd16c7 chore: start persona TTS voice support for #8369
  • 783f644 feat(tts): reuse voice assignments for persona speech
  • 48352a2 fix(tts): isolate persona playback events and Game voice state

📊 Changes

16 files changed (+1102 additions, -79 deletions)

View changed files

📝 e2e/core-flows.e2e.ts (+3 -3)
➕ e2e/persona-tts.e2e.ts (+329 -0)
📝 packages/client/src/components/chat/ChatArea.tsx (+101 -26)
📝 packages/client/src/components/chat/ChatMessage.tsx (+17 -6)
📝 packages/client/src/components/game/GameNarration.tsx (+59 -18)
📝 packages/client/src/components/panels/settings/TTSConfigCard.tsx (+21 -10)
📝 packages/client/src/features/avatars/director/avatar-director.ts (+6 -1)
📝 packages/client/src/hooks/use-chats.ts (+3 -1)
📝 packages/client/src/hooks/use-generate.ts (+2 -0)
📝 packages/client/src/lib/tts-autoplay.ts (+21 -0)
📝 packages/client/src/lib/tts-dialogue.ts (+61 -1)
📝 packages/client/src/lib/tts-roleplay-speaker-extractor.ts (+20 -2)
📝 packages/client/src/localization/locales/en.json (+14 -10)
📝 scripts/regressions/avatar-director.regression.ts (+67 -0)
📝 scripts/regressions/game-tts-emotion.regression.ts (+150 -1)
📝 scripts/regressions/tts-source-persistence.regression.ts (+228 -0)

📄 Description

Linked issue

Closes #8369

Why this change

Personas need the same voice assignment path as characters. The maintainer explicitly requested reusing the existing fields and confirmed that narration should include both messages they send and persona dialogue generated in the story.

What changed

  • Include personas in the existing TTS connection voice selector, distinguish them in the list, and save their real IDs and names in the existing voice-assignment rows.
  • Read newly committed persona messages in Conversation, Roleplay and Game when that mode's autoplay toggle and the persona's assigned voice are enabled. Both ordinary generation-stream sends and manual/delayed sends reuse the existing message-ready event.
  • Resolve generated persona dialogue, including Roleplay speaker extraction and Game narration, through the same voice assignments. Existing message replay uses its saved persona snapshot after the current persona changes.
  • Queue sent-message speech before replies and keep Game audio from overlapping it. Hidden user rows and Engine combat/item result reports do not become persona speech; opening or refreshing history does not replay sent messages.
  • Keep sent messages out of the avatar director's character-reply feed while retaining persona audio lip sync. Scope Game playback blocking to admitted persona readings and preserve finished main/side voice markers across previews.
  • Update the existing TTS labels and regression coverage. Existing character/narrator/shared voice fallbacks remain intact, including the NPC fallback covered by the new comparison tests.

No new persisted fields, persona properties, mode toggles, provider choices or dependencies.

Validation

Tested source: 48352a29aeb65bb4038537241b6b5eed687c9fe0; source hashes are unchanged from the validated working diff.

  • pnpm install --frozen-lockfile: passed without lockfile changes.
  • pnpm check: passed on the final patch (zero lint errors; one pre-existing HomeProfessorMariChat hook warning).
  • node scripts/run-regressions.mjs --filter tts --concurrency 2: 13/13 passed, including real assignment-route persistence, persona/snapshot resolution, audio sequencing and Game result policies.
  • Actual avatar-director regression: 1/1 passed with real store/events under streaming on and off, including persona audio ownership.
  • node scripts/run-regressions.mjs --filter roleplay-streaming --concurrency 1: 1/1 passed; generated-message recovery remains assistant/narrator-only.
  • New persona TTS browser suite: 12/12 passed across desktop Chromium, mobile Chromium and mobile WebKit. Covers assignment transport/refetch, same-name selection, all three modes, sent-message deduplication, mode-off/no-assignment gates, historical persona replay, Game combat-report exclusion, and no replay of finished Game narration after an unrelated voice preview.
  • After the Dottore repairs, all seven desktop shell smoke cases passed again. Before those repairs, nine desktop cases (including ElevenLabs assignment controls and delayed speech playback) and two mobile delayed-speech cases passed; their UI/TTS-service code is unchanged by the repair.
  • Local CodeRabbit: first pass produced two comments for one unique combat-report defect; reproduced, repaired and retested. Follow-up review completed across all 14 initial feature files with zero findings. After the two Dottore repairs below, local review covered the five repair files and completed with zero findings.
  • Inspected desktop and mobile WebKit assignment screenshots in both dark and light themes. No CSS/layout redesign.

Browser commands used disposable Engine test data and ports 7861–7864, with at most two workers. A runner artifact-directory collision was corrected by rerunning the unchanged desktop checks separately; no assertions, skips or timeouts were loosened.

The new browser suite uses a local model fixture and synthetic speech audio. It exercises the real selector, saved-message hooks, generation stream, voice requests, mode gates, historical replay and Game navigation. The selector save transport is intercepted per page; the existing real TTS assignment route regression separately covers storage writes and profile preservation.

Manual verification tasks

  • Manually assign a real provider voice to a persona and listen to sent and generated dialogue in Conversation, Roleplay and Game.
  • Manually verify playback on a physical iPhone and Android phone, including browser audio permission prompts.

Review fixes and proof boundaries

The first CodeRabbit pass produced two comments about one defect: Engine-generated combat reports use user-message rows. The actual Game browser regression reproduced that unwanted speech. The fix reuses the existing complete Engine result-block parser and also covers item reports, without suppressing ordinary or incomplete/literal marker text.

Dottore's first full review identified two additional defects. Both were independently reproduced and repaired: a sent-user event drove a character avatar for 800 ms before the reply, and a blocking transition discarded finished Game voice markers. The actual avatar event/store and Game effect regressions now pass, while the browser preview regression passes in all three projects. Existing persona speech and character/narrator controls remain passing.

Browser emulation and fixture-provider checks do not establish physical-device or real-provider results. The new sent-message autoplay requires an explicit persona assignment under the existing per-character voice mode; existing unassigned/shared/manual behavior remains available.

Docs and release impact

Canonical English UI copy is updated; community catalogs retain their normal English fallback. No user-facing guide, release metadata, storage format or changelog changes.


🔄 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/Pasta-Devs/Marinara-Engine/pull/8370 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/8369-persona-tts-voices` --- ### 📝 Commits (3) - [`1cd16c7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1cd16c7cac121396e8efab7d56a26675fe196cea) chore: start persona TTS voice support for #8369 - [`783f644`](https://github.com/Pasta-Devs/Marinara-Engine/commit/783f644d10b23bcdfe919452659bf0de51a0b83a) feat(tts): reuse voice assignments for persona speech - [`48352a2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/48352a29aeb65bb4038537241b6b5eed687c9fe0) fix(tts): isolate persona playback events and Game voice state ### 📊 Changes **16 files changed** (+1102 additions, -79 deletions) <details> <summary>View changed files</summary> 📝 `e2e/core-flows.e2e.ts` (+3 -3) ➕ `e2e/persona-tts.e2e.ts` (+329 -0) 📝 `packages/client/src/components/chat/ChatArea.tsx` (+101 -26) 📝 `packages/client/src/components/chat/ChatMessage.tsx` (+17 -6) 📝 `packages/client/src/components/game/GameNarration.tsx` (+59 -18) 📝 `packages/client/src/components/panels/settings/TTSConfigCard.tsx` (+21 -10) 📝 `packages/client/src/features/avatars/director/avatar-director.ts` (+6 -1) 📝 `packages/client/src/hooks/use-chats.ts` (+3 -1) 📝 `packages/client/src/hooks/use-generate.ts` (+2 -0) 📝 `packages/client/src/lib/tts-autoplay.ts` (+21 -0) 📝 `packages/client/src/lib/tts-dialogue.ts` (+61 -1) 📝 `packages/client/src/lib/tts-roleplay-speaker-extractor.ts` (+20 -2) 📝 `packages/client/src/localization/locales/en.json` (+14 -10) 📝 `scripts/regressions/avatar-director.regression.ts` (+67 -0) 📝 `scripts/regressions/game-tts-emotion.regression.ts` (+150 -1) 📝 `scripts/regressions/tts-source-persistence.regression.ts` (+228 -0) </details> ### 📄 Description ## Linked issue Closes #8369 ## Why this change Personas need the same voice assignment path as characters. The maintainer explicitly requested reusing the existing fields and confirmed that narration should include both messages they send and persona dialogue generated in the story. ## What changed - Include personas in the existing TTS connection voice selector, distinguish them in the list, and save their real IDs and names in the existing voice-assignment rows. - Read newly committed persona messages in Conversation, Roleplay and Game when that mode's autoplay toggle and the persona's assigned voice are enabled. Both ordinary generation-stream sends and manual/delayed sends reuse the existing message-ready event. - Resolve generated persona dialogue, including Roleplay speaker extraction and Game narration, through the same voice assignments. Existing message replay uses its saved persona snapshot after the current persona changes. - Queue sent-message speech before replies and keep Game audio from overlapping it. Hidden user rows and Engine combat/item result reports do not become persona speech; opening or refreshing history does not replay sent messages. - Keep sent messages out of the avatar director's character-reply feed while retaining persona audio lip sync. Scope Game playback blocking to admitted persona readings and preserve finished main/side voice markers across previews. - Update the existing TTS labels and regression coverage. Existing character/narrator/shared voice fallbacks remain intact, including the NPC fallback covered by the new comparison tests. No new persisted fields, persona properties, mode toggles, provider choices or dependencies. ## Validation Tested source: `48352a29aeb65bb4038537241b6b5eed687c9fe0`; source hashes are unchanged from the validated working diff. - `pnpm install --frozen-lockfile`: passed without lockfile changes. - `pnpm check`: passed on the final patch (zero lint errors; one pre-existing HomeProfessorMariChat hook warning). - `node scripts/run-regressions.mjs --filter tts --concurrency 2`: 13/13 passed, including real assignment-route persistence, persona/snapshot resolution, audio sequencing and Game result policies. - Actual avatar-director regression: 1/1 passed with real store/events under streaming on and off, including persona audio ownership. - `node scripts/run-regressions.mjs --filter roleplay-streaming --concurrency 1`: 1/1 passed; generated-message recovery remains assistant/narrator-only. - New persona TTS browser suite: 12/12 passed across desktop Chromium, mobile Chromium and mobile WebKit. Covers assignment transport/refetch, same-name selection, all three modes, sent-message deduplication, mode-off/no-assignment gates, historical persona replay, Game combat-report exclusion, and no replay of finished Game narration after an unrelated voice preview. - After the Dottore repairs, all seven desktop shell smoke cases passed again. Before those repairs, nine desktop cases (including ElevenLabs assignment controls and delayed speech playback) and two mobile delayed-speech cases passed; their UI/TTS-service code is unchanged by the repair. - Local CodeRabbit: first pass produced two comments for one unique combat-report defect; reproduced, repaired and retested. Follow-up review completed across all 14 initial feature files with zero findings. After the two Dottore repairs below, local review covered the five repair files and completed with zero findings. - Inspected desktop and mobile WebKit assignment screenshots in both dark and light themes. No CSS/layout redesign. Browser commands used disposable Engine test data and ports 7861–7864, with at most two workers. A runner artifact-directory collision was corrected by rerunning the unchanged desktop checks separately; no assertions, skips or timeouts were loosened. The new browser suite uses a local model fixture and synthetic speech audio. It exercises the real selector, saved-message hooks, generation stream, voice requests, mode gates, historical replay and Game navigation. The selector save transport is intercepted per page; the existing real TTS assignment route regression separately covers storage writes and profile preservation. ### Manual verification tasks - [ ] Manually assign a real provider voice to a persona and listen to sent and generated dialogue in Conversation, Roleplay and Game. - [ ] Manually verify playback on a physical iPhone and Android phone, including browser audio permission prompts. ### Review fixes and proof boundaries The first CodeRabbit pass produced two comments about one defect: Engine-generated combat reports use user-message rows. The actual Game browser regression reproduced that unwanted speech. The fix reuses the existing complete Engine result-block parser and also covers item reports, without suppressing ordinary or incomplete/literal marker text. Dottore's first full review identified two additional defects. Both were independently reproduced and repaired: a sent-user event drove a character avatar for 800 ms before the reply, and a blocking transition discarded finished Game voice markers. The actual avatar event/store and Game effect regressions now pass, while the browser preview regression passes in all three projects. Existing persona speech and character/narrator controls remain passing. Browser emulation and fixture-provider checks do not establish physical-device or real-provider results. The new sent-message autoplay requires an explicit persona assignment under the existing per-character voice mode; existing unassigned/shared/manual behavior remains available. ## Docs and release impact Canonical English UI copy is updated; community catalogs retain their normal English fallback. No user-facing guide, release metadata, storage format or changelog changes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-27 06:07:42 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8322
No description provided.