-- 2026-06-15
-- Add Tencent MPS ASR bridge configuration for mod_tx_asr1.

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

INSERT INTO `sys_config` (`config_name`, `config_key`, `config_value`, `config_type`, `create_by`, `create_time`, `remark`)
VALUES ('腾讯ASR1', 'config_asr_provider_tx1', 'tx1', 'Y', 'admin', NOW(), 'ASR厂商-mod_tx_asr1');

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

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

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 (4024, '腾讯ASR1配置', 'txAsr1BridgeConf', 3018, 9, '/cc/fsconf/txasr1bridgeconf', 'menuItem', 'C', '0', '1', 'cc:txasr1bridgeconf:view', '#', 'admin', NOW(), 'mod_tx_asr1 参数配置菜单');

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

DELETE FROM `fs_variables`
WHERE `var_field_name` IN (
    'appid',
    'secret-id',
    'secret-key',
    'websocket-host',
    'asr-dst',
    'trans-src',
    'trans-dst',
    'fragment-notify',
    'result-type',
    'steady-text-trans',
    'steady-result',
    'speaker-diarization',
    'timeout-sec',
    'max-speak-ms',
    'hot-words-list',
    'res-id',
    'audio-src-id',
    'packet-format',
    'sample-rate',
    'send-chunk-ms',
    'signature-expire-seconds',
    'verify-peer'
)
AND `cat` = 5;

INSERT INTO `fs_variables` (`cat`, `var_field_name`, `var_field_alias`) VALUES
(5, 'appid', 'AppID'),
(5, 'secret-id', 'SecretId'),
(5, 'secret-key', 'SecretKey'),
(5, 'websocket-host', 'WebSocket Host'),
(5, 'asr-dst', '识别目标语言'),
(5, 'trans-src', '翻译源语言'),
(5, 'trans-dst', '翻译目标语言'),
(5, 'fragment-notify', '片段通知'),
(5, 'result-type', '结果类型'),
(5, 'steady-text-trans', '稳态翻译文本'),
(5, 'steady-result', '稳态结果'),
(5, 'speaker-diarization', '说话人分离'),
(5, 'timeout-sec', '空闲超时(秒)'),
(5, 'max-speak-ms', '最大说话时长(毫秒)'),
(5, 'hot-words-list', '热词列表'),
(5, 'res-id', '资源 ID'),
(5, 'audio-src-id', '音频源 ID'),
(5, 'packet-format', '音频格式'),
(5, 'sample-rate', '采样率'),
(5, 'send-chunk-ms', '发送分片时长(毫秒)'),
(5, 'signature-expire-seconds', '签名有效期(秒)'),
(5, 'verify-peer', '校验证书');

DELETE FROM `cc_asr_languages`
WHERE `asr_provider` = 'tx1';

INSERT INTO `cc_asr_languages` (`asr_provider`, `models`, `language_code`, `language_name`) VALUES
('tx1', 'zh', 'zh-CN', '中文'),
('tx1', 'en', 'en-US', '英文'),
('tx1', 'ja', 'ja-JP', '日文'),
('tx1', 'ko', 'ko-KR', '韩文');

UPDATE `cc_params`
SET `param_name` = '双向asr语音识别，使用哪个asr引擎(chinatelecom/funasr/aliyun/ali/tx/tx1)'
WHERE `param_code` = 'fs_call_asr_engine';
