-- 2026-07-15
-- Add ViiTorTTS bridge configuration for mod_vt_tts.

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

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

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 (4033, 'ViiTorTTS配置', 'vtttsconf', 3019, 11, '/cc/fsconf/vtttsconf', 'menuItem', 'C', '0', '1', 'cc:vtttsconf:view', '#', 'admin', NOW(), 'mod_vt_tts 参数配置菜单');

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

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

INSERT INTO `sys_config` (`config_name`, `config_key`, `config_value`, `config_type`, `create_by`, `create_time`, `remark`)
VALUES ('ViiTorTTS', 'config_tts_provider_vt_tts', 'vt_tts', 'Y', 'admin', NOW(), 'TTS厂商-ViiTorTTS');

DELETE FROM `cc_params`
WHERE `param_code` = 'vt-tts-account-json';

INSERT INTO `cc_params` (`param_name`, `param_code`, `param_value`, `param_type`, `hide_value`)
VALUES ('ViiTorTTS账号参数json', 'vt-tts-account-json', '{"appid":"","secret-key":"","voice-name":"juvenile","language":"zh-CN","format":"pcm","sample-rate":"8000","token-url":"https://tts.ilivedata.com/api/v2/speech/synthesis/ws-token","ws-url":"wss://tts.ilivedata.com/api/v1/speech/synthesis/ws","connect-timeout-ms":"10000","verify-peer":"false"}', 'tts', 1);

DELETE FROM `fs_variables`
WHERE `cat` = 5
  AND `var_field_name` IN (
    'appid',
    'secret-key',
    'voice-name',
    'language',
    'format',
    'sample-rate',
    'token-url',
    'ws-url',
    'connect-timeout-ms',
    'verify-peer'
  );

INSERT INTO `fs_variables` (`cat`, `var_field_name`, `var_field_alias`) VALUES
(5, 'appid', 'AppId'),
(5, 'secret-key', 'SecretKey'),
(5, 'voice-name', '默认音色名'),
(5, 'language', '默认语种'),
(5, 'format', '音频格式'),
(5, 'sample-rate', '采样率'),
(5, 'token-url', 'Token接口地址'),
(5, 'ws-url', 'WebSocket地址'),
(5, 'connect-timeout-ms', '连接超时(毫秒)'),
(5, 'verify-peer', '校验证书');
