Summary: - Implement PKB Dashboard and Workspace pages based on V3 prototype - Add single-layer header with integrated Tab navigation - Implement 3 work modes: Full Text, Deep Read, Batch Processing - Integrate Ant Design X Chat component for AI conversations - Create BatchModeComplete with template selection and document processing - Add compact work mode selector with dropdown design Backend: - Migrate PKB controllers and services to /modules/pkb structure - Register v2 API routes at /api/v2/pkb/knowledge - Maintain dual API routes for backward compatibility Technical details: - Use Zustand for state management - Handle SSE streaming responses for AI chat - Support document selection for Deep Read mode - Implement batch processing with progress tracking Known issues: - Batch processing API integration pending - Knowledge assets page navigation needs optimization Status: Frontend functional, pending refinement
46 lines
1.2 KiB
TypeScript
46 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模块健康检查失败',
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
|