@aituber-onair/core 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -1
- package/dist/constants/voiceEngine.d.ts +4 -0
- package/dist/constants/voiceEngine.js +6 -0
- package/dist/constants/voiceEngine.js.map +1 -1
- package/dist/services/voice/VoiceEngineAdapter.js +13 -0
- package/dist/services/voice/VoiceEngineAdapter.js.map +1 -1
- package/dist/services/voice/VoiceService.d.ts +4 -0
- package/dist/services/voice/engines/MinimaxEngine.d.ts +131 -0
- package/dist/services/voice/engines/MinimaxEngine.js +372 -0
- package/dist/services/voice/engines/MinimaxEngine.js.map +1 -0
- package/dist/services/voice/engines/VoiceEngineFactory.js +3 -0
- package/dist/services/voice/engines/VoiceEngineFactory.js.map +1 -1
- package/dist/services/voice/engines/index.d.ts +1 -0
- package/dist/services/voice/engines/index.js +1 -0
- package/dist/services/voice/engines/index.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/voiceEngine.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -123,7 +123,9 @@ const options: AITuberOnAirCoreOptions = {
|
|
|
123
123
|
voiceOptions: {
|
|
124
124
|
engineType: 'voicevox', // Speech engine type
|
|
125
125
|
speaker: '1', // Speaker ID
|
|
126
|
-
apiKey: 'ENGINE_SPECIFIC_API_KEY', // If required (e.g., NijiVoice)
|
|
126
|
+
apiKey: 'ENGINE_SPECIFIC_API_KEY', // If required (e.g., NijiVoice, MiniMax)
|
|
127
|
+
groupId: 'YOUR_GROUP_ID', // If using MiniMax
|
|
128
|
+
endpoint: 'global', // If using MiniMax: 'global' or 'china'
|
|
127
129
|
onComplete: () => console.log('Voice playback completed'),
|
|
128
130
|
// Custom API endpoint URLs (optional)
|
|
129
131
|
voicevoxApiUrl: 'http://custom-voicevox-server:50021',
|
|
@@ -1217,6 +1219,7 @@ Possible use cases for `chatLogUpdated` include:
|
|
|
1217
1219
|
- **NijiVoice**: AI-based speech synthesis service (requires an API key).
|
|
1218
1220
|
- **AivisSpeech**: Speech synthesis using AI technology.
|
|
1219
1221
|
- **OpenAI TTS**: Text-to-speech API from OpenAI.
|
|
1222
|
+
- **MiniMax**: Multi-language TTS with 24 language support and HD quality (requires both API key and GroupId - see usage example below).
|
|
1220
1223
|
- **None**: No voice mode (no audio output).
|
|
1221
1224
|
|
|
1222
1225
|
You can dynamically switch the speech engine via `updateVoiceService`:
|
|
@@ -1256,6 +1259,27 @@ aituber.updateVoiceService({
|
|
|
1256
1259
|
speaker: '3',
|
|
1257
1260
|
aivisSpeechApiUrl: 'http://custom-aivis-server:10101'
|
|
1258
1261
|
});
|
|
1262
|
+
|
|
1263
|
+
// Example for MiniMax (simplified configuration)
|
|
1264
|
+
aituber.updateVoiceService({
|
|
1265
|
+
engineType: 'minimax',
|
|
1266
|
+
speaker: 'male-qn-qingse', // or any supported voice ID
|
|
1267
|
+
apiKey: 'YOUR_MINIMAX_API_KEY',
|
|
1268
|
+
groupId: 'YOUR_GROUP_ID', // Required for MiniMax
|
|
1269
|
+
endpoint: 'global' // Optional: 'global' (default) or 'china'
|
|
1270
|
+
});
|
|
1271
|
+
|
|
1272
|
+
// IMPORTANT: MiniMax requires a GroupId in addition to the API key
|
|
1273
|
+
// GroupId is a unique identifier for your user group in MiniMax's system
|
|
1274
|
+
// Unlike other TTS engines, MiniMax uses both API key and GroupId for:
|
|
1275
|
+
// - User authentication and group management
|
|
1276
|
+
// - Usage tracking and statistics
|
|
1277
|
+
// - Billing and quota management
|
|
1278
|
+
// You can obtain your GroupId from your MiniMax account dashboard
|
|
1279
|
+
//
|
|
1280
|
+
// MiniMax also supports region-specific endpoints:
|
|
1281
|
+
// - 'global': For international users (default)
|
|
1282
|
+
// - 'china': For users in mainland China
|
|
1259
1283
|
```
|
|
1260
1284
|
|
|
1261
1285
|
This is useful when running voice engines on different ports or remote servers.
|
|
@@ -3,3 +3,7 @@ export declare const VOICEPEAK_API_URL = "http://localhost:20202";
|
|
|
3
3
|
export declare const AIVIS_SPEECH_API_URL = "http://localhost:10101";
|
|
4
4
|
export declare const NIJI_VOICE_API_URL = "https://api.nijivoice.com/api/platform/v1";
|
|
5
5
|
export declare const OPENAI_TTS_API_URL = "https://api.openai.com/v1/audio/speech";
|
|
6
|
+
export declare const MINIMAX_GLOBAL_API_URL = "https://api.minimax.io/v1/t2a_v2";
|
|
7
|
+
export declare const MINIMAX_CHINA_API_URL = "https://api.minimaxi.com/v1/t2a_v2";
|
|
8
|
+
export declare const MINIMAX_GLOBAL_VOICE_LIST_URL = "https://api.minimax.io/v1/query/tts_speakers";
|
|
9
|
+
export declare const MINIMAX_CHINA_VOICE_LIST_URL = "https://api.minimaxi.com/v1/query/tts_speakers";
|
|
@@ -3,4 +3,10 @@ export const VOICEPEAK_API_URL = 'http://localhost:20202';
|
|
|
3
3
|
export const AIVIS_SPEECH_API_URL = 'http://localhost:10101';
|
|
4
4
|
export const NIJI_VOICE_API_URL = 'https://api.nijivoice.com/api/platform/v1';
|
|
5
5
|
export const OPENAI_TTS_API_URL = 'https://api.openai.com/v1/audio/speech';
|
|
6
|
+
// MiniMax API endpoints
|
|
7
|
+
export const MINIMAX_GLOBAL_API_URL = 'https://api.minimax.io/v1/t2a_v2';
|
|
8
|
+
export const MINIMAX_CHINA_API_URL = 'https://api.minimaxi.com/v1/t2a_v2';
|
|
9
|
+
// MiniMax voice list endpoint
|
|
10
|
+
export const MINIMAX_GLOBAL_VOICE_LIST_URL = 'https://api.minimax.io/v1/query/tts_speakers';
|
|
11
|
+
export const MINIMAX_CHINA_VOICE_LIST_URL = 'https://api.minimaxi.com/v1/query/tts_speakers';
|
|
6
12
|
//# sourceMappingURL=voiceEngine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voiceEngine.js","sourceRoot":"","sources":["../../src/constants/voiceEngine.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAC1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAC7D,MAAM,CAAC,MAAM,kBAAkB,GAAG,2CAA2C,CAAC;AAC9E,MAAM,CAAC,MAAM,kBAAkB,GAAG,wCAAwC,CAAC"}
|
|
1
|
+
{"version":3,"file":"voiceEngine.js","sourceRoot":"","sources":["../../src/constants/voiceEngine.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAC1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AAC7D,MAAM,CAAC,MAAM,kBAAkB,GAAG,2CAA2C,CAAC;AAC9E,MAAM,CAAC,MAAM,kBAAkB,GAAG,wCAAwC,CAAC;AAE3E,wBAAwB;AACxB,MAAM,CAAC,MAAM,sBAAsB,GAAG,kCAAkC,CAAC;AACzE,MAAM,CAAC,MAAM,qBAAqB,GAAG,oCAAoC,CAAC;AAE1E,8BAA8B;AAC9B,MAAM,CAAC,MAAM,6BAA6B,GACxC,8CAA8C,CAAC;AACjD,MAAM,CAAC,MAAM,4BAA4B,GACvC,gDAAgD,CAAC"}
|
|
@@ -77,6 +77,19 @@ export class VoiceEngineAdapter {
|
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
+
// MiniMaxエンジンの場合、GroupIdを設定
|
|
81
|
+
if (this.options.engineType === 'minimax' && engine.setGroupId) {
|
|
82
|
+
if (this.options.groupId) {
|
|
83
|
+
engine.setGroupId(this.options.groupId);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
console.warn('MiniMax engine requires GroupId, but it is not provided in options');
|
|
87
|
+
}
|
|
88
|
+
// エンドポイントの設定もMinimaxEngineでサポートされている場合
|
|
89
|
+
if (this.options.endpoint && engine.setEndpoint) {
|
|
90
|
+
engine.setEndpoint(this.options.endpoint);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
80
93
|
// Get audio data
|
|
81
94
|
const audioBuffer = await engine.fetchAudio(talk, // Use any for type compatibility
|
|
82
95
|
this.options.speaker, this.options.apiKey);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoiceEngineAdapter.js","sourceRoot":"","sources":["../../../src/services/voice/VoiceEngineAdapter.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAK7B;;;OAGG;IACH,YAAY,OAA4B;QAPhC,mBAAc,GAAY,KAAK,CAAC;QAChC,iBAAY,GAA4B,IAAI,CAAC;QAOnD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,gCAAgC;QAChC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YACpD,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;gBAC/C,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;gBAC5B,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;oBAC5B,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;gBAC5B,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,KAAK,CACT,UAA0B,EAC1B,OAA0B;QAE1B,IAAI,CAAC;YACH,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;gBACxB,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,CAAC;YAED,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;YAE3B,iDAAiD;YACjD,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,MAAM,CAC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l?: string;
|
|
20
20
|
/** Custom AIVIS SPEECH API endpoint URL */
|
|
21
21
|
aivisSpeechApiUrl?: string;
|
|
22
|
+
/** MiniMax Group ID (required for MiniMax engine) */
|
|
23
|
+
groupId?: string;
|
|
24
|
+
/** MiniMax endpoint ('global' or 'china') */
|
|
25
|
+
endpoint?: string;
|
|
22
26
|
}
|
|
23
27
|
/**
|
|
24
28
|
* Audio playback options
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { Talk } from '../../../types';
|
|
2
|
+
import { VoiceEngine } from './VoiceEngine';
|
|
3
|
+
/**
|
|
4
|
+
* MiniMax endpoint types
|
|
5
|
+
*/
|
|
6
|
+
export type MinimaxEndpoint = 'global' | 'china';
|
|
7
|
+
/**
|
|
8
|
+
* MiniMax voice speaker information
|
|
9
|
+
*/
|
|
10
|
+
export interface MinimaxVoiceSpeaker {
|
|
11
|
+
voice_id: string;
|
|
12
|
+
voice_name: string;
|
|
13
|
+
gender: string;
|
|
14
|
+
language: string;
|
|
15
|
+
preview_audio?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* MiniMax TTS voice synthesis engine
|
|
19
|
+
*/
|
|
20
|
+
export declare class MinimaxEngine implements VoiceEngine {
|
|
21
|
+
private groupId?;
|
|
22
|
+
private model;
|
|
23
|
+
private defaultVoiceId;
|
|
24
|
+
private language;
|
|
25
|
+
private endpoint;
|
|
26
|
+
/**
|
|
27
|
+
* Set GroupId for MiniMax API
|
|
28
|
+
*
|
|
29
|
+
* GroupId is a unique identifier for the user group in MiniMax's system.
|
|
30
|
+
* Unlike other TTS engines that only require an API key, MiniMax requires both
|
|
31
|
+
* an API key and a GroupId for authentication and usage tracking.
|
|
32
|
+
*
|
|
33
|
+
* This GroupId is used by MiniMax for:
|
|
34
|
+
* - User group management
|
|
35
|
+
* - Usage statistics tracking
|
|
36
|
+
* - Billing and quota management
|
|
37
|
+
*
|
|
38
|
+
* You must obtain this pre-generated value from your MiniMax account dashboard.
|
|
39
|
+
*
|
|
40
|
+
* @param groupId GroupId for MiniMax API (required for production synthesis)
|
|
41
|
+
*/
|
|
42
|
+
setGroupId(groupId: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Set endpoint region for MiniMax API
|
|
45
|
+
* @param endpoint Endpoint region ('global' or 'china')
|
|
46
|
+
*/
|
|
47
|
+
setEndpoint(endpoint: MinimaxEndpoint): void;
|
|
48
|
+
/**
|
|
49
|
+
* Set model for MiniMax TTS
|
|
50
|
+
* @param model Model name (speech-02-hd, speech-02-turbo, speech-01-hd, speech-01-turbo)
|
|
51
|
+
*/
|
|
52
|
+
setModel(model: string): void;
|
|
53
|
+
/**
|
|
54
|
+
* Set language boost
|
|
55
|
+
* @param language Language to boost recognition
|
|
56
|
+
*/
|
|
57
|
+
setLanguage(language: string): void;
|
|
58
|
+
/**
|
|
59
|
+
* Get current API endpoint URL based on selected endpoint
|
|
60
|
+
* @returns API endpoint URL
|
|
61
|
+
*/
|
|
62
|
+
private getTtsApiUrl;
|
|
63
|
+
/**
|
|
64
|
+
* Get current voice list API endpoint URL based on selected endpoint
|
|
65
|
+
* @returns Voice list API endpoint URL
|
|
66
|
+
*/
|
|
67
|
+
private getVoiceListApiUrl;
|
|
68
|
+
/**
|
|
69
|
+
* Get available voice speakers list
|
|
70
|
+
* Requires only API key
|
|
71
|
+
* @param apiKey MiniMax API key
|
|
72
|
+
* @returns Promise<MinimaxVoiceSpeaker[]>
|
|
73
|
+
*/
|
|
74
|
+
getVoiceList(apiKey: string): Promise<MinimaxVoiceSpeaker[]>;
|
|
75
|
+
/**
|
|
76
|
+
* Test voice synthesis with minimal requirements
|
|
77
|
+
* Requires API key and voice ID, but not GroupId
|
|
78
|
+
* @param text Text to synthesize (shorter text recommended for testing)
|
|
79
|
+
* @param voiceId Voice ID to test
|
|
80
|
+
* @param apiKey MiniMax API key
|
|
81
|
+
* @returns Promise<ArrayBuffer>
|
|
82
|
+
*/
|
|
83
|
+
testVoice(text: string, voiceId: string, apiKey: string): Promise<ArrayBuffer>;
|
|
84
|
+
/**
|
|
85
|
+
* Full production audio synthesis
|
|
86
|
+
* Requires API key, voice ID, and GroupId
|
|
87
|
+
* @param input Talk object
|
|
88
|
+
* @param speaker Voice ID
|
|
89
|
+
* @param apiKey MiniMax API key
|
|
90
|
+
* @param voiceActor Not used for MiniMax (for interface compatibility)
|
|
91
|
+
* @returns Promise<ArrayBuffer>
|
|
92
|
+
*/
|
|
93
|
+
fetchAudio(input: Talk, speaker: string, apiKey?: string, voiceActor?: any): Promise<ArrayBuffer>;
|
|
94
|
+
/**
|
|
95
|
+
* Audio synthesis with flexible GroupId requirement
|
|
96
|
+
* @param input Talk object
|
|
97
|
+
* @param speaker Voice ID
|
|
98
|
+
* @param apiKey MiniMax API key
|
|
99
|
+
* @param requireGroupId Whether to require GroupId (default: true)
|
|
100
|
+
* @returns Promise<ArrayBuffer>
|
|
101
|
+
*/
|
|
102
|
+
fetchAudioWithOptions(input: Talk, speaker: string, apiKey?: string, requireGroupId?: boolean): Promise<ArrayBuffer>;
|
|
103
|
+
/**
|
|
104
|
+
* Check if GroupId is configured
|
|
105
|
+
* @returns boolean
|
|
106
|
+
*/
|
|
107
|
+
hasGroupId(): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Get current endpoint setting
|
|
110
|
+
* @returns MinimaxEndpoint
|
|
111
|
+
*/
|
|
112
|
+
getEndpoint(): MinimaxEndpoint;
|
|
113
|
+
/**
|
|
114
|
+
* Set custom API endpoint URL (VoiceEngine interface compatibility)
|
|
115
|
+
* @param apiUrl custom API endpoint URL
|
|
116
|
+
*/
|
|
117
|
+
setApiEndpoint(apiUrl: string): void;
|
|
118
|
+
/**
|
|
119
|
+
* Get voice settings based on emotion
|
|
120
|
+
* @param emotion Emotion type
|
|
121
|
+
* @returns Voice settings
|
|
122
|
+
*/
|
|
123
|
+
private getVoiceSettings;
|
|
124
|
+
/**
|
|
125
|
+
* Convert hex string to ArrayBuffer
|
|
126
|
+
* @param hex Hex string
|
|
127
|
+
* @returns ArrayBuffer
|
|
128
|
+
*/
|
|
129
|
+
private hexToArrayBuffer;
|
|
130
|
+
getTestMessage(textVoiceText?: string): string;
|
|
131
|
+
}
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import { MINIMAX_GLOBAL_API_URL, MINIMAX_CHINA_API_URL, MINIMAX_GLOBAL_VOICE_LIST_URL, MINIMAX_CHINA_VOICE_LIST_URL, } from '../../../constants';
|
|
2
|
+
/**
|
|
3
|
+
* MiniMax TTS voice synthesis engine
|
|
4
|
+
*/
|
|
5
|
+
export class MinimaxEngine {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.model = 'speech-02-hd';
|
|
8
|
+
this.defaultVoiceId = 'male-qn-qingse';
|
|
9
|
+
this.language = 'Japanese';
|
|
10
|
+
this.endpoint = 'global';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Set GroupId for MiniMax API
|
|
14
|
+
*
|
|
15
|
+
* GroupId is a unique identifier for the user group in MiniMax's system.
|
|
16
|
+
* Unlike other TTS engines that only require an API key, MiniMax requires both
|
|
17
|
+
* an API key and a GroupId for authentication and usage tracking.
|
|
18
|
+
*
|
|
19
|
+
* This GroupId is used by MiniMax for:
|
|
20
|
+
* - User group management
|
|
21
|
+
* - Usage statistics tracking
|
|
22
|
+
* - Billing and quota management
|
|
23
|
+
*
|
|
24
|
+
* You must obtain this pre-generated value from your MiniMax account dashboard.
|
|
25
|
+
*
|
|
26
|
+
* @param groupId GroupId for MiniMax API (required for production synthesis)
|
|
27
|
+
*/
|
|
28
|
+
setGroupId(groupId) {
|
|
29
|
+
this.groupId = groupId;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Set endpoint region for MiniMax API
|
|
33
|
+
* @param endpoint Endpoint region ('global' or 'china')
|
|
34
|
+
*/
|
|
35
|
+
setEndpoint(endpoint) {
|
|
36
|
+
this.endpoint = endpoint;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Set model for MiniMax TTS
|
|
40
|
+
* @param model Model name (speech-02-hd, speech-02-turbo, speech-01-hd, speech-01-turbo)
|
|
41
|
+
*/
|
|
42
|
+
setModel(model) {
|
|
43
|
+
this.model = model;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Set language boost
|
|
47
|
+
* @param language Language to boost recognition
|
|
48
|
+
*/
|
|
49
|
+
setLanguage(language) {
|
|
50
|
+
this.language = language;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Get current API endpoint URL based on selected endpoint
|
|
54
|
+
* @returns API endpoint URL
|
|
55
|
+
*/
|
|
56
|
+
getTtsApiUrl() {
|
|
57
|
+
return this.endpoint === 'china'
|
|
58
|
+
? MINIMAX_CHINA_API_URL
|
|
59
|
+
: MINIMAX_GLOBAL_API_URL;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get current voice list API endpoint URL based on selected endpoint
|
|
63
|
+
* @returns Voice list API endpoint URL
|
|
64
|
+
*/
|
|
65
|
+
getVoiceListApiUrl() {
|
|
66
|
+
return this.endpoint === 'china'
|
|
67
|
+
? MINIMAX_CHINA_VOICE_LIST_URL
|
|
68
|
+
: MINIMAX_GLOBAL_VOICE_LIST_URL;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get available voice speakers list
|
|
72
|
+
* Requires only API key
|
|
73
|
+
* @param apiKey MiniMax API key
|
|
74
|
+
* @returns Promise<MinimaxVoiceSpeaker[]>
|
|
75
|
+
*/
|
|
76
|
+
async getVoiceList(apiKey) {
|
|
77
|
+
if (!apiKey) {
|
|
78
|
+
throw new Error('MiniMax API key is required');
|
|
79
|
+
}
|
|
80
|
+
const response = await fetch(this.getVoiceListApiUrl(), {
|
|
81
|
+
method: 'GET',
|
|
82
|
+
headers: {
|
|
83
|
+
Authorization: `Bearer ${apiKey}`,
|
|
84
|
+
'Content-Type': 'application/json',
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
if (!response.ok) {
|
|
88
|
+
let errorMessage = `Failed to fetch voice list: ${response.status}`;
|
|
89
|
+
try {
|
|
90
|
+
const errorText = await response.text();
|
|
91
|
+
console.error('Failed to fetch voice list from MiniMax:', response.status, errorText);
|
|
92
|
+
errorMessage = `Failed to fetch voice list: ${response.status} - ${errorText}`;
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
console.error('Failed to fetch voice list from MiniMax:', response.status, response.statusText);
|
|
96
|
+
errorMessage = `Failed to fetch voice list: ${response.status} - ${response.statusText}`;
|
|
97
|
+
}
|
|
98
|
+
throw new Error(errorMessage);
|
|
99
|
+
}
|
|
100
|
+
const result = await response.json();
|
|
101
|
+
// Check base_resp for API errors
|
|
102
|
+
if (result.base_resp && result.base_resp.status_code !== 0) {
|
|
103
|
+
const errorMsg = result.base_resp.status_msg || 'Unknown error';
|
|
104
|
+
throw new Error(`MiniMax API error: ${result.base_resp.status_code} - ${errorMsg}`);
|
|
105
|
+
}
|
|
106
|
+
// Return voice speakers data
|
|
107
|
+
return result.data?.speakers || [];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Test voice synthesis with minimal requirements
|
|
111
|
+
* Requires API key and voice ID, but not GroupId
|
|
112
|
+
* @param text Text to synthesize (shorter text recommended for testing)
|
|
113
|
+
* @param voiceId Voice ID to test
|
|
114
|
+
* @param apiKey MiniMax API key
|
|
115
|
+
* @returns Promise<ArrayBuffer>
|
|
116
|
+
*/
|
|
117
|
+
async testVoice(text, voiceId, apiKey) {
|
|
118
|
+
if (!apiKey) {
|
|
119
|
+
throw new Error('MiniMax API key is required');
|
|
120
|
+
}
|
|
121
|
+
if (!voiceId) {
|
|
122
|
+
throw new Error('Voice ID is required');
|
|
123
|
+
}
|
|
124
|
+
// Limit test text length to avoid quota waste
|
|
125
|
+
const testText = text.length > 100 ? text.substring(0, 100) + '...' : text;
|
|
126
|
+
// Use a temporary GroupId for testing or make it optional
|
|
127
|
+
const tempGroupId = this.groupId || '1';
|
|
128
|
+
const requestBody = {
|
|
129
|
+
model: this.model,
|
|
130
|
+
text: testText,
|
|
131
|
+
stream: false,
|
|
132
|
+
voice_setting: {
|
|
133
|
+
voice_id: voiceId,
|
|
134
|
+
speed: 1.0,
|
|
135
|
+
vol: 1.0,
|
|
136
|
+
pitch: 0,
|
|
137
|
+
},
|
|
138
|
+
audio_setting: {
|
|
139
|
+
sample_rate: 32000,
|
|
140
|
+
bitrate: 128000,
|
|
141
|
+
format: 'mp3',
|
|
142
|
+
channel: 1,
|
|
143
|
+
},
|
|
144
|
+
language_boost: this.language,
|
|
145
|
+
};
|
|
146
|
+
const response = await fetch(`${this.getTtsApiUrl()}?GroupId=${tempGroupId}`, {
|
|
147
|
+
method: 'POST',
|
|
148
|
+
headers: {
|
|
149
|
+
'Content-Type': 'application/json',
|
|
150
|
+
Authorization: `Bearer ${apiKey}`,
|
|
151
|
+
},
|
|
152
|
+
body: JSON.stringify(requestBody),
|
|
153
|
+
});
|
|
154
|
+
if (!response.ok) {
|
|
155
|
+
let errorMessage = `HTTP error ${response.status}`;
|
|
156
|
+
try {
|
|
157
|
+
const errorText = await response.text();
|
|
158
|
+
console.error('Failed to test voice from MiniMax:', response.status, errorText);
|
|
159
|
+
errorMessage = `Failed to test voice: ${response.status} - ${errorText}`;
|
|
160
|
+
}
|
|
161
|
+
catch (e) {
|
|
162
|
+
console.error('Failed to test voice from MiniMax:', response.status, response.statusText);
|
|
163
|
+
errorMessage = `Failed to test voice: ${response.status} - ${response.statusText}`;
|
|
164
|
+
}
|
|
165
|
+
throw new Error(errorMessage);
|
|
166
|
+
}
|
|
167
|
+
const result = await response.json();
|
|
168
|
+
// Check base_resp for API errors
|
|
169
|
+
if (result.base_resp && result.base_resp.status_code !== 0) {
|
|
170
|
+
const errorMsg = result.base_resp.status_msg || 'Unknown error';
|
|
171
|
+
throw new Error(`MiniMax API error: ${result.base_resp.status_code} - ${errorMsg}`);
|
|
172
|
+
}
|
|
173
|
+
// Get audio data from response
|
|
174
|
+
if (!result.data || !result.data.audio) {
|
|
175
|
+
console.error('Invalid response structure:', result);
|
|
176
|
+
throw new Error('Audio data not found in MiniMax response');
|
|
177
|
+
}
|
|
178
|
+
// Convert hex string to ArrayBuffer
|
|
179
|
+
try {
|
|
180
|
+
return this.hexToArrayBuffer(result.data.audio);
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
console.error('Failed to convert hex audio data:', error);
|
|
184
|
+
throw new Error(`Failed to process audio data: ${error}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Full production audio synthesis
|
|
189
|
+
* Requires API key, voice ID, and GroupId
|
|
190
|
+
* @param input Talk object
|
|
191
|
+
* @param speaker Voice ID
|
|
192
|
+
* @param apiKey MiniMax API key
|
|
193
|
+
* @param voiceActor Not used for MiniMax (for interface compatibility)
|
|
194
|
+
* @returns Promise<ArrayBuffer>
|
|
195
|
+
*/
|
|
196
|
+
async fetchAudio(input, speaker, apiKey, voiceActor) {
|
|
197
|
+
return this.fetchAudioWithOptions(input, speaker, apiKey, true);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Audio synthesis with flexible GroupId requirement
|
|
201
|
+
* @param input Talk object
|
|
202
|
+
* @param speaker Voice ID
|
|
203
|
+
* @param apiKey MiniMax API key
|
|
204
|
+
* @param requireGroupId Whether to require GroupId (default: true)
|
|
205
|
+
* @returns Promise<ArrayBuffer>
|
|
206
|
+
*/
|
|
207
|
+
async fetchAudioWithOptions(input, speaker, apiKey, requireGroupId = true) {
|
|
208
|
+
if (!apiKey) {
|
|
209
|
+
throw new Error('MiniMax API key is required');
|
|
210
|
+
}
|
|
211
|
+
if (requireGroupId && !this.groupId) {
|
|
212
|
+
throw new Error('MiniMax GroupId is required for production synthesis. Please set it using setGroupId(), or use testVoice() for testing.');
|
|
213
|
+
}
|
|
214
|
+
const talk = input;
|
|
215
|
+
const text = talk.message.trim();
|
|
216
|
+
// Validate text length (max 5000 characters)
|
|
217
|
+
if (text.length > 5000) {
|
|
218
|
+
throw new Error('Text exceeds maximum length of 5000 characters');
|
|
219
|
+
}
|
|
220
|
+
// Get emotion from talk.style and adjust voice settings
|
|
221
|
+
const voiceSettings = this.getVoiceSettings(talk.style || 'talk');
|
|
222
|
+
const requestBody = {
|
|
223
|
+
model: this.model,
|
|
224
|
+
text: text,
|
|
225
|
+
stream: false,
|
|
226
|
+
voice_setting: {
|
|
227
|
+
voice_id: speaker || this.defaultVoiceId,
|
|
228
|
+
speed: voiceSettings.speed,
|
|
229
|
+
vol: voiceSettings.vol,
|
|
230
|
+
pitch: voiceSettings.pitch,
|
|
231
|
+
},
|
|
232
|
+
audio_setting: {
|
|
233
|
+
sample_rate: 32000,
|
|
234
|
+
bitrate: 128000,
|
|
235
|
+
format: 'mp3',
|
|
236
|
+
channel: 1,
|
|
237
|
+
},
|
|
238
|
+
language_boost: this.language,
|
|
239
|
+
};
|
|
240
|
+
// Use provided GroupId or temporary one for testing
|
|
241
|
+
const groupIdToUse = this.groupId || '1';
|
|
242
|
+
const response = await fetch(`${this.getTtsApiUrl()}?GroupId=${groupIdToUse}`, {
|
|
243
|
+
method: 'POST',
|
|
244
|
+
headers: {
|
|
245
|
+
'Content-Type': 'application/json',
|
|
246
|
+
Authorization: `Bearer ${apiKey}`,
|
|
247
|
+
},
|
|
248
|
+
body: JSON.stringify(requestBody),
|
|
249
|
+
});
|
|
250
|
+
if (!response.ok) {
|
|
251
|
+
let errorMessage = `HTTP error ${response.status}`;
|
|
252
|
+
try {
|
|
253
|
+
const errorText = await response.text();
|
|
254
|
+
console.error('Failed to fetch TTS from MiniMax:', response.status, errorText);
|
|
255
|
+
errorMessage = `Failed to fetch TTS from MiniMax: ${response.status} - ${errorText}`;
|
|
256
|
+
}
|
|
257
|
+
catch (e) {
|
|
258
|
+
console.error('Failed to fetch TTS from MiniMax:', response.status, response.statusText);
|
|
259
|
+
errorMessage = `Failed to fetch TTS from MiniMax: ${response.status} - ${response.statusText}`;
|
|
260
|
+
}
|
|
261
|
+
throw new Error(errorMessage);
|
|
262
|
+
}
|
|
263
|
+
const result = await response.json();
|
|
264
|
+
// Check base_resp for API errors
|
|
265
|
+
if (result.base_resp && result.base_resp.status_code !== 0) {
|
|
266
|
+
const errorMsg = result.base_resp.status_msg || 'Unknown error';
|
|
267
|
+
throw new Error(`MiniMax API error: ${result.base_resp.status_code} - ${errorMsg}`);
|
|
268
|
+
}
|
|
269
|
+
// Get audio data from response
|
|
270
|
+
if (!result.data || !result.data.audio) {
|
|
271
|
+
console.error('Invalid response structure:', result);
|
|
272
|
+
throw new Error('Audio data not found in MiniMax response');
|
|
273
|
+
}
|
|
274
|
+
// Convert hex string to ArrayBuffer
|
|
275
|
+
try {
|
|
276
|
+
return this.hexToArrayBuffer(result.data.audio);
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
console.error('Failed to convert hex audio data:', error);
|
|
280
|
+
throw new Error(`Failed to process audio data: ${error}`);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Check if GroupId is configured
|
|
285
|
+
* @returns boolean
|
|
286
|
+
*/
|
|
287
|
+
hasGroupId() {
|
|
288
|
+
return !!this.groupId;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Get current endpoint setting
|
|
292
|
+
* @returns MinimaxEndpoint
|
|
293
|
+
*/
|
|
294
|
+
getEndpoint() {
|
|
295
|
+
return this.endpoint;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Set custom API endpoint URL (VoiceEngine interface compatibility)
|
|
299
|
+
* @param apiUrl custom API endpoint URL
|
|
300
|
+
*/
|
|
301
|
+
setApiEndpoint(apiUrl) {
|
|
302
|
+
// For MiniMax, we override the endpoint URLs directly
|
|
303
|
+
if (apiUrl.includes('minimaxi.com')) {
|
|
304
|
+
this.endpoint = 'china';
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
this.endpoint = 'global';
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Get voice settings based on emotion
|
|
312
|
+
* @param emotion Emotion type
|
|
313
|
+
* @returns Voice settings
|
|
314
|
+
*/
|
|
315
|
+
getVoiceSettings(emotion) {
|
|
316
|
+
// Default settings
|
|
317
|
+
let speed = 1.0;
|
|
318
|
+
let vol = 1.0;
|
|
319
|
+
let pitch = 0;
|
|
320
|
+
// Adjust settings based on emotion
|
|
321
|
+
switch (emotion.toLowerCase()) {
|
|
322
|
+
case 'happy':
|
|
323
|
+
speed = 1.1;
|
|
324
|
+
pitch = 1;
|
|
325
|
+
break;
|
|
326
|
+
case 'sad':
|
|
327
|
+
speed = 0.9;
|
|
328
|
+
pitch = -1;
|
|
329
|
+
break;
|
|
330
|
+
case 'angry':
|
|
331
|
+
speed = 1.0;
|
|
332
|
+
vol = 1.1;
|
|
333
|
+
pitch = 0;
|
|
334
|
+
break;
|
|
335
|
+
case 'surprised':
|
|
336
|
+
speed = 1.2;
|
|
337
|
+
pitch = 2;
|
|
338
|
+
break;
|
|
339
|
+
default:
|
|
340
|
+
// Keep default values
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
return { speed, vol, pitch };
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Convert hex string to ArrayBuffer
|
|
347
|
+
* @param hex Hex string
|
|
348
|
+
* @returns ArrayBuffer
|
|
349
|
+
*/
|
|
350
|
+
hexToArrayBuffer(hex) {
|
|
351
|
+
// Remove any whitespace or newlines
|
|
352
|
+
const cleanHex = hex.replace(/[\s\n]/g, '');
|
|
353
|
+
// Ensure even number of characters
|
|
354
|
+
if (cleanHex.length % 2 !== 0) {
|
|
355
|
+
throw new Error('Invalid hex string: odd number of characters');
|
|
356
|
+
}
|
|
357
|
+
// Validate hex string
|
|
358
|
+
if (!/^[0-9a-fA-F]*$/.test(cleanHex)) {
|
|
359
|
+
throw new Error('Invalid hex string: contains non-hex characters');
|
|
360
|
+
}
|
|
361
|
+
const buffer = new ArrayBuffer(cleanHex.length / 2);
|
|
362
|
+
const view = new Uint8Array(buffer);
|
|
363
|
+
for (let i = 0; i < cleanHex.length; i += 2) {
|
|
364
|
+
view[i / 2] = Number.parseInt(cleanHex.substr(i, 2), 16);
|
|
365
|
+
}
|
|
366
|
+
return buffer;
|
|
367
|
+
}
|
|
368
|
+
getTestMessage(textVoiceText) {
|
|
369
|
+
return textVoiceText || 'MiniMax Audioを使用します';
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
//# sourceMappingURL=MinimaxEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MinimaxEngine.js","sourceRoot":"","sources":["../../../../src/services/voice/engines/MinimaxEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,oBAAoB,CAAC;AAoB5B;;GAEG;AACH,MAAM,OAAO,aAAa;IAA1B;QAEU,UAAK,GAAW,cAAc,CAAC;QAC/B,mBAAc,GAAW,gBAAgB,CAAC;QAC1C,aAAQ,GAAW,UAAU,CAAC;QAC9B,aAAQ,GAAoB,QAAQ,CAAC;IA4c/C,CAAC;IA1cC;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,OAAe;QACxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;OAGG;IACH,WAAW,CAAC,QAAyB;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,KAAa;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,WAAW,CAAC,QAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACK,YAAY;QAClB,OAAO,IAAI,CAAC,QAAQ,KAAK,OAAO;YAC9B,C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QACV,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACK,gBAAgB,CAAC,GAAW;QAClC,oCAAoC;QACpC,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QAE5C,mCAAmC;QACnC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAClE,CAAC;QAED,sBAAsB;QACtB,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACpD,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;QAEpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5C,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,cAAc,CAAC,aAAsB;QACnC,OAAO,aAAa,IAAI,qBAAqB,CAAC;IAChD,CAAC;CACF"}
|
|
@@ -3,6 +3,7 @@ import { VoicePeakEngine } from './VoicePeakEngine';
|
|
|
3
3
|
import { AivisSpeechEngine } from './AivisSpeechEngine';
|
|
4
4
|
import { OpenAiEngine } from './OpenAiEngine';
|
|
5
5
|
import { NijiVoiceEngine } from './NijiVoiceEngine';
|
|
6
|
+
import { MinimaxEngine } from './MinimaxEngine';
|
|
6
7
|
import { NoneEngine } from './NoneEngine';
|
|
7
8
|
/**
|
|
8
9
|
* Voice engine factory
|
|
@@ -27,6 +28,8 @@ export class VoiceEngineFactory {
|
|
|
27
28
|
return new OpenAiEngine();
|
|
28
29
|
case 'nijivoice':
|
|
29
30
|
return new NijiVoiceEngine();
|
|
31
|
+
case 'minimax':
|
|
32
|
+
return new MinimaxEngine();
|
|
30
33
|
case 'none':
|
|
31
34
|
return new NoneEngine();
|
|
32
35
|
default:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoiceEngineFactory.js","sourceRoot":"","sources":["../../../../src/services/voice/engines/VoiceEngineFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IAC7B;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,UAA2B;QAC1C,QAAQ,UAAU,EAAE,CAAC;YACnB,KAAK,UAAU;gBACb,OAAO,IAAI,cAAc,EAAE,CAAC;YAC9B,KAAK,WAAW;gBACd,OAAO,IAAI,eAAe,EAAE,CAAC;YAC/B,KAAK,aAAa;gBAChB,OAAO,IAAI,iBAAiB,EAAE,CAAC;YACjC,KAAK,QAAQ;gBACX,OAAO,IAAI,YAAY,EAAE,CAAC;YAC5B,KAAK,WAAW;gBACd,OAAO,IAAI,eAAe,EAAE,CAAC;YAC/B,KAAK,MAAM;gBACT,OAAO,IAAI,UAAU,EAAE,CAAC;YAC1B;gBACE,MAAM,IAAI,KAAK,CAAC,kCAAkC,UAAU,EAAE,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"VoiceEngineFactory.js","sourceRoot":"","sources":["../../../../src/services/voice/engines/VoiceEngineFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IAC7B;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,UAA2B;QAC1C,QAAQ,UAAU,EAAE,CAAC;YACnB,KAAK,UAAU;gBACb,OAAO,IAAI,cAAc,EAAE,CAAC;YAC9B,KAAK,WAAW;gBACd,OAAO,IAAI,eAAe,EAAE,CAAC;YAC/B,KAAK,aAAa;gBAChB,OAAO,IAAI,iBAAiB,EAAE,CAAC;YACjC,KAAK,QAAQ;gBACX,OAAO,IAAI,YAAY,EAAE,CAAC;YAC5B,KAAK,WAAW;gBACd,OAAO,IAAI,eAAe,EAAE,CAAC;YAC/B,KAAK,SAAS;gBACZ,OAAO,IAAI,aAAa,EAAE,CAAC;YAC7B,KAAK,MAAM;gBACT,OAAO,IAAI,UAAU,EAAE,CAAC;YAC1B;gBACE,MAAM,IAAI,KAAK,CAAC,kCAAkC,UAAU,EAAE,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;CACF"}
|
|
@@ -4,4 +4,5 @@ export { VoicePeakEngine } from './VoicePeakEngine';
|
|
|
4
4
|
export { AivisSpeechEngine } from './AivisSpeechEngine';
|
|
5
5
|
export { OpenAiEngine } from './OpenAiEngine';
|
|
6
6
|
export { NijiVoiceEngine } from './NijiVoiceEngine';
|
|
7
|
+
export { MinimaxEngine } from './MinimaxEngine';
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/voice/engines/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/voice/engines/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -12,3 +12,4 @@ export { talkStyles, TalkStyle, Talk, emotions, EmotionType, EmotionTypeForVoice
|
|
|
12
12
|
import { Screenplay as VoiceScreenplay } from './voice';
|
|
13
13
|
import { Screenplay as ChatScreenplay } from './chat';
|
|
14
14
|
export { VoiceScreenplay, ChatScreenplay };
|
|
15
|
+
export { MinimaxEndpoint, MinimaxVoiceSpeaker, } from '../services/voice/engines/MinimaxEngine';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type VoiceEngineType = 'voicevox' | 'voicepeak' | 'openai' | 'nijivoice' | 'aivisSpeech' | 'none';
|
|
1
|
+
export type VoiceEngineType = 'voicevox' | 'voicepeak' | 'openai' | 'nijivoice' | 'aivisSpeech' | 'minimax' | 'none';
|