Skip to content

Commit 36a5749

Browse files
committed
Add emotion editor preview playback
1 parent 9b8af1f commit 36a5749

6 files changed

Lines changed: 285 additions & 319 deletions

File tree

assets/toolbox/text-to-speech/js/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,7 @@ function initializeTextToSpeechTool(root = document, { engine = new TextToSpeech
789789
const usageCell = createCell(emotion ? String(emotion.usageCount || emotion.messagePartsUsageCount || 0) : "0");
790790
const actionsCell = document.createElement("td");
791791
actionsCell.append(createActionGroup(
792+
createButton("Play", "ttsPlayEditingEmotion", key),
792793
createButton("Save", "ttsCommitEmotion", key),
793794
createButton("Cancel", "ttsCancelEmotion", key),
794795
));
@@ -1024,6 +1025,15 @@ function initializeTextToSpeechTool(root = document, { engine = new TextToSpeech
10241025
writeStatus("Ready to add an emotion.");
10251026
}
10261027

1028+
function playEditingEmotion(key) {
1029+
const profile = selectedProfile();
1030+
const emotion = emotionValues(key);
1031+
if (key !== NEW_ROW_KEY) {
1032+
state.selectedEmotionId = key;
1033+
}
1034+
speakEmotion(profile, emotion);
1035+
}
1036+
10271037
function commitEmotion(key) {
10281038
if (!requireAuthenticatedWrite("saving Text To Speech emotion settings")) {
10291039
return;
@@ -1262,6 +1272,7 @@ function initializeTextToSpeechTool(root = document, { engine = new TextToSpeech
12621272
const commitEmotionButton = event.target.closest("[data-tts-commit-emotion]");
12631273
const cancelEmotionButton = event.target.closest("[data-tts-cancel-emotion]");
12641274
const deleteEmotionButton = event.target.closest("[data-tts-delete-emotion]");
1275+
const playEditingEmotionButton = event.target.closest("[data-tts-play-editing-emotion]");
12651276
const playEmotionButton = event.target.closest("[data-tts-play-emotion]");
12661277
const deleteProfileButton = event.target.closest("[data-tts-delete-profile]");
12671278
const emotionRow = event.target.closest("[data-tts-emotion-row]");
@@ -1305,6 +1316,10 @@ function initializeTextToSpeechTool(root = document, { engine = new TextToSpeech
13051316
addEmotion(addEmotionButton.dataset.ttsAddEmotion);
13061317
return;
13071318
}
1319+
if (playEditingEmotionButton) {
1320+
playEditingEmotion(playEditingEmotionButton.dataset.ttsPlayEditingEmotion);
1321+
return;
1322+
}
13081323
if (commitEmotionButton) {
13091324
commitEmotion(commitEmotionButton.dataset.ttsCommitEmotion);
13101325
return;
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# PR_26177_BRAVO_012-add-emotion-editor-preview
2+
3+
## Branch Validation
4+
- PASS: Work stayed on `bravo/26177-text-to-speech`.
5+
- PASS: Main was not checked out.
6+
- PASS: No `start_of_day` folders were modified.
7+
8+
## Scope Summary
9+
- Added Emotion editor preview playback while an emotion row is open inline.
10+
- Kept editor action order as `Play | Save | Cancel`.
11+
- Preview reads current editor Pitch, Rate, Volume, and selected Emotion without saving.
12+
- Preview continues to inherit the parent TTS Profile voice, language, gender, and age filter through the existing TTS V2 preview path.
13+
- Save remains the only persistence path and still routes guests to `account/sign-in.html`.
14+
- Cancel continues to discard unsaved editor changes by closing the inline editor and rerendering saved profile data.
15+
16+
## Requirement Checklist
17+
- PASS: Edit mode displays `Play`, `Save`, and `Cancel`.
18+
- PASS: Button order is `Play | Save | Cancel`.
19+
- PASS: Play uses current editor values without saving.
20+
- PASS: Play inherits parent TTS Profile voice, language, gender, and age filter.
21+
- PASS: Play uses edited Pitch, Rate, Volume, and selected Emotion settings.
22+
- PASS: Play does not modify the database.
23+
- PASS: Save persists current values through the existing authenticated Local API flow.
24+
- PASS: Guest Save redirect to `account/sign-in.html` is preserved.
25+
- PASS: Cancel restores original saved values by discarding the unsaved editor row.
26+
- PASS: Targeted tests were updated.
27+
- PASS: No governance changes or unrelated cleanup.
28+
29+
## File Inventory
30+
- `assets/toolbox/text-to-speech/js/index.js`
31+
- `tests/playwright/tools/TextToSpeechFunctional.spec.mjs`
32+
- `tests/tools/Text2SpeechShell.test.mjs`
33+
- `docs_build/dev/reports/PR_26177_BRAVO_012-add-emotion-editor-preview.md`
34+
- `docs_build/dev/reports/codex_changed_files.txt`
35+
- `docs_build/dev/reports/codex_review.diff`
36+
37+
## Test Inventory
38+
- Updated the Text To Speech functional Playwright flow to assert editor button order, unsaved preview pitch/rate/volume, inherited parent voice/language, unchanged API values after Play, and Cancel restoration.
39+
- Added a focused Node source-level test that verifies the editor Play action is ordered before Save/Cancel, reads `emotionValues(key)`, calls `speakEmotion(profile, emotion)`, and does not call save/auth write helpers.
40+
41+
## Validation Lane Report
42+
- PASS: `node --check assets/toolbox/text-to-speech/js/index.js`
43+
- PASS: `node --check tests/playwright/tools/TextToSpeechFunctional.spec.mjs`
44+
- PASS: `node --check tests/tools/Text2SpeechShell.test.mjs`
45+
- PASS: `node --test tests/tools/Text2SpeechShell.test.mjs` (7/7)
46+
- PASS: `git diff --check -- .`
47+
- BLOCKED: `npx playwright test tests/playwright/tools/TextToSpeechFunctional.spec.mjs --project=playwright`
48+
- Browser launch failed before page code ran because Chromium is missing at `C:\Users\davidq\AppData\Local\ms-playwright\chromium-1217\chrome-win64\chrome.exe`.
49+
50+
## Manual Validation Notes
51+
- Reviewed the editor Play flow to confirm it does not call `requireAuthenticatedWrite`, `saveProfileEmotionSettings`, `createTtsProfile`, or `updateTtsProfile`.
52+
- Reviewed that parent voice, language, gender, and age filter are still supplied by `speakEmotion(profile, emotion)`.
53+
- Browser/manual UI validation remains blocked by the missing local Playwright Chromium install.
54+
55+
## Known Issues
56+
- Playwright browser validation cannot complete in this environment until the matching Chromium browser is installed.
57+
58+
## Repo-Structured ZIP
59+
- `tmp/PR_26177_BRAVO_012-add-emotion-editor-preview_delta.zip`
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
assets/toolbox/text-to-speech/js/index.js
22
docs_build/dev/reports/codex_changed_files.txt
33
docs_build/dev/reports/codex_review.diff
4-
docs_build/dev/reports/PR_26177_BRAVO_009-force-delete-broken-tts-profiles.md
5-
src/dev-runtime/messages/messages-postgres-service.mjs
6-
tests/dev-runtime/MessagesPublishValidation.test.mjs
4+
docs_build/dev/reports/PR_26177_BRAVO_012-add-emotion-editor-preview.md
5+
tests/playwright/tools/TextToSpeechFunctional.spec.mjs
6+
tests/tools/Text2SpeechShell.test.mjs

0 commit comments

Comments
 (0)