Files
wxapp_escort/utils/config.js
T

34 lines
1.5 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.
// 全局配置:环境开关、服务基址与网络参数集中在这里,上线只需改 DEBUG,
// request.js / chatmsg.js / api.js 均从这里取值
// 本地调试开关:置 true 时直连本机进程(health :9004、user :9010、ws :9005)
// 线上由 nginx 按路径分流(/user → 9010、/health → 9004),两个服务共用同一域名
const DEBUG = false
const LOCAL_HOST = '127.0.0.1'
const ONLINE_HOST = 'api.huashengtec.com'
module.exports = {
DEBUG,
// 服务端 wxsignin / wxgetphonenumber 用 appId 查 conf.json 里对应的
// appid+secret 去换 openid 和手机号,缺了会直接回 400「缺少 appId」
APP_ID: 'wxapp-escort',
// health 服务(request.js 默认实例)
BASE_URL: DEBUG ? `http://${LOCAL_HOST}:9004` : `https://${ONLINE_HOST}`,
// user 服务是独立进程,必须单独派生实例(api.js),
// 否则本地调试时 user 接口会打到 health 端口上走不通
USER_BASE_URL: DEBUG ? `http://${LOCAL_HOST}:9010` : `https://${ONLINE_HOST}`,
// AI 聊天 WebSocket:与 HTTP 同一开关,否则本机签发的 token 线上服务端查不到用户
WS_BASE_URL: DEBUG ? `ws://${LOCAL_HOST}:9005` : `wss://${ONLINE_HOST}/health-ws`,
// 语音 / 图片识别链路最长可到 60s,单独放宽超时,避免网络稍慢就整单失败
AI_MEDIA_TIMEOUT: 90000,
// WebSocket 心跳与重连参数(chatmsg.js 的默认值)
WS_HEARTBEAT_INTERVAL: 30000,
WS_MAX_RECONNECT_ATTEMPTS: 3,
WS_RECONNECT_DELAY: 3000,
}