Files
AIclinicalresearch/backend/src/modules/pkb/routes/health.ts
HaHafeng 303dd78c54 feat(aia): Protocol Agent MVP complete with one-click generation and Word export
- Add one-click research protocol generation with streaming output

- Implement Word document export via Pandoc integration

- Add dynamic dual-panel layout with resizable split pane

- Implement collapsible content for StatePanel stages

- Add conversation history management with title auto-update

- Fix scroll behavior, markdown rendering, and UI layout issues

- Simplify conversation creation logic for reliability
2026-01-25 19:16:36 +08:00

74 lines
1.2 KiB
TypeScript

/**
* PKB模块健康检查路由
*/
import { FastifyInstance, FastifyRequest, FastifyReply } from 'fastify';
import { prisma } from '../../../config/database.js';
export default async function healthRoutes(fastify: FastifyInstance) {
// PKB模块健康检查
fastify.get('/health', async (request: FastifyRequest, reply: FastifyReply) => {
try {
// 检查数据库连接
await prisma.$queryRaw`SELECT 1`;
// 检查pkb_schema是否可访问
const kbCount = await prisma.knowledgeBase.count();
return reply.send({
status: 'ok',
module: 'pkb',
version: 'v2',
timestamp: new Date().toISOString(),
database: {
connected: true,
schema: 'pkb_schema',
knowledgeBases: kbCount,
},
message: 'PKB模块运行正常',
});
} catch (error: any) {
return reply.status(503).send({
status: 'error',
module: 'pkb',
version: 'v2',
timestamp: new Date().toISOString(),
database: {
connected: false,
error: error.message,
},
message: 'PKB模块健康检查失败',
});
}
});
}