fix: fix aiAns Extension & distinguish asr large/small model configurations & remove linebreak eslint.

This commit is contained in:
quemingyi.wudong 2025-04-03 14:15:53 +08:00
parent 4f088b0e89
commit b79f5bcfc5
3 changed files with 27 additions and 13 deletions

View File

@ -42,7 +42,7 @@
],
"rules": {
"prettier/prettier": ["warn", { "trailingComma": "es5", "printWidth": 200 }],
"linebreak-style": ["error", "unix"],
"linebreak-style": "off",
"no-console": ["warn", { "allow": ["warn", "error", "log"] }],
"no-case-declarations": 0,
"no-param-reassign": 0,

View File

@ -72,7 +72,9 @@ export class ConfigFactory {
ASRAppId: 'Your ASR AppId',
/**
* @brief AppId Access Token
* 使
* @note 使 **** , https://console.volcengine.com/speech/service/10011?AppID=6482372612&s=g 中查看。
* , ASRToken, Demo 使
* 使 ASRToken
*/
ASRToken: undefined,
};
@ -156,13 +158,13 @@ export class ConfigFactory {
}
get ASRConfig() {
const params: Record<string, any> = {
/**
* @brief SmallModelASRConfigs
* @note 使, ASR 使
*/
const SmallModelASRConfigs = {
Provider: 'volcano',
ProviderParams: {
/**
* @note 使, ASR 使
* 使 https://www.volcengine.com/docs/6348/1404673#volcanolmasrconfig?s=g
*/
Mode: 'smallmodel',
AppId: this.BaseConfig.ASRAppId,
/**
@ -171,16 +173,29 @@ export class ConfigFactory {
*/
Cluster: 'volcengine_streaming_common',
},
/**
* @note , 使 VAD ,
*/
VADConfig: {
SilenceTime: 600,
SilenceThreshold: 200,
},
VolumeGain: 0.3,
};
if (this.BaseConfig.ASRToken) {
params.ProviderParams.AccessToken = this.BaseConfig.ASRToken;
}
return params;
/**
* @brief BigModelASRConfigs
* @note 使 https://www.volcengine.com/docs/6348/1404673#volcanolmasrconfig?s=g
*/
const BigModelASRConfigs = {
Provider: 'volcano',
ProviderParams: {
Mode: 'bigmodel',
AppId: this.BaseConfig.ASRAppId,
AccessToken: this.BaseConfig.ASRToken,
},
};
return this.BaseConfig.ASRToken ? BigModelASRConfigs : SmallModelASRConfigs;
}
get TTSConfig() {

View File

@ -70,8 +70,6 @@ export interface BasicBody {
login_token: string | null;
}
export const AIAnsExtension = new RTCAIAnsExtension();
/**
* @brief RTC Core Client
* @notes Refer to official website documentation to get more information about the API.
@ -101,6 +99,7 @@ export class RTCClient {
this.engine = VERTC.createEngine(this.config.appId);
try {
const AIAnsExtension = new RTCAIAnsExtension();
await this.engine.registerExtension(AIAnsExtension);
AIAnsExtension.enable();
} catch (error) {