// API配置统一管理 export const API_CONFIG = { // 基础API地址 BASE_URL: 'http://192.168.3.13:8091', // WebSocket地址 WS_BASE_URL: 'ws://192.168.3.13:8091', // 其他服务地址(如果需要) WEB_URL: 'https://www.aixsy.com.cn', // 🧪 测试模式配置 TEST_MODE: { // 是否启用测试模式(true: 显示测试按钮,禁用录音; false: 正常录音模式) enabled: false, // 📝 测试音频数据(base64编码的PCM数据) // 格式要求: // - 采样率: 16000 Hz // - 位深度: 16 bit (有符号整数) // - 声道数: 1 (单声道) // - 字节序: Little Endian (小端序) // - 无文件头,纯PCM数据 testAudioBase64: '', // 👈 在这里填入你的base64编码的PCM数据 // 或者使用文件路径(优先使用base64) testAudioPath: 'src/static/output.pcm', // 例如: '/static/test_audio.pcm' }, // API端点 ENDPOINTS: { // 登录相关 LOGIN: '/app/login', LOGOUT: '/app/logout', // 聊天相关 CHAT_SYNC: '/api/chat/sync', CHAT_ASYNC: '/api/chat/async', CHAT_HISTORY: '/api/chat/history', CHAT_CONVERSATION: '/api/chat/conversation', CHAT_SESSION: '/api/chat/session', MESSAGE_HISTORY: '/app/message/history', // 语音相关 TTS: '/api/chat/tts', ANSWER_TTS: '/api/chat/answer-tts', VOICE_CHAT: '/api/chat/voice-chat', UPLOAD_VOICE_CHAT: '/api/chat/upload-voice-chat', // 充值相关 RECHARGE_BALANCE: '/api/recharge/balance', RECHARGE_CREATE_ORDER: '/api/recharge/create-order', RECHARGE_ORDER_STATUS: '/api/recharge/order-status', RECHARGE_HISTORY: '/api/recharge/history', // 角色相关 ROLE_QUERY: '/app/role/query', ROLE_DETAIL: '/api/role/query', // 配置相关 CONFIG_QUERY: '/app/config/query', CONFIG_MODELS: '/app/config/models', CONFIG_STT: '/app/config/stt', CONFIG_TEMPLATES: '/app/config/templates', CONFIG_TTS: '/app/config/tts' }, // WebSocket端点 WS_ENDPOINTS: { VOICE_STREAM: '/ws/voice-stream' }, // 请求超时时间(毫秒) TIMEOUT: 30000, // 登录超时时间(毫秒) LOGIN_TIMEOUT: 10000 }; // 导出完整的API URL构建函数 export const getApiUrl = (endpoint) => { return API_CONFIG.BASE_URL + endpoint; }; // 导出Web URL构建函数(用于登出等特殊接口) export const getWebUrl = (endpoint) => { return API_CONFIG.WEB_URL + endpoint; }; // 导出WebSocket URL构建函数 export const getWsUrl = (endpoint) => { return API_CONFIG.WS_BASE_URL + endpoint; };