20 lines
888 B
TypeScript
20 lines
888 B
TypeScript
/**
|
||
* 本地启动平台服务:node server/dist/bin/serve.js(或 pnpm dev:server)。
|
||
* 配置来源见 ADR-0011:环境变量 > ~/.aps/config.json > 默认值。
|
||
*/
|
||
import { loadConfig, isEngineConfigured, redactConfig } from '../config.js';
|
||
import { startServer } from '../index.js';
|
||
|
||
const config = loadConfig();
|
||
const server = await startServer({ host: config.server.host, port: config.server.port });
|
||
|
||
console.log(`平台服务已启动:${server.url}(协议 v1)`);
|
||
console.log(`健康检查:${server.url}/v1/health`);
|
||
console.log(`配置:${JSON.stringify(redactConfig(config))}`);
|
||
console.log(isEngineConfigured(config) ? '模型:已配置(真引擎在 A3.3 接入)' : '模型:未配置,当前走假引擎');
|
||
|
||
for (const signal of ['SIGINT', 'SIGTERM'] as const) {
|
||
process.on(signal, () => {
|
||
void server.close().then(() => process.exit(0));
|
||
});
|
||
} |