feat: add script tts backend

This commit is contained in:
2026-05-17 16:36:06 +08:00
parent 1016111d19
commit 6b426c2b68
21 changed files with 808 additions and 5 deletions
+26
View File
@@ -0,0 +1,26 @@
CREATE TABLE IF NOT EXISTS t_tts_task (
id VARCHAR(64) PRIMARY KEY COMMENT 'Primary key',
user_id VARCHAR(64) NOT NULL COMMENT 'Owner user id',
source_type VARCHAR(50) NOT NULL COMMENT 'Source type, for example epic_script',
source_id VARCHAR(64) NOT NULL COMMENT 'Source content id',
text_hash VARCHAR(128) NOT NULL COMMENT 'Hash of cleaned text and voice',
text_length INT NOT NULL COMMENT 'Cleaned text length',
voice VARCHAR(64) NOT NULL DEFAULT 'default_zh_female' COMMENT 'Voice id',
status VARCHAR(20) NOT NULL DEFAULT 'pending' COMMENT 'pending, processing, success, failed',
audio_url VARCHAR(500) NULL COMMENT 'Public audio URL',
audio_path VARCHAR(500) NULL COMMENT 'Server audio path',
duration_ms BIGINT NULL COMMENT 'Audio duration',
error_message VARCHAR(1000) NULL COMMENT 'Failure message',
request_count INT NOT NULL DEFAULT 1 COMMENT 'Cache hit request count',
create_by VARCHAR(64) NULL COMMENT 'Creator',
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT 'Create time',
update_by VARCHAR(64) NULL COMMENT 'Updater',
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Update time',
is_deleted TINYINT DEFAULT 0 COMMENT 'Logic delete flag',
remarks VARCHAR(500) NULL COMMENT 'Remarks'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Text-to-speech task table';
CREATE INDEX idx_tts_task_user_source ON t_tts_task (user_id, source_type, source_id);
CREATE INDEX idx_tts_task_text_hash ON t_tts_task (text_hash);
CREATE INDEX idx_tts_task_status ON t_tts_task (status);
CREATE INDEX idx_tts_task_create_time ON t_tts_task (create_time);