-- 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', '{"secret-id":"","secret-key":"","voice-id":"","endpoint":"mps.tencentcloudapi.com","version":"2019-06-12","action":"SyncDubbing","region":"","text-lang":"zh","resource-id":"","sample-rate":"8000","pitch":"0","connect-timeout-ms":"10000","verify-peer":"false"}', 'tts', 1);

DELETE FROM `fs_variables`
WHERE `cat` = 5
  AND `var_field_name` IN (
    'secret-id',
    'secret-key',
    'voice-id',
    'endpoint',
    'version',
    'action',
    'region',
    'text-lang',
    'resource-id',
    'sample-rate',
    'pitch',
    'connect-timeout-ms',
    'verify-peer'
  );

INSERT INTO `fs_variables` (`cat`, `var_field_name`, `var_field_alias`) VALUES
(5, 'secret-id', 'SecretId'),
(5, 'secret-key', 'SecretKey'),
(5, 'voice-id', '音色ID'),
(5, 'endpoint', '接口域名'),
(5, 'version', '接口版本'),
(5, 'action', '接口动作'),
(5, 'region', '地域'),
(5, 'text-lang', '文本语言'),
(5, 'resource-id', '资源ID'),
(5, 'sample-rate', '采样率'),
(5, 'pitch', '音调'),
(5, 'connect-timeout-ms', '连接超时(毫秒)'),
(5, 'verify-peer', '校验证书');

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