aps-agent/server/bin/serve.ts

20 lines
888 B
TypeScript
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.

/**
* 本地启动平台服务: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));
});
}