23 lines
551 B
TypeScript
23 lines
551 B
TypeScript
import { atom } from 'nanostores'
|
|
|
|
export type VoicePlaybackSource = 'read-aloud' | 'voice-conversation'
|
|
export type VoicePlaybackStatus = 'idle' | 'preparing' | 'speaking'
|
|
|
|
export interface VoicePlaybackState {
|
|
messageId: string | null
|
|
sequence: number
|
|
source: VoicePlaybackSource | null
|
|
status: VoicePlaybackStatus
|
|
}
|
|
|
|
export const $voicePlayback = atom<VoicePlaybackState>({
|
|
messageId: null,
|
|
sequence: 0,
|
|
source: null,
|
|
status: 'idle'
|
|
})
|
|
|
|
export function setVoicePlaybackState(next: VoicePlaybackState) {
|
|
$voicePlayback.set(next)
|
|
}
|