-- 2026-06-16
-- Add Tencent Cloud TTS bridge configuration for mod_tx_tts1.

DELETE FROM `sys_role_menu`
WHERE `menu_id` = 4027;

DELETE FROM `sys_menu`
WHERE `menu_id` = 4027
   OR `perms` = 'cc:txtts1conf:view'
   OR `url` = '/cc/fsconf/txtts1conf';

INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `menu_code`, `parent_id`, `order_num`, `url`, `target`, `menu_type`, `visible`, `is_refresh`, `perms`, `icon`, `create_by`, `create_time`, `remark`)
VALUES (4027, '腾讯云TTS配置', 'txtts1conf', 3019, 9, '/cc/fsconf/txtts1conf', 'menuItem', 'C', '0', '1', 'cc:txtts1conf:view', '#', 'admin', NOW(), 'mod_tx_tts1 参数配置菜单');

INSERT INTO `sys_role_menu` (`role_id`, `menu_id`)
VALUES (2, 4027);

DELETE FROM `sys_config`
WHERE `config_key` = 'config_tts_provider_tx_tts1';

INSERT INTO `sys_config` (`config_name`, `config_key`, `config_value`, `config_type`, `create_by`, `create_time`, `remark`)
VALUES ('腾讯云', 'config_tts_provider_tx_tts1', 'tx_tts1', 'Y', 'admin', NOW(), 'TTS厂商-腾讯云');

DELETE FROM `cc_params`
WHERE `param_code` = 'tx-tts1-account-json';

INSERT INTO `cc_params` (`param_name`, `param_code`, `param_value`, `param_type`, `hide_value`)
VALUES ('腾讯云tts账号参数json', 'tx-tts1-account-json', '{"appid":"","secret-id":""
,"secret-key":"","voice-id":"","websocket-host":"mps.cloud.tencent.com","text-lang":"zh","format":"ulaw","sample-rate":"8000","timeout-sec":"60","speed":"0","vol":"0","pitch":"","intensity":"","timbre":"","sound-effect":"","res-id":"","signature-expire-seconds":"3600","connect-timeout-ms":"10000","verify-peer":"false"}', 'tts', 1);
DELETE FROM `fs_variables`
WHERE `cat` = 5
  AND `var_field_name` IN (
    'appid',
    'secret-id',
    'secret-key',
    'voice-id',
    'websocket-host',
    'text-lang',
    'format',
    'sample-rate',
    'timeout-sec',
    'speed',
    'vol',
    'pitch',
    'intensity',
    'timbre',
    'sound-effect',
    'res-id',
    'signature-expire-seconds',
    'connect-timeout-ms',
    'verify-peer'
  );

INSERT INTO `fs_variables` (`cat`, `var_field_name`, `var_field_alias`) VALUES
(5, 'appid', 'AppId'),
(5, 'secret-id', 'SecretId'),
(5, 'secret-key', 'SecretKey'),
(5, 'voice-id', '音色ID'),
(5, 'websocket-host', 'WebSocket域名'),
(5, 'text-lang', '文本语言'),
(5, 'format', '音频格式'),
(5, 'sample-rate', '采样率'),
(5, 'timeout-sec', '会话超时(秒)'),
(5, 'speed', '语速'),
(5, 'vol', '音量'),
(5, 'pitch', '音高 Pitch'),
(5, 'intensity', '强度 Intensity'),
(5, 'timbre', '音色 Timbre'),
(5, 'sound-effect', '音效 Effect'),
(5, 'res-id', '资源标签'),
(5, 'signature-expire-seconds', '签名有效期(秒)'),
(5, 'connect-timeout-ms', '连接超时(毫秒)'),
(5, 'verify-peer', '校验证书');

-- 音色列表请在音色管理中维护 `voice_source=tx_tts1` 的系统音色或克隆音色。
