| 1234567891011121314151617181920212223242526 |
- 'use strict';
- // 健康检查与默认根目录
- const fs = require('fs');
- const { sendJson } = require('../util.js');
- function register(app, ctx) {
- app.get('/api/default-root', async ({ res }) => {
- sendJson(res, 200, { root: ctx.workspace.getWorkspaceRoot() });
- });
- app.get('/healthz', async ({ res }) => {
- sendJson(res, 200, { ok: true, workspace: ctx.workspace.getWorkspaceRoot() });
- });
- app.get('/readyz', async ({ res }) => {
- sendJson(res, 200, {
- ok: !!ctx.config.apiKey,
- workspaceReady: fs.existsSync(ctx.workspace.getWorkspaceRoot()),
- crawlReady: !!ctx.session.getKsid(),
- });
- });
- }
- module.exports = { register };
|