Files
AIclinicalresearch/backend/src/modules/iit-manager/check-project-config.ts
HaHafeng 5a17d096a7 feat(pkb): Complete PKB module frontend migration with V3 design
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
2026-01-06 22:15:42 +08:00

98 lines
3.3 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 检查项目配置脚本
* 用于查看数据库中是否已配置 notification_config
*/
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function checkProjectConfig() {
console.log('🔍 检查项目配置...\n');
try {
// 查询所有项目
const projects = await prisma.$queryRaw<Array<{
id: string;
name: string;
redcap_project_id: string;
notification_config: any;
status: string;
}>>`
SELECT id, name, redcap_project_id, notification_config, status
FROM iit_schema.projects
ORDER BY created_at DESC
`;
if (projects.length === 0) {
console.log('❌ 数据库中没有项目记录');
console.log('\n💡 建议:请先运行 test-redcap-integration.ts 创建测试项目');
return;
}
console.log(`✅ 找到 ${projects.length} 个项目:\n`);
projects.forEach((project, index) => {
console.log(`\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);
console.log(`项目 ${index + 1}:`);
console.log(` 名称: ${project.name}`);
console.log(` REDCap项目ID: ${project.redcap_project_id}`);
console.log(` 状态: ${project.status}`);
console.log(` 数据库ID: ${project.id}`);
if (project.notification_config) {
const config = project.notification_config;
console.log(` \n 📧 通知配置:`);
if (config.wechat_user_id) {
console.log(` ✅ 企业微信UserID: ${config.wechat_user_id}`);
console.log(` 📤 通知发送给: ${config.wechat_user_id}`);
} else {
console.log(` ⚠️ 未配置 wechat_user_id`);
console.log(` 📤 通知发送给: ${process.env.WECHAT_TEST_USER_ID || '未配置环境变量'} (环境变量)`);
}
// 显示完整配置
console.log(` \n 完整配置: ${JSON.stringify(config, null, 2)}`);
} else {
console.log(` \n ⚠️ notification_config 为空`);
console.log(` 📤 通知发送给: ${process.env.WECHAT_TEST_USER_ID || '未配置环境变量'} (环境变量)`);
}
});
console.log('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
console.log('📋 配置优先级说明:');
console.log(' 1⃣ 项目配置 (notification_config.wechat_user_id) - 优先');
console.log(' 2⃣ 环境变量 (WECHAT_TEST_USER_ID) - 回退');
console.log(' 3⃣ 如果都没有 - 不发送通知\n');
console.log('💡 当前环境变量:');
console.log(` WECHAT_TEST_USER_ID = ${process.env.WECHAT_TEST_USER_ID || '未配置'}\n`);
console.log('🔧 如何添加项目配置:');
console.log(` UPDATE iit_schema.projects`);
console.log(` SET notification_config = jsonb_set(`);
console.log(` COALESCE(notification_config, '{}'::jsonb),`);
console.log(` '{wechat_user_id}',`);
console.log(` '"FengZhiBo"'`);
console.log(` )`);
console.log(` WHERE redcap_project_id = '16';\n`);
} catch (error: any) {
console.error('❌ 检查失败:', error.message);
} finally {
await prisma.$disconnect();
}
}
// 运行检查
checkProjectConfig().catch(console.error);