94 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			94 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| // 示例配置文件 - 请复制此文件为 config.js 并填入实际的API密钥
 | |
| export const config = {
 | |
|   // LLM API配置
 | |
|   llm: {
 | |
|     apiKey: 'your_ark_api_key_here', // 请替换为实际的ARK API密钥
 | |
|     model: 'bot-20250720193048-84fkp',
 | |
|   },
 | |
|   
 | |
|   // Minimaxi API配置
 | |
|   minimaxi: {
 | |
|     apiKey: 'your_minimaxi_api_key_here', // 请替换为实际的Minimaxi API密钥
 | |
|     groupId: 'your_minimaxi_group_id_here', // 请替换为实际的Minimaxi Group ID
 | |
|   },
 | |
|   
 | |
|   // 音频配置
 | |
|   audio: {
 | |
|     model: 'speech-02-hd',
 | |
|     voiceSetting: {
 | |
|       voice_id: 'yantu-qinggang',
 | |
|       speed: 1,
 | |
|       vol: 1,
 | |
|       pitch: 0,
 | |
|       emotion: 'happy',
 | |
|     },
 | |
|     audioSetting: {
 | |
|       sample_rate: 32000,
 | |
|       bitrate: 128000,
 | |
|       format: 'mp3',
 | |
|     },
 | |
|   },
 | |
|   
 | |
|   // 系统配置
 | |
|   system: {
 | |
|     language_boost: 'auto',
 | |
|     output_format: 'hex',
 | |
|     stream: true,
 | |
|   },
 | |
| };
 | |
| 
 | |
| // 验证配置是否完整
 | |
| export function validateConfig() {
 | |
|   const requiredFields = [
 | |
|     'llm.apiKey',
 | |
|     'llm.model',
 | |
|     'minimaxi.apiKey',
 | |
|     'minimaxi.groupId'
 | |
|   ];
 | |
|   
 | |
|   const missingFields = [];
 | |
|   
 | |
|   for (const field of requiredFields) {
 | |
|     const keys = field.split('.');
 | |
|     let value = config;
 | |
|     for (const key of keys) {
 | |
|       value = value[key];
 | |
|       if (!value) break;
 | |
|     }
 | |
|     
 | |
|     if (!value || value === 'your_ark_api_key_here' || value === 'your_minimaxi_api_key_here' || value === 'your_minimaxi_group_id_here') {
 | |
|       missingFields.push(field);
 | |
|     }
 | |
|   }
 | |
|   
 | |
|   if (missingFields.length > 0) {
 | |
|     console.warn('配置不完整,请检查以下字段:', missingFields);
 | |
|     return false;
 | |
|   }
 | |
|   
 | |
|   return true;
 | |
| }
 | |
| 
 | |
| // 获取配置的便捷方法
 | |
| export function getLLMConfig() {
 | |
|   return {
 | |
|     apiKey: config.llm.apiKey,
 | |
|     model: config.llm.model,
 | |
|   };
 | |
| }
 | |
| 
 | |
| export function getMinimaxiConfig() {
 | |
|   return {
 | |
|     apiKey: config.minimaxi.apiKey,
 | |
|     groupId: config.minimaxi.groupId,
 | |
|   };
 | |
| }
 | |
| 
 | |
| export function getAudioConfig() {
 | |
|   return {
 | |
|     model: config.audio.model,
 | |
|     voiceSetting: config.audio.voiceSetting,
 | |
|     audioSetting: config.audio.audioSetting,
 | |
|     ...config.system,
 | |
|   };
 | |
| } 
 | 
