feat(conversation): TTS 投递与 WebSocket 管线;客户端播放门禁与会话页联动;COS 键与迁移脚本调整

This commit is contained in:
Kevin
2026-03-26 15:51:24 +08:00
parent c23931ec91
commit d990399112
22 changed files with 630 additions and 74 deletions

View File

@@ -49,6 +49,7 @@ function mapServerMessage(raw: RawServerMessage): WsEvent | null {
audioUrl: d.audio_url as string | undefined,
index: d.index as number | undefined,
total: d.total as number | undefined,
assistantMessageId: d.assistant_message_id as string | undefined,
};
case 'end_conversation':
@@ -166,6 +167,10 @@ export class WsClient {
return this.send({ type: 'text', data: { text } });
}
sendTtsCancel(): boolean {
return this.send({ type: 'tts_cancel', data: {} });
}
sendEndConversation(): boolean {
return this.send({ type: 'end_conversation', data: {} });
}

View File

@@ -14,6 +14,7 @@ export type ClientMessageType =
| 'audio_segment'
| 'audio_message'
| 'transcribe_only'
| 'tts_cancel'
| 'end_conversation';
export interface RawServerMessage {
@@ -63,6 +64,8 @@ export interface TtsAudioReceivedEvent {
audioUrl?: string;
index?: number;
total?: number;
/** 持久化后的助手消息 id与 REST `messages` 中 `id` 对齐) */
assistantMessageId?: string;
}
export interface ConversationEndedEvent {