feat: 语音

This commit is contained in:
电摇小子
2026-08-05 09:45:59 +08:00
committed by Wxw-Gu
parent 69bc6f57e7
commit 7529a67f09
49 changed files with 3013 additions and 154 deletions
+1
View File
@@ -24,6 +24,7 @@ export interface ExportRequest {
endTime?: number
kinds: ExportMessageKind[]
includeMedia: boolean
includeVoiceTranscripts?: boolean
preferOriginal?: boolean
fallbackThumbnail?: boolean
keepMissing?: boolean
+2
View File
@@ -23,6 +23,8 @@ export interface Message {
contentData?: ParsedContent
voiceDataUrl?: string
voiceDuration?: number
voiceTranscript?: string
voiceTranscriptError?: string
localId?: number
serverId?: string
createTime?: number
+58
View File
@@ -0,0 +1,58 @@
export const DEFAULT_VOICE_MODEL_ID = 'sensevoice-small-int8'
export interface VoiceMessageReference {
sessionId: string
localId: number
createTime: number
svrId?: string | number
}
export type VoiceModelState =
| 'missing'
| 'downloading'
| 'ready'
| 'invalid'
| 'error'
| 'unsupported'
export interface VoiceModelStatus {
modelId: string
version: string
state: VoiceModelState
downloadedBytes: number
totalBytes: number
progress: number
platform: NodeJS.Platform
architecture: string
supported: boolean
error?: string
}
export interface VoiceModelDownloadResult {
success: boolean
status: VoiceModelStatus
error?: string
}
export type VoiceRecognitionErrorCode =
| 'NOT_CONNECTED'
| 'MODEL_NOT_READY'
| 'VOICE_NOT_FOUND'
| 'DECODE_FAILED'
| 'EMPTY_AUDIO'
| 'CANCELLED'
| 'TIMEOUT'
| 'WORKER_FAILED'
| 'RECOGNITION_FAILED'
export interface VoiceRecognitionResult {
success: boolean
transcript?: string
language?: string
durationMs?: number
cached?: boolean
error?: string
code?: VoiceRecognitionErrorCode
}
export interface VoiceModelProgressEvent extends VoiceModelStatus {}