2026-07-11 13:01:05 +08:00
|
|
|
// Production default for miniapp release / 提审.
|
|
|
|
|
// Local Portal debug: set LOCAL_DEV = true, or copy config.local.example.js → config.local.js
|
|
|
|
|
const LOCAL_DEV = false;
|
|
|
|
|
|
2026-07-11 13:02:34 +08:00
|
|
|
function createUuid() {
|
|
|
|
|
const bytes = [];
|
|
|
|
|
for (let i = 0; i < 16; i += 1) {
|
|
|
|
|
bytes.push(Math.floor(Math.random() * 256));
|
|
|
|
|
}
|
|
|
|
|
bytes[6] = (bytes[6] & 0x0f) | 0x40;
|
|
|
|
|
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
|
|
|
const hex = bytes.map((byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
|
|
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-11 13:01:05 +08:00
|
|
|
const defaults = {
|
|
|
|
|
API_BASE_URL: LOCAL_DEV ? 'http://127.0.0.1:8081' : 'https://m.tkmind.cn',
|
2026-07-11 08:46:08 +08:00
|
|
|
MINIAPP_LOGIN_PATH: '/auth/wechat-miniapp/login',
|
2026-07-11 13:05:44 +08:00
|
|
|
SESSION_COOKIE_NAME: 'tkmind_user_session',
|
2026-07-11 08:51:30 +08:00
|
|
|
SELECTED_SESSION_KEY: 'tkmind_selected_session_id',
|
2026-07-11 08:46:08 +08:00
|
|
|
AGENT_RUN_POLL_MS: 1200,
|
2026-07-11 13:01:05 +08:00
|
|
|
AGENT_RUN_MAX_POLLS: 120,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let localOverrides = {};
|
|
|
|
|
try {
|
|
|
|
|
localOverrides = require('./config.local.js');
|
|
|
|
|
} catch {
|
|
|
|
|
// Optional gitignored overrides in utils/config.local.js
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
2026-07-11 13:02:34 +08:00
|
|
|
createUuid,
|
2026-07-11 13:01:05 +08:00
|
|
|
...defaults,
|
|
|
|
|
...localOverrides,
|
|
|
|
|
...(localOverrides.API_BASE_URL
|
|
|
|
|
? { API_BASE_URL: String(localOverrides.API_BASE_URL).replace(/\/$/, '') }
|
|
|
|
|
: {}),
|
2026-07-11 08:46:08 +08:00
|
|
|
};
|