This commit is contained in:
2025-11-24 18:44:17 +08:00
parent 19aa7a1f8f
commit 8d861d5b6f
11 changed files with 1017 additions and 158 deletions

63
src/utils/config.js Normal file
View File

@@ -0,0 +1,63 @@
// API配置统一管理
export const API_CONFIG = {
// 基础API地址
BASE_URL: 'https://api.aixsy.com.cn',
// 其他服务地址(如果需要)
WEB_URL: 'https://www.aixsy.com.cn',
// 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'
},
// 请求超时时间(毫秒)
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;
};