Files
webUI/src/utils/config.js
2025-12-06 22:42:05 +08:00

95 lines
2.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 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;
};