feat(stage-tamagotchi): universal TTS stop button in controls island (#2072)

Co-authored-by: RainbowBird <git@luoling.moe>
This commit is contained in:
Anfi1
2026-07-23 00:21:58 +08:00
committed by GitHub
co-authored by RainbowBird
parent 5228f94123
commit 42925e58f5
17 changed files with 189 additions and 3 deletions
@@ -55,4 +55,18 @@ describe('useStopSpeakingButton', () => {
reason: 'manual-chat',
})
})
it('requests a manual-all stop without touching chat input state', () => {
requestStopSpeakingMock.mockClear()
trackTtsStopClickedMock.mockClear()
const { stopAllSpeaking } = useStopSpeakingButton()
stopAllSpeaking()
expect(requestStopSpeakingMock).toHaveBeenCalledWith('manual-all')
expect(trackTtsStopClickedMock).toHaveBeenCalledWith({
reason: 'manual-all',
})
})
})
@@ -14,7 +14,7 @@ import { computed } from 'vue'
* - A Stage instance is mounted and consumes speech output stop requests.
*
* Returns:
* - Visibility state for the button and a click handler for manual chat stops.
* - Visibility state for the button and click handlers for manual stops.
*/
export function useStopSpeakingButton() {
const { nowSpeaking } = storeToRefs(useSpeakingStore())
@@ -28,8 +28,14 @@ export function useStopSpeakingButton() {
speechOutputControlStore.requestStopSpeaking('manual-chat')
}
function stopAllSpeaking() {
trackTtsStopClicked({ reason: 'manual-all' })
speechOutputControlStore.requestStopSpeaking('manual-all')
}
return {
showStopSpeakingButton,
stopSpeakingFromChat,
stopAllSpeaking,
}
}