config.ts
679 Bytes
import type { Route } from './context';
import { configView } from '../config';
/** 配置视图与系统快照。 */
export const configRoutes: Route[] = [
// ---- GET /api/config:返回模型配置视图 ----
{
method: 'GET',
path: '/api/config',
handle: ({ ctx, res }) => {
const view = configView(ctx.model, ctx.opts.maxConcurrent);
ctx.sendJson(res, 200, view);
},
},
// ---- GET /api/admin/status(系统快照)----
{
method: 'GET',
path: '/api/admin/status',
handle: ({ ctx, res }) => {
ctx.sendJson(res, 200, ctx.computeStatus());
},
},
];