diff --git a/COMMIT_DAY1.txt b/COMMIT_DAY1.txt index 6e866ebd..ad7094ab 100644 --- a/COMMIT_DAY1.txt +++ b/COMMIT_DAY1.txt @@ -42,3 +42,6 @@ Status: Day 1 complete (11/11 tasks), ready for Day 2 + + + diff --git a/DC模块代码恢复指南.md b/DC模块代码恢复指南.md index 6ede6c36..850602bb 100644 --- a/DC模块代码恢复指南.md +++ b/DC模块代码恢复指南.md @@ -268,6 +268,9 @@ + + + diff --git a/SAE_WECHAT_MP_DEPLOY_STEPS.md b/SAE_WECHAT_MP_DEPLOY_STEPS.md index 575b961f..146c1373 100644 --- a/SAE_WECHAT_MP_DEPLOY_STEPS.md +++ b/SAE_WECHAT_MP_DEPLOY_STEPS.md @@ -218,3 +218,6 @@ https://iit.xunzhengyixue.com/api/v1/iit/health + + + diff --git a/backend/DEPLOY_TO_SAE_FOR_WECHAT_MP.md b/backend/DEPLOY_TO_SAE_FOR_WECHAT_MP.md index baac104e..24ac1790 100644 --- a/backend/DEPLOY_TO_SAE_FOR_WECHAT_MP.md +++ b/backend/DEPLOY_TO_SAE_FOR_WECHAT_MP.md @@ -147,3 +147,6 @@ https://iit.xunzhengyixue.com/api/v1/iit/health + + + diff --git a/backend/RESTART_SERVER_NOW.md b/backend/RESTART_SERVER_NOW.md index d2b18832..2f666841 100644 --- a/backend/RESTART_SERVER_NOW.md +++ b/backend/RESTART_SERVER_NOW.md @@ -48,3 +48,6 @@ + + + diff --git a/backend/WECHAT_MP_CONFIG_READY.md b/backend/WECHAT_MP_CONFIG_READY.md index 54d31b3e..11eed4dc 100644 --- a/backend/WECHAT_MP_CONFIG_READY.md +++ b/backend/WECHAT_MP_CONFIG_READY.md @@ -308,3 +308,6 @@ npx tsx src/modules/iit-manager/test-patient-wechat-url-verify.ts + + + diff --git a/backend/WECHAT_MP_QUICK_FIX.md b/backend/WECHAT_MP_QUICK_FIX.md index 09e5d637..80e4531f 100644 --- a/backend/WECHAT_MP_QUICK_FIX.md +++ b/backend/WECHAT_MP_QUICK_FIX.md @@ -170,3 +170,6 @@ npm run dev + + + diff --git a/backend/check_db.ts b/backend/check_db.ts index eb6d6955..a00702d6 100644 --- a/backend/check_db.ts +++ b/backend/check_db.ts @@ -47,3 +47,6 @@ main() .catch(console.error) .finally(() => prisma.$disconnect()); + + + diff --git a/backend/check_db_data.ts b/backend/check_db_data.ts index 89f8c3cf..5a2b125c 100644 --- a/backend/check_db_data.ts +++ b/backend/check_db_data.ts @@ -41,3 +41,6 @@ main() .catch(console.error) .finally(() => prisma.$disconnect()); + + + diff --git a/backend/check_iit.ts b/backend/check_iit.ts index 461a0b68..2748a44e 100644 --- a/backend/check_iit.ts +++ b/backend/check_iit.ts @@ -36,3 +36,6 @@ main() .catch(console.error) .finally(() => prisma.$disconnect()); + + + diff --git a/backend/check_iit_asl_data.ts b/backend/check_iit_asl_data.ts index d09b59ef..195a480b 100644 --- a/backend/check_iit_asl_data.ts +++ b/backend/check_iit_asl_data.ts @@ -68,3 +68,6 @@ main() .catch(console.error) .finally(() => prisma.$disconnect()); + + + diff --git a/backend/check_queue_table.ts b/backend/check_queue_table.ts index 22f7f99b..e1d3364d 100644 --- a/backend/check_queue_table.ts +++ b/backend/check_queue_table.ts @@ -31,3 +31,6 @@ main() .catch(console.error) .finally(() => prisma.$disconnect()); + + + diff --git a/backend/check_rvw_issue.ts b/backend/check_rvw_issue.ts index 379b3ad8..2318019f 100644 --- a/backend/check_rvw_issue.ts +++ b/backend/check_rvw_issue.ts @@ -72,3 +72,6 @@ main() .catch(console.error) .finally(() => prisma.$disconnect()); + + + diff --git a/backend/check_tables.ts b/backend/check_tables.ts index 915f0be1..26989c38 100644 --- a/backend/check_tables.ts +++ b/backend/check_tables.ts @@ -19,3 +19,6 @@ main() .catch(console.error) .finally(() => prisma.$disconnect()); + + + diff --git a/backend/compare_db.ts b/backend/compare_db.ts index aacfe763..3cd1eea3 100644 --- a/backend/compare_db.ts +++ b/backend/compare_db.ts @@ -107,3 +107,6 @@ main() .catch(console.error) .finally(() => prisma.$disconnect()); + + + diff --git a/backend/compare_dc_asl.ts b/backend/compare_dc_asl.ts index 1160396b..404eb0dc 100644 --- a/backend/compare_dc_asl.ts +++ b/backend/compare_dc_asl.ts @@ -78,3 +78,6 @@ main() .catch(console.error) .finally(() => prisma.$disconnect()); + + + diff --git a/backend/compare_pkb_aia_rvw.ts b/backend/compare_pkb_aia_rvw.ts index 9747075b..ac637688 100644 --- a/backend/compare_pkb_aia_rvw.ts +++ b/backend/compare_pkb_aia_rvw.ts @@ -64,3 +64,6 @@ main() .catch(console.error) .finally(() => prisma.$disconnect()); + + + diff --git a/backend/compare_schema_db.ts b/backend/compare_schema_db.ts index 29b32e1a..b8e16b54 100644 --- a/backend/compare_schema_db.ts +++ b/backend/compare_schema_db.ts @@ -106,3 +106,6 @@ main() .catch(console.error) .finally(() => prisma.$disconnect()); + + + diff --git a/backend/create_mock_user.sql b/backend/create_mock_user.sql index 57ec0946..08e92690 100644 --- a/backend/create_mock_user.sql +++ b/backend/create_mock_user.sql @@ -17,3 +17,6 @@ VALUES ( ) ON CONFLICT (id) DO NOTHING; + + + diff --git a/backend/create_mock_user_platform.sql b/backend/create_mock_user_platform.sql index 66f112b5..1ef10257 100644 --- a/backend/create_mock_user_platform.sql +++ b/backend/create_mock_user_platform.sql @@ -49,3 +49,6 @@ VALUES ( ) ON CONFLICT (id) DO NOTHING; + + + diff --git a/backend/migrations/add_data_stats_to_tool_c_session.sql b/backend/migrations/add_data_stats_to_tool_c_session.sql index 087c9baf..9ea35df3 100644 --- a/backend/migrations/add_data_stats_to_tool_c_session.sql +++ b/backend/migrations/add_data_stats_to_tool_c_session.sql @@ -63,6 +63,9 @@ WHERE table_schema = 'dc_schema' + + + diff --git a/backend/prisma/manual-migrations/001_add_postgres_cache_and_checkpoint.sql b/backend/prisma/manual-migrations/001_add_postgres_cache_and_checkpoint.sql index a3c65c4e..720b1024 100644 --- a/backend/prisma/manual-migrations/001_add_postgres_cache_and_checkpoint.sql +++ b/backend/prisma/manual-migrations/001_add_postgres_cache_and_checkpoint.sql @@ -101,6 +101,9 @@ ORDER BY ordinal_position; + + + diff --git a/backend/prisma/manual-migrations/run-migration-002.ts b/backend/prisma/manual-migrations/run-migration-002.ts index 55eaf262..ecb5f34a 100644 --- a/backend/prisma/manual-migrations/run-migration-002.ts +++ b/backend/prisma/manual-migrations/run-migration-002.ts @@ -114,6 +114,9 @@ runMigration() + + + diff --git a/backend/prisma/migrations/20251208_add_column_mapping/migration.sql b/backend/prisma/migrations/20251208_add_column_mapping/migration.sql index b26dac9e..972ae4ea 100644 --- a/backend/prisma/migrations/20251208_add_column_mapping/migration.sql +++ b/backend/prisma/migrations/20251208_add_column_mapping/migration.sql @@ -48,6 +48,9 @@ COMMENT ON COLUMN "dc_schema"."dc_tool_c_sessions"."column_mapping" IS '列名 + + + diff --git a/backend/prisma/migrations/create_tool_c_session.sql b/backend/prisma/migrations/create_tool_c_session.sql index 39276fd0..fd6b5004 100644 --- a/backend/prisma/migrations/create_tool_c_session.sql +++ b/backend/prisma/migrations/create_tool_c_session.sql @@ -75,6 +75,9 @@ COMMENT ON COLUMN dc_schema.dc_tool_c_sessions.expires_at IS '过期时间(创 + + + diff --git a/backend/rebuild-and-push.ps1 b/backend/rebuild-and-push.ps1 index c5d79987..2f50c2da 100644 --- a/backend/rebuild-and-push.ps1 +++ b/backend/rebuild-and-push.ps1 @@ -115,6 +115,9 @@ Write-Host "" + + + diff --git a/backend/recover-code-from-cursor-db.js b/backend/recover-code-from-cursor-db.js index e62abeec..3b6f9d63 100644 --- a/backend/recover-code-from-cursor-db.js +++ b/backend/recover-code-from-cursor-db.js @@ -225,6 +225,9 @@ function extractCodeBlocks(obj, blocks = []) { + + + diff --git a/backend/restore_job_common.sql b/backend/restore_job_common.sql index 9adfda8d..13cf99c5 100644 --- a/backend/restore_job_common.sql +++ b/backend/restore_job_common.sql @@ -26,3 +26,6 @@ CREATE TABLE IF NOT EXISTS platform_schema.job_common ( policy text ); + + + diff --git a/backend/restore_pgboss_functions.sql b/backend/restore_pgboss_functions.sql index 2ef31156..b5bc40e2 100644 --- a/backend/restore_pgboss_functions.sql +++ b/backend/restore_pgboss_functions.sql @@ -100,3 +100,6 @@ CREATE OR REPLACE FUNCTION platform_schema.delete_queue(queue_name text) RETURNS END; $$; + + + diff --git a/backend/scripts/check-dc-tables.mjs b/backend/scripts/check-dc-tables.mjs index f5bcdb04..ce0d97ec 100644 --- a/backend/scripts/check-dc-tables.mjs +++ b/backend/scripts/check-dc-tables.mjs @@ -244,6 +244,9 @@ checkDCTables(); + + + diff --git a/backend/scripts/create-capability-schema.sql b/backend/scripts/create-capability-schema.sql index e44bc9e1..7379934b 100644 --- a/backend/scripts/create-capability-schema.sql +++ b/backend/scripts/create-capability-schema.sql @@ -1,3 +1,6 @@ -- Create capability_schema for Prompt Management System CREATE SCHEMA IF NOT EXISTS capability_schema; + + + diff --git a/backend/scripts/create-tool-c-ai-history-table.mjs b/backend/scripts/create-tool-c-ai-history-table.mjs index 5f788746..6459300f 100644 --- a/backend/scripts/create-tool-c-ai-history-table.mjs +++ b/backend/scripts/create-tool-c-ai-history-table.mjs @@ -196,6 +196,9 @@ createAiHistoryTable() + + + diff --git a/backend/scripts/create-tool-c-table.js b/backend/scripts/create-tool-c-table.js index c1401538..31b157a8 100644 --- a/backend/scripts/create-tool-c-table.js +++ b/backend/scripts/create-tool-c-table.js @@ -183,6 +183,9 @@ createToolCTable() + + + diff --git a/backend/scripts/create-tool-c-table.mjs b/backend/scripts/create-tool-c-table.mjs index 9ab92643..430111ee 100644 --- a/backend/scripts/create-tool-c-table.mjs +++ b/backend/scripts/create-tool-c-table.mjs @@ -180,6 +180,9 @@ createToolCTable() + + + diff --git a/backend/scripts/setup-prompt-system.ts b/backend/scripts/setup-prompt-system.ts index c6c1ccbf..4995f205 100644 --- a/backend/scripts/setup-prompt-system.ts +++ b/backend/scripts/setup-prompt-system.ts @@ -111,3 +111,6 @@ main() .catch(console.error) .finally(() => prisma.$disconnect()); + + + diff --git a/backend/scripts/test-pkb-apis-simple.ts b/backend/scripts/test-pkb-apis-simple.ts index d4a4b818..ecee54f9 100644 --- a/backend/scripts/test-pkb-apis-simple.ts +++ b/backend/scripts/test-pkb-apis-simple.ts @@ -331,3 +331,6 @@ runTests().catch(error => { + + + diff --git a/backend/scripts/test-prompt-api.ts b/backend/scripts/test-prompt-api.ts index 970176a2..b2a46ac0 100644 --- a/backend/scripts/test-prompt-api.ts +++ b/backend/scripts/test-prompt-api.ts @@ -77,3 +77,6 @@ async function testAPI() { testAPI().catch(console.error); + + + diff --git a/backend/scripts/verify-pkb-rvw-schema.ts b/backend/scripts/verify-pkb-rvw-schema.ts index 3d0e08b3..7e8635b3 100644 --- a/backend/scripts/verify-pkb-rvw-schema.ts +++ b/backend/scripts/verify-pkb-rvw-schema.ts @@ -296,3 +296,6 @@ verifySchemas() + + + diff --git a/backend/src/common/auth/auth.controller.ts b/backend/src/common/auth/auth.controller.ts index 2165390f..93a81250 100644 --- a/backend/src/common/auth/auth.controller.ts +++ b/backend/src/common/auth/auth.controller.ts @@ -235,7 +235,7 @@ export async function logout( /** - * ȡǰûɷʵģ + * ��ȡ��ǰ�û��ɷ��ʵ�ģ�� * * GET /api/v1/auth/me/modules */ @@ -248,11 +248,11 @@ export async function getUserModules( return reply.status(401).send({ success: false, error: 'Unauthorized', - message: 'δ֤', + message: 'δ��֤', }); } - // SUPER_ADMIN PROMPT_ENGINEER Էģ + // SUPER_ADMIN �� PROMPT_ENGINEER ���Է�������ģ�� if (request.user.role === 'SUPER_ADMIN' || request.user.role === 'PROMPT_ENGINEER') { const { moduleService } = await import('./module.service.js'); const allModules = await moduleService.getAllModules(); @@ -270,8 +270,8 @@ export async function getUserModules( data: result.modules, }); } catch (error) { - const message = error instanceof Error ? error.message : 'ȡûģʧ'; - logger.error('ȡûģʧ', { error: message, userId: request.user?.userId }); + const message = error instanceof Error ? error.message : '��ȡ�û�ģ��ʧ��'; + logger.error('��ȡ�û�ģ��ʧ��', { error: message, userId: request.user?.userId }); return reply.status(500).send({ success: false, diff --git a/backend/src/common/auth/jwt.service.ts b/backend/src/common/auth/jwt.service.ts index 9ee3df3e..6b9a3462 100644 --- a/backend/src/common/auth/jwt.service.ts +++ b/backend/src/common/auth/jwt.service.ts @@ -184,3 +184,6 @@ export class JWTService { // 导出单例 export const jwtService = new JWTService(); + + + diff --git a/backend/src/common/jobs/utils.ts b/backend/src/common/jobs/utils.ts index edcaf424..d292e392 100644 --- a/backend/src/common/jobs/utils.ts +++ b/backend/src/common/jobs/utils.ts @@ -312,6 +312,9 @@ export function getBatchItems( + + + diff --git a/backend/src/common/prompt/prompt.fallbacks.ts b/backend/src/common/prompt/prompt.fallbacks.ts index 25a11fe0..db859608 100644 --- a/backend/src/common/prompt/prompt.fallbacks.ts +++ b/backend/src/common/prompt/prompt.fallbacks.ts @@ -100,3 +100,4 @@ export function getAllFallbackCodes(): string[] { + diff --git a/backend/src/common/prompt/prompt.types.ts b/backend/src/common/prompt/prompt.types.ts index 61231c85..50c79b0d 100644 --- a/backend/src/common/prompt/prompt.types.ts +++ b/backend/src/common/prompt/prompt.types.ts @@ -69,3 +69,4 @@ export interface VariableValidation { + diff --git a/backend/src/modules/admin/routes/tenantRoutes.ts b/backend/src/modules/admin/routes/tenantRoutes.ts index 774086d9..5498b58f 100644 --- a/backend/src/modules/admin/routes/tenantRoutes.ts +++ b/backend/src/modules/admin/routes/tenantRoutes.ts @@ -75,3 +75,4 @@ export async function moduleRoutes(fastify: FastifyInstance) { }); } + diff --git a/backend/src/modules/admin/types/tenant.types.ts b/backend/src/modules/admin/types/tenant.types.ts index 466e8f9c..517d5a08 100644 --- a/backend/src/modules/admin/types/tenant.types.ts +++ b/backend/src/modules/admin/types/tenant.types.ts @@ -105,3 +105,4 @@ export interface PaginatedResponse { totalPages: number; } + diff --git a/backend/src/modules/asl/controllers/literatureController.ts b/backend/src/modules/asl/controllers/literatureController.ts index ce6d6066..d7587721 100644 --- a/backend/src/modules/asl/controllers/literatureController.ts +++ b/backend/src/modules/asl/controllers/literatureController.ts @@ -9,6 +9,17 @@ import { logger } from '../../../common/logging/index.js'; import * as XLSX from 'xlsx'; import { startScreeningTask } from '../services/screeningService.js'; +/** + * 获取用户ID(从JWT Token中获取) + */ +function getUserId(request: FastifyRequest): string { + const userId = (request as any).user?.userId; + if (!userId) { + throw new Error('User not authenticated'); + } + return userId; +} + /** * 导入文献(从Excel或JSON) */ @@ -17,7 +28,7 @@ export async function importLiteratures( reply: FastifyReply ) { try { - const userId = (request as any).userId || 'asl-test-user-001'; + const userId = getUserId(request); const { projectId, literatures } = request.body; // 验证项目归属 @@ -90,7 +101,7 @@ export async function importLiteraturesFromExcel( reply: FastifyReply ) { try { - const userId = (request as any).userId || 'asl-test-user-001'; + const userId = getUserId(request); // 获取上传的文件 const data = await request.file(); @@ -176,7 +187,7 @@ export async function getLiteratures( reply: FastifyReply ) { try { - const userId = (request as any).userId || 'asl-test-user-001'; + const userId = getUserId(request); const { projectId } = request.params; const { page = 1, limit = 50 } = request.query; @@ -239,7 +250,7 @@ export async function deleteLiterature( reply: FastifyReply ) { try { - const userId = (request as any).userId || 'asl-test-user-001'; + const userId = getUserId(request); const { literatureId } = request.params; // 验证文献归属 diff --git a/backend/src/modules/asl/controllers/projectController.ts b/backend/src/modules/asl/controllers/projectController.ts index f7321b27..293113b3 100644 --- a/backend/src/modules/asl/controllers/projectController.ts +++ b/backend/src/modules/asl/controllers/projectController.ts @@ -7,16 +7,26 @@ import { CreateScreeningProjectDto } from '../types/index.js'; import { prisma } from '../../../config/database.js'; import { logger } from '../../../common/logging/index.js'; +/** + * 获取用户ID(从JWT Token中获取) + */ +function getUserId(request: FastifyRequest): string { + const userId = (request as any).user?.userId; + if (!userId) { + throw new Error('User not authenticated'); + } + return userId; +} + /** * 创建筛选项目 */ export async function createProject( - request: FastifyRequest<{ Body: CreateScreeningProjectDto & { userId?: string } }>, + request: FastifyRequest<{ Body: CreateScreeningProjectDto }>, reply: FastifyReply ) { try { - // 临时测试模式:优先从JWT获取,否则从请求体获取 - const userId = (request as any).userId || (request.body as any).userId || 'asl-test-user-001'; + const userId = getUserId(request); const { projectName, picoCriteria, inclusionCriteria, exclusionCriteria, screeningConfig } = request.body; // 验证必填字段 @@ -65,7 +75,7 @@ export async function createProject( */ export async function getProjects(request: FastifyRequest, reply: FastifyReply) { try { - const userId = (request as any).userId || 'asl-test-user-001'; + const userId = getUserId(request); const projects = await prisma.aslScreeningProject.findMany({ where: { userId }, @@ -100,7 +110,7 @@ export async function getProjectById( reply: FastifyReply ) { try { - const userId = (request as any).userId || 'asl-test-user-001'; + const userId = getUserId(request); const { projectId } = request.params; const project = await prisma.aslScreeningProject.findFirst({ @@ -148,7 +158,7 @@ export async function updateProject( reply: FastifyReply ) { try { - const userId = (request as any).userId || 'asl-test-user-001'; + const userId = getUserId(request); const { projectId } = request.params; const updateData = request.body; @@ -190,7 +200,7 @@ export async function deleteProject( reply: FastifyReply ) { try { - const userId = (request as any).userId || 'asl-test-user-001'; + const userId = getUserId(request); const { projectId } = request.params; // 验证项目归属 diff --git a/backend/src/modules/asl/controllers/screeningController.ts b/backend/src/modules/asl/controllers/screeningController.ts index 1ace19d2..9a269c7b 100644 --- a/backend/src/modules/asl/controllers/screeningController.ts +++ b/backend/src/modules/asl/controllers/screeningController.ts @@ -6,6 +6,17 @@ import { FastifyRequest, FastifyReply } from 'fastify'; import { prisma } from '../../../config/database.js'; import { logger } from '../../../common/logging/index.js'; +/** + * 获取用户ID(从JWT Token中获取) + */ +function getUserId(request: FastifyRequest): string { + const userId = (request as any).user?.userId; + if (!userId) { + throw new Error('User not authenticated'); + } + return userId; +} + /** * 获取筛选任务进度 * GET /api/v1/asl/projects/:projectId/screening-task @@ -15,7 +26,7 @@ export async function getScreeningTask( reply: FastifyReply ) { try { - const userId = (request as any).userId || 'asl-test-user-001'; + const userId = getUserId(request); const { projectId } = request.params; // 验证项目归属 @@ -74,7 +85,7 @@ export async function getScreeningResults( reply: FastifyReply ) { try { - const userId = (request as any).userId || 'asl-test-user-001'; + const userId = getUserId(request); const { projectId } = request.params; const page = parseInt(request.query.page || '1', 10); const pageSize = parseInt(request.query.pageSize || '50', 10); @@ -175,7 +186,7 @@ export async function getScreeningResultDetail( reply: FastifyReply ) { try { - const userId = (request as any).userId || 'asl-test-user-001'; + const userId = getUserId(request); const { resultId } = request.params; const result = await prisma.aslScreeningResult.findUnique({ @@ -241,7 +252,7 @@ export async function reviewScreeningResult( reply: FastifyReply ) { try { - const userId = (request as any).userId || 'asl-test-user-001'; + const userId = getUserId(request); const { resultId } = request.params; const { decision, note } = request.body; @@ -327,7 +338,7 @@ export async function getProjectStatistics( reply: FastifyReply ) { try { - const userId = (request as any).userId || 'asl-test-user-001'; + const userId = getUserId(request); const { projectId } = request.params; // 1. 验证项目归属 diff --git a/backend/src/modules/asl/fulltext-screening/__tests__/api-integration-test.ts b/backend/src/modules/asl/fulltext-screening/__tests__/api-integration-test.ts index f044e34c..3b19b01f 100644 --- a/backend/src/modules/asl/fulltext-screening/__tests__/api-integration-test.ts +++ b/backend/src/modules/asl/fulltext-screening/__tests__/api-integration-test.ts @@ -348,6 +348,9 @@ runTests().catch((error) => { + + + diff --git a/backend/src/modules/asl/fulltext-screening/__tests__/e2e-real-test-v2.ts b/backend/src/modules/asl/fulltext-screening/__tests__/e2e-real-test-v2.ts index eddb5bed..8d356053 100644 --- a/backend/src/modules/asl/fulltext-screening/__tests__/e2e-real-test-v2.ts +++ b/backend/src/modules/asl/fulltext-screening/__tests__/e2e-real-test-v2.ts @@ -289,6 +289,9 @@ runTest() + + + diff --git a/backend/src/modules/asl/fulltext-screening/__tests__/fulltext-screening-api.http b/backend/src/modules/asl/fulltext-screening/__tests__/fulltext-screening-api.http index 042f74aa..d2e2f481 100644 --- a/backend/src/modules/asl/fulltext-screening/__tests__/fulltext-screening-api.http +++ b/backend/src/modules/asl/fulltext-screening/__tests__/fulltext-screening-api.http @@ -327,6 +327,9 @@ Content-Type: application/json + + + diff --git a/backend/src/modules/asl/fulltext-screening/controllers/FulltextScreeningController.ts b/backend/src/modules/asl/fulltext-screening/controllers/FulltextScreeningController.ts index 0a87338a..40f1a8f7 100644 --- a/backend/src/modules/asl/fulltext-screening/controllers/FulltextScreeningController.ts +++ b/backend/src/modules/asl/fulltext-screening/controllers/FulltextScreeningController.ts @@ -18,6 +18,17 @@ import { FulltextScreeningService } from '../services/FulltextScreeningService.j // 初始化服务 const screeningService = new FulltextScreeningService(); +/** + * 获取用户ID(从JWT Token中获取) + */ +function getUserId(request: FastifyRequest): string { + const userId = (request as any).user?.userId; + if (!userId) { + throw new Error('User not authenticated'); + } + return userId; +} + // ==================== Zod验证Schema ==================== /** @@ -79,7 +90,7 @@ export async function createTask( const { projectId, literatureIds, modelA, modelB, promptVersion } = validated; // 获取当前用户ID(测试模式) - const userId = (request as any).userId || 'asl-test-user-001'; + const userId = getUserId(request); logger.info('Creating fulltext screening task', { projectId, @@ -204,7 +215,7 @@ export async function getTaskProgress( ) { try { const { taskId } = request.params; - const userId = (request as any).userId || 'asl-test-user-001'; + const userId = getUserId(request); // 获取任务详情 const task = await prisma.aslFulltextScreeningTask.findFirst({ @@ -318,7 +329,7 @@ export async function getTaskResults( ) { try { const { taskId } = request.params; - const userId = (request as any).userId || 'asl-test-user-001'; + const userId = getUserId(request); // 参数验证 const validated = GetResultsQuerySchema.parse(request.query); @@ -507,7 +518,7 @@ export async function updateDecision( ) { try { const { resultId } = request.params; - const userId = (request as any).userId || 'asl-test-user-001'; + const userId = getUserId(request); // 参数验证 const validated = UpdateDecisionSchema.parse(request.body); @@ -589,7 +600,7 @@ export async function exportExcel( ) { try { const { taskId } = request.params; - const userId = (request as any).userId || 'asl-test-user-001'; + const userId = getUserId(request); // 验证任务权限 const task = await prisma.aslFulltextScreeningTask.findFirst({ diff --git a/backend/src/modules/dc/tool-b/services/ConflictDetectionService.ts b/backend/src/modules/dc/tool-b/services/ConflictDetectionService.ts index dd7fde3a..643032fa 100644 --- a/backend/src/modules/dc/tool-b/services/ConflictDetectionService.ts +++ b/backend/src/modules/dc/tool-b/services/ConflictDetectionService.ts @@ -267,5 +267,6 @@ export const conflictDetectionService = new ConflictDetectionService(); + diff --git a/backend/src/modules/dc/tool-c/README.md b/backend/src/modules/dc/tool-c/README.md index 4e5a9812..530c584b 100644 --- a/backend/src/modules/dc/tool-c/README.md +++ b/backend/src/modules/dc/tool-c/README.md @@ -217,5 +217,6 @@ curl -X POST http://localhost:3000/api/v1/dc/tool-c/test/execute \ + diff --git a/backend/src/modules/dc/tool-c/controllers/StreamAIController.ts b/backend/src/modules/dc/tool-c/controllers/StreamAIController.ts index 9859cb7c..7108757b 100644 --- a/backend/src/modules/dc/tool-c/controllers/StreamAIController.ts +++ b/backend/src/modules/dc/tool-c/controllers/StreamAIController.ts @@ -271,5 +271,6 @@ export const streamAIController = new StreamAIController(); + diff --git a/backend/src/modules/iit-manager/agents/SessionMemory.ts b/backend/src/modules/iit-manager/agents/SessionMemory.ts index 4dbc431c..fc41b8d5 100644 --- a/backend/src/modules/iit-manager/agents/SessionMemory.ts +++ b/backend/src/modules/iit-manager/agents/SessionMemory.ts @@ -180,3 +180,6 @@ logger.info('[SessionMemory] 会话记忆管理器已启动', { + + + diff --git a/backend/src/modules/iit-manager/check-iit-table-structure.ts b/backend/src/modules/iit-manager/check-iit-table-structure.ts index e5c7b00a..88959889 100644 --- a/backend/src/modules/iit-manager/check-iit-table-structure.ts +++ b/backend/src/modules/iit-manager/check-iit-table-structure.ts @@ -114,3 +114,6 @@ checkTableStructure(); + + + diff --git a/backend/src/modules/iit-manager/check-project-config.ts b/backend/src/modules/iit-manager/check-project-config.ts index 37ff9b7f..2ad18bed 100644 --- a/backend/src/modules/iit-manager/check-project-config.ts +++ b/backend/src/modules/iit-manager/check-project-config.ts @@ -101,3 +101,6 @@ checkProjectConfig().catch(console.error); + + + diff --git a/backend/src/modules/iit-manager/check-test-project-in-db.ts b/backend/src/modules/iit-manager/check-test-project-in-db.ts index 0568720e..86523b99 100644 --- a/backend/src/modules/iit-manager/check-test-project-in-db.ts +++ b/backend/src/modules/iit-manager/check-test-project-in-db.ts @@ -83,3 +83,6 @@ main(); + + + diff --git a/backend/src/modules/iit-manager/docs/微信服务号接入指南.md b/backend/src/modules/iit-manager/docs/微信服务号接入指南.md index a70704d6..e7fd566f 100644 --- a/backend/src/modules/iit-manager/docs/微信服务号接入指南.md +++ b/backend/src/modules/iit-manager/docs/微信服务号接入指南.md @@ -540,3 +540,6 @@ URL: https://iit.xunzhengyixue.com/api/v1/iit/patient-wechat/callback + + + diff --git a/backend/src/modules/iit-manager/generate-wechat-tokens.ts b/backend/src/modules/iit-manager/generate-wechat-tokens.ts index e6d9dcd8..c6afa2a1 100644 --- a/backend/src/modules/iit-manager/generate-wechat-tokens.ts +++ b/backend/src/modules/iit-manager/generate-wechat-tokens.ts @@ -175,3 +175,6 @@ console.log(''); + + + diff --git a/backend/src/modules/iit-manager/services/PatientWechatService.ts b/backend/src/modules/iit-manager/services/PatientWechatService.ts index 70d04e9f..111a5137 100644 --- a/backend/src/modules/iit-manager/services/PatientWechatService.ts +++ b/backend/src/modules/iit-manager/services/PatientWechatService.ts @@ -492,3 +492,6 @@ export const patientWechatService = new PatientWechatService(); + + + diff --git a/backend/src/modules/iit-manager/test-chatservice-dify.ts b/backend/src/modules/iit-manager/test-chatservice-dify.ts index 5c353f52..32089739 100644 --- a/backend/src/modules/iit-manager/test-chatservice-dify.ts +++ b/backend/src/modules/iit-manager/test-chatservice-dify.ts @@ -137,3 +137,6 @@ testDifyIntegration().catch(error => { + + + diff --git a/backend/src/modules/iit-manager/test-iit-database.ts b/backend/src/modules/iit-manager/test-iit-database.ts index f7a91cca..826ebf21 100644 --- a/backend/src/modules/iit-manager/test-iit-database.ts +++ b/backend/src/modules/iit-manager/test-iit-database.ts @@ -166,3 +166,6 @@ testIitDatabase() + + + diff --git a/backend/src/modules/iit-manager/test-patient-wechat-config.ts b/backend/src/modules/iit-manager/test-patient-wechat-config.ts index 2d9973b1..2fce0610 100644 --- a/backend/src/modules/iit-manager/test-patient-wechat-config.ts +++ b/backend/src/modules/iit-manager/test-patient-wechat-config.ts @@ -152,3 +152,6 @@ if (hasError) { + + + diff --git a/backend/src/modules/iit-manager/test-patient-wechat-url-verify.ts b/backend/src/modules/iit-manager/test-patient-wechat-url-verify.ts index 78b7cdd6..f066fb23 100644 --- a/backend/src/modules/iit-manager/test-patient-wechat-url-verify.ts +++ b/backend/src/modules/iit-manager/test-patient-wechat-url-verify.ts @@ -178,3 +178,6 @@ async function testUrlVerification() { + + + diff --git a/backend/src/modules/iit-manager/test-redcap-query-from-db.ts b/backend/src/modules/iit-manager/test-redcap-query-from-db.ts index e68b84b8..bfd61ea5 100644 --- a/backend/src/modules/iit-manager/test-redcap-query-from-db.ts +++ b/backend/src/modules/iit-manager/test-redcap-query-from-db.ts @@ -259,3 +259,6 @@ main().catch((error) => { + + + diff --git a/backend/src/modules/iit-manager/test-wechat-mp-local.ps1 b/backend/src/modules/iit-manager/test-wechat-mp-local.ps1 index 563109de..3b884410 100644 --- a/backend/src/modules/iit-manager/test-wechat-mp-local.ps1 +++ b/backend/src/modules/iit-manager/test-wechat-mp-local.ps1 @@ -143,3 +143,6 @@ Write-Host "" + + + diff --git a/backend/src/modules/iit-manager/types/index.ts b/backend/src/modules/iit-manager/types/index.ts index a9e6ae4c..2709e771 100644 --- a/backend/src/modules/iit-manager/types/index.ts +++ b/backend/src/modules/iit-manager/types/index.ts @@ -236,3 +236,6 @@ export interface CachedProtocolRules { + + + diff --git a/backend/src/modules/pkb/controllers/batchController.ts b/backend/src/modules/pkb/controllers/batchController.ts index 9014c527..e1cacfb6 100644 --- a/backend/src/modules/pkb/controllers/batchController.ts +++ b/backend/src/modules/pkb/controllers/batchController.ts @@ -13,6 +13,17 @@ import { executeBatchTask, retryFailedDocuments, BatchProgress } from '../servic import { prisma } from '../../../config/database.js'; import { ModelType } from '../../../common/llm/adapters/types.js'; +/** + * 获取用户ID(从JWT Token中获取) + */ +function getUserId(request: FastifyRequest): string { + const userId = (request as any).user?.userId; + if (!userId) { + throw new Error('User not authenticated'); + } + return userId; +} + // ==================== 类型定义 ==================== interface ExecuteBatchBody { @@ -40,8 +51,7 @@ export async function executeBatch( reply: FastifyReply ) { try { - // TODO: 从JWT获取userId - const userId = 'user-mock-001'; + const userId = getUserId(request); const { kb_id, @@ -365,7 +375,7 @@ export async function retryFailed( ) { try { const { taskId } = request.params; - const userId = 'user-mock-001'; // TODO: 从JWT获取 + const userId = getUserId(request); // 获取WebSocket实例 const io = (request.server as any).io; diff --git a/backend/src/modules/pkb/controllers/documentController.ts b/backend/src/modules/pkb/controllers/documentController.ts index 1e0514d1..085cd3e6 100644 --- a/backend/src/modules/pkb/controllers/documentController.ts +++ b/backend/src/modules/pkb/controllers/documentController.ts @@ -1,8 +1,16 @@ import type { FastifyRequest, FastifyReply } from 'fastify'; import * as documentService from '../services/documentService.js'; -// Mock用户ID(实际应从JWT token中获取) -const MOCK_USER_ID = 'user-mock-001'; +/** + * 获取用户ID(从JWT Token中获取) + */ +function getUserId(request: FastifyRequest): string { + const userId = (request as any).user?.userId; + if (!userId) { + throw new Error('User not authenticated'); + } + return userId; +} /** * 上传文档 @@ -69,8 +77,9 @@ export async function uploadDocument( // 上传文档(这里fileUrl暂时为空,实际应该上传到对象存储) console.log(`⚙️ 调用文档服务上传文件...`); + const userId = getUserId(request); const document = await documentService.uploadDocument( - MOCK_USER_ID, + userId, kbId, file, filename, @@ -123,7 +132,8 @@ export async function getDocuments( try { const { kbId } = request.params; - const documents = await documentService.getDocuments(MOCK_USER_ID, kbId); + const userId = getUserId(request); + const documents = await documentService.getDocuments(userId, kbId); return reply.send({ success: true, @@ -160,7 +170,8 @@ export async function getDocumentById( try { const { id } = request.params; - const document = await documentService.getDocumentById(MOCK_USER_ID, id); + const userId = getUserId(request); + const document = await documentService.getDocumentById(userId, id); return reply.send({ success: true, @@ -197,7 +208,8 @@ export async function deleteDocument( try { const { id } = request.params; - await documentService.deleteDocument(MOCK_USER_ID, id); + const userId = getUserId(request); + await documentService.deleteDocument(userId, id); return reply.send({ success: true, @@ -234,7 +246,8 @@ export async function reprocessDocument( try { const { id } = request.params; - await documentService.reprocessDocument(MOCK_USER_ID, id); + const userId = getUserId(request); + await documentService.reprocessDocument(userId, id); return reply.send({ success: true, @@ -271,7 +284,8 @@ export async function getDocumentFullText( try { const { id } = request.params; - const document = await documentService.getDocumentById(MOCK_USER_ID, id); + const userId = getUserId(request); + const document = await documentService.getDocumentById(userId, id); // 返回完整的文档信息 return reply.send({ diff --git a/backend/src/modules/pkb/controllers/knowledgeBaseController.ts b/backend/src/modules/pkb/controllers/knowledgeBaseController.ts index 46a220aa..da05905e 100644 --- a/backend/src/modules/pkb/controllers/knowledgeBaseController.ts +++ b/backend/src/modules/pkb/controllers/knowledgeBaseController.ts @@ -1,8 +1,16 @@ import type { FastifyRequest, FastifyReply } from 'fastify'; import * as knowledgeBaseService from '../services/knowledgeBaseService.js'; -// Mock用户ID(实际应从JWT token中获取) -const MOCK_USER_ID = 'user-mock-001'; +/** + * 获取用户ID(从JWT Token中获取) + */ +function getUserId(request: FastifyRequest): string { + const userId = (request as any).user?.userId; + if (!userId) { + throw new Error('User not authenticated'); + } + return userId; +} /** * 创建知识库 @@ -26,8 +34,9 @@ export async function createKnowledgeBase( }); } + const userId = getUserId(request); const knowledgeBase = await knowledgeBaseService.createKnowledgeBase( - MOCK_USER_ID, + userId, name, description ); @@ -49,12 +58,13 @@ export async function createKnowledgeBase( * 获取知识库列表 */ export async function getKnowledgeBases( - _request: FastifyRequest, + request: FastifyRequest, reply: FastifyReply ) { try { + const userId = getUserId(request); const knowledgeBases = await knowledgeBaseService.getKnowledgeBases( - MOCK_USER_ID + userId ); return reply.send({ @@ -84,8 +94,9 @@ export async function getKnowledgeBaseById( try { const { id } = request.params; + const userId = getUserId(request); const knowledgeBase = await knowledgeBaseService.getKnowledgeBaseById( - MOCK_USER_ID, + userId, id ); @@ -129,8 +140,9 @@ export async function updateKnowledgeBase( const { id } = request.params; const updateData = request.body; + const userId = getUserId(request); const knowledgeBase = await knowledgeBaseService.updateKnowledgeBase( - MOCK_USER_ID, + userId, id, updateData ); @@ -170,7 +182,8 @@ export async function deleteKnowledgeBase( try { const { id } = request.params; - await knowledgeBaseService.deleteKnowledgeBase(MOCK_USER_ID, id); + const userId = getUserId(request); + await knowledgeBaseService.deleteKnowledgeBase(userId, id); return reply.send({ success: true, @@ -221,8 +234,9 @@ export async function searchKnowledgeBase( const topK = top_k ? parseInt(top_k, 10) : 15; // Phase 1优化:默认从3增加到15 + const userId = getUserId(request); const results = await knowledgeBaseService.searchKnowledgeBase( - MOCK_USER_ID, + userId, id, query, topK @@ -263,8 +277,9 @@ export async function getKnowledgeBaseStats( try { const { id } = request.params; + const userId = getUserId(request); const stats = await knowledgeBaseService.getKnowledgeBaseStats( - MOCK_USER_ID, + userId, id ); @@ -311,8 +326,9 @@ export async function getDocumentSelection( const maxFiles = max_files ? parseInt(max_files, 10) : undefined; const maxTokens = max_tokens ? parseInt(max_tokens, 10) : undefined; + const userId = getUserId(request); const selection = await knowledgeBaseService.getDocumentSelection( - MOCK_USER_ID, + userId, id, maxFiles, maxTokens diff --git a/backend/src/modules/pkb/routes/health.ts b/backend/src/modules/pkb/routes/health.ts index 2febca73..b136dc6c 100644 --- a/backend/src/modules/pkb/routes/health.ts +++ b/backend/src/modules/pkb/routes/health.ts @@ -51,3 +51,4 @@ export default async function healthRoutes(fastify: FastifyInstance) { + diff --git a/backend/src/modules/pkb/services/knowledgeBaseService.ts b/backend/src/modules/pkb/services/knowledgeBaseService.ts index 7f877bf7..cbb75216 100644 --- a/backend/src/modules/pkb/services/knowledgeBaseService.ts +++ b/backend/src/modules/pkb/services/knowledgeBaseService.ts @@ -29,9 +29,14 @@ export async function createKnowledgeBase( } // 2. 在Dify中创建Dataset + // Dify API name字段限制:避免特殊字符,保持简洁 + const sanitizedName = name + .replace(/[^\u4e00-\u9fa5a-zA-Z0-9_-]/g, '_') // 移除特殊字符 + .substring(0, 50); // 限制长度 + const difyDataset = await difyClient.createDataset({ - name: `${userId}_${name}_${Date.now()}`, - description: description || `Knowledge base for user ${userId}`, + name: `kb_${sanitizedName}_${Date.now()}`, // 简化格式 + description: description?.substring(0, 200) || '', // 限制描述长度 indexing_technique: 'high_quality', }); diff --git a/backend/src/modules/rvw/__tests__/api.http b/backend/src/modules/rvw/__tests__/api.http index 4526b2ca..baaf05f9 100644 --- a/backend/src/modules/rvw/__tests__/api.http +++ b/backend/src/modules/rvw/__tests__/api.http @@ -127,3 +127,6 @@ Content-Type: application/json + + + diff --git a/backend/src/modules/rvw/__tests__/test-api.ps1 b/backend/src/modules/rvw/__tests__/test-api.ps1 index 528ee649..d06ecb8d 100644 --- a/backend/src/modules/rvw/__tests__/test-api.ps1 +++ b/backend/src/modules/rvw/__tests__/test-api.ps1 @@ -112,3 +112,6 @@ Write-Host " - 删除任务: DELETE $BaseUrl/api/v2/rvw/tasks/{taskId}" -Foregr + + + diff --git a/backend/src/modules/rvw/controllers/reviewController.ts b/backend/src/modules/rvw/controllers/reviewController.ts index 8c8aeae9..2a961b8b 100644 --- a/backend/src/modules/rvw/controllers/reviewController.ts +++ b/backend/src/modules/rvw/controllers/reviewController.ts @@ -15,16 +15,16 @@ import { ModelType } from '../../../common/llm/adapters/types.js'; import * as reviewService from '../services/reviewService.js'; import { AgentType } from '../types/index.js'; -// TODO: 集成JWT认证后移除 -const MOCK_USER_ID = 'user-mock-001'; - /** - * 获取用户ID(暂时使用Mock,待JWT集成) + * 获取用户ID(从JWT Token中获取) + * 如果未认证则抛出错误 */ function getUserId(request: FastifyRequest): string { - // TODO: 从JWT token中获取 - // return request.user?.id; - return MOCK_USER_ID; + const userId = (request as any).user?.userId; + if (!userId) { + throw new Error('User not authenticated'); + } + return userId; } // ==================== 任务创建 ==================== @@ -121,12 +121,20 @@ export async function createTask( }, }); } catch (error) { - logger.error('[RVW:Controller] 上传失败', { - error: error instanceof Error ? error.message : 'Unknown error' - }); + const errorMessage = error instanceof Error ? error.message : 'Unknown error'; + logger.error('[RVW:Controller] 上传失败', { error: errorMessage }); + + // 区分认证错误和其他错误 + if (errorMessage === 'User not authenticated') { + return reply.status(401).send({ + success: false, + message: '用户未认证,请重新登录', + }); + } + return reply.status(500).send({ success: false, - message: error instanceof Error ? error.message : '上传失败', + message: errorMessage || '上传失败', }); } } diff --git a/backend/src/modules/rvw/index.ts b/backend/src/modules/rvw/index.ts index 410d8eee..2d4e48d8 100644 --- a/backend/src/modules/rvw/index.ts +++ b/backend/src/modules/rvw/index.ts @@ -26,3 +26,6 @@ export * from './services/utils.js'; + + + diff --git a/backend/src/modules/rvw/services/editorialService.ts b/backend/src/modules/rvw/services/editorialService.ts index 5ccbd17c..b93f283b 100644 --- a/backend/src/modules/rvw/services/editorialService.ts +++ b/backend/src/modules/rvw/services/editorialService.ts @@ -1,36 +1,44 @@ /** * RVW稿件审查模块 - 稿约规范性评估服务 * @module rvw/services/editorialService + * + * Phase 3.5.5 改造:使用 PromptService 替代文件读取 + * - 支持灰度预览(调试者看 DRAFT,普通用户看 ACTIVE) + * - 三级容灾(数据库→缓存→兜底) */ -import fs from 'fs/promises'; -import path from 'path'; -import { fileURLToPath } from 'url'; import { LLMFactory } from '../../../common/llm/adapters/LLMFactory.js'; import { ModelType } from '../../../common/llm/adapters/types.js'; import { logger } from '../../../common/logging/index.js'; +import { prisma } from '../../../config/database.js'; +import { getPromptService } from '../../../common/prompt/index.js'; import { EditorialReview } from '../types/index.js'; import { parseJSONFromLLMResponse } from './utils.js'; -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - -// Prompt文件路径 -const PROMPT_PATH = path.join(__dirname, '../../../../prompts/review_editorial_system.txt'); - /** * 稿约规范性评估 * @param text 稿件文本 * @param modelType 模型类型 + * @param userId 用户ID(用于灰度预览判断) * @returns 评估结果 */ export async function reviewEditorialStandards( text: string, - modelType: ModelType = 'deepseek-v3' + modelType: ModelType = 'deepseek-v3', + userId?: string ): Promise { try { - // 1. 读取系统Prompt - const systemPrompt = await fs.readFile(PROMPT_PATH, 'utf-8'); + // 1. 从 PromptService 获取系统Prompt(支持灰度预览) + const promptService = getPromptService(prisma); + const { content: systemPrompt, isDraft } = await promptService.get( + 'RVW_EDITORIAL', + {}, + { userId } + ); + + if (isDraft) { + logger.info('[RVW:Editorial] 使用 DRAFT 版本 Prompt(调试模式)', { userId }); + } // 2. 构建消息 const messages = [ @@ -71,3 +79,4 @@ export async function reviewEditorialStandards( + diff --git a/backend/src/modules/rvw/services/methodologyService.ts b/backend/src/modules/rvw/services/methodologyService.ts index d4ea8297..65d632e8 100644 --- a/backend/src/modules/rvw/services/methodologyService.ts +++ b/backend/src/modules/rvw/services/methodologyService.ts @@ -1,36 +1,44 @@ /** * RVW稿件审查模块 - 方法学评估服务 * @module rvw/services/methodologyService + * + * Phase 3.5.5 改造:使用 PromptService 替代文件读取 + * - 支持灰度预览(调试者看 DRAFT,普通用户看 ACTIVE) + * - 三级容灾(数据库→缓存→兜底) */ -import fs from 'fs/promises'; -import path from 'path'; -import { fileURLToPath } from 'url'; import { LLMFactory } from '../../../common/llm/adapters/LLMFactory.js'; import { ModelType } from '../../../common/llm/adapters/types.js'; import { logger } from '../../../common/logging/index.js'; +import { prisma } from '../../../config/database.js'; +import { getPromptService } from '../../../common/prompt/index.js'; import { MethodologyReview } from '../types/index.js'; import { parseJSONFromLLMResponse } from './utils.js'; -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - -// Prompt文件路径 -const PROMPT_PATH = path.join(__dirname, '../../../../prompts/review_methodology_system.txt'); - /** * 方法学评估 * @param text 稿件文本 * @param modelType 模型类型 + * @param userId 用户ID(用于灰度预览判断) * @returns 评估结果 */ export async function reviewMethodology( text: string, - modelType: ModelType = 'deepseek-v3' + modelType: ModelType = 'deepseek-v3', + userId?: string ): Promise { try { - // 1. 读取系统Prompt - const systemPrompt = await fs.readFile(PROMPT_PATH, 'utf-8'); + // 1. 从 PromptService 获取系统Prompt(支持灰度预览) + const promptService = getPromptService(prisma); + const { content: systemPrompt, isDraft } = await promptService.get( + 'RVW_METHODOLOGY', + {}, + { userId } + ); + + if (isDraft) { + logger.info('[RVW:Methodology] 使用 DRAFT 版本 Prompt(调试模式)', { userId }); + } // 2. 构建消息 const messages = [ @@ -71,3 +79,4 @@ export async function reviewMethodology( + diff --git a/backend/src/modules/rvw/services/utils.ts b/backend/src/modules/rvw/services/utils.ts index ec76f256..45eb9fb1 100644 --- a/backend/src/modules/rvw/services/utils.ts +++ b/backend/src/modules/rvw/services/utils.ts @@ -117,3 +117,6 @@ export function validateAgentSelection(agents: string[]): void { + + + diff --git a/backend/src/modules/rvw/workers/reviewWorker.ts b/backend/src/modules/rvw/workers/reviewWorker.ts index fe21a9c0..1380f5b8 100644 --- a/backend/src/modules/rvw/workers/reviewWorker.ts +++ b/backend/src/modules/rvw/workers/reviewWorker.ts @@ -78,7 +78,8 @@ export function registerReviewWorker() { logger.info('[reviewWorker] Running editorial review', { taskId }); console.log(' 🔍 运行稿约规范性智能体...'); - editorialResult = await reviewEditorialStandards(extractedText, modelType); + // ✅ Phase 3.5.5: 传递 userId 支持灰度预览 + editorialResult = await reviewEditorialStandards(extractedText, modelType, userId); logger.info('[reviewWorker] Editorial review completed', { taskId, @@ -97,7 +98,8 @@ export function registerReviewWorker() { logger.info('[reviewWorker] Running methodology review', { taskId }); console.log(' 🔬 运行方法学智能体...'); - methodologyResult = await reviewMethodology(extractedText, modelType); + // ✅ Phase 3.5.5: 传递 userId 支持灰度预览 + methodologyResult = await reviewMethodology(extractedText, modelType, userId); logger.info('[reviewWorker] Methodology review completed', { taskId, diff --git a/backend/src/tests/README.md b/backend/src/tests/README.md index 0187a55a..b269343f 100644 --- a/backend/src/tests/README.md +++ b/backend/src/tests/README.md @@ -413,6 +413,9 @@ SET session_replication_role = 'origin'; + + + diff --git a/backend/src/tests/verify-test1-database.sql b/backend/src/tests/verify-test1-database.sql index 79e00e66..3f6827ae 100644 --- a/backend/src/tests/verify-test1-database.sql +++ b/backend/src/tests/verify-test1-database.sql @@ -115,6 +115,9 @@ WHERE key = 'verify_test'; + + + diff --git a/backend/src/tests/verify-test1-database.ts b/backend/src/tests/verify-test1-database.ts index ee567e0f..0b9d3a32 100644 --- a/backend/src/tests/verify-test1-database.ts +++ b/backend/src/tests/verify-test1-database.ts @@ -258,6 +258,9 @@ verifyDatabase() + + + diff --git a/backend/src/types/global.d.ts b/backend/src/types/global.d.ts index 3246bcdc..a6f07d20 100644 --- a/backend/src/types/global.d.ts +++ b/backend/src/types/global.d.ts @@ -48,6 +48,9 @@ export {} + + + diff --git a/backend/sync-dc-database.ps1 b/backend/sync-dc-database.ps1 index 21860e7f..4f17a48e 100644 --- a/backend/sync-dc-database.ps1 +++ b/backend/sync-dc-database.ps1 @@ -71,6 +71,9 @@ Write-Host "✅ 完成!" -ForegroundColor Green + + + diff --git a/backend/temp_check.sql b/backend/temp_check.sql index 27fd5db8..601ce2ed 100644 --- a/backend/temp_check.sql +++ b/backend/temp_check.sql @@ -1,2 +1,5 @@ SELECT schema_name FROM information_schema.schemata WHERE schema_name NOT IN ('pg_catalog', 'information_schema', 'pg_toast') ORDER BY schema_name; + + + diff --git a/backend/test-pkb-migration.http b/backend/test-pkb-migration.http index dc0760e2..bba261ae 100644 --- a/backend/test-pkb-migration.http +++ b/backend/test-pkb-migration.http @@ -163,3 +163,6 @@ DELETE {{baseUrl}}/api/v2/pkb/knowledge/knowledge-bases/{{testKbId}} + + + diff --git a/backend/test-tool-c-advanced-scenarios.mjs b/backend/test-tool-c-advanced-scenarios.mjs index 03d69e96..5f22b4ea 100644 --- a/backend/test-tool-c-advanced-scenarios.mjs +++ b/backend/test-tool-c-advanced-scenarios.mjs @@ -358,6 +358,9 @@ runAdvancedTests().catch(error => { + + + diff --git a/backend/test-tool-c-day2.mjs b/backend/test-tool-c-day2.mjs index 9e652c21..1e22cb8e 100644 --- a/backend/test-tool-c-day2.mjs +++ b/backend/test-tool-c-day2.mjs @@ -424,6 +424,9 @@ runAllTests() + + + diff --git a/backend/test-tool-c-day3.mjs b/backend/test-tool-c-day3.mjs index bfc3a367..4f593e81 100644 --- a/backend/test-tool-c-day3.mjs +++ b/backend/test-tool-c-day3.mjs @@ -382,6 +382,9 @@ runAllTests() + + + diff --git a/backend/verify_all_users.ts b/backend/verify_all_users.ts index 8abccfa8..fb56423d 100644 --- a/backend/verify_all_users.ts +++ b/backend/verify_all_users.ts @@ -20,3 +20,6 @@ main() .catch(console.error) .finally(() => prisma.$disconnect()); + + + diff --git a/backend/verify_functions.ts b/backend/verify_functions.ts index 69f810e6..d0b74b5a 100644 --- a/backend/verify_functions.ts +++ b/backend/verify_functions.ts @@ -18,3 +18,6 @@ main() .catch(console.error) .finally(() => prisma.$disconnect()); + + + diff --git a/backend/verify_job_common.ts b/backend/verify_job_common.ts index 75bb3506..374cd4f5 100644 --- a/backend/verify_job_common.ts +++ b/backend/verify_job_common.ts @@ -30,3 +30,6 @@ main() .catch(console.error) .finally(() => prisma.$disconnect()); + + + diff --git a/backend/verify_mock_user.ts b/backend/verify_mock_user.ts index 21bebe04..6e7b616e 100644 --- a/backend/verify_mock_user.ts +++ b/backend/verify_mock_user.ts @@ -19,3 +19,6 @@ main() .catch(console.error) .finally(() => prisma.$disconnect()); + + + diff --git a/backend/verify_system.ts b/backend/verify_system.ts index efb64c40..7c464285 100644 --- a/backend/verify_system.ts +++ b/backend/verify_system.ts @@ -159,3 +159,6 @@ main() .catch(console.error) .finally(() => prisma.$disconnect()); + + + diff --git a/backup_aia_migration_20260111_223208.sql b/backup_aia_migration_20260111_223208.sql new file mode 100644 index 00000000..62469de9 Binary files /dev/null and b/backup_aia_migration_20260111_223208.sql differ diff --git a/deploy-to-sae.ps1 b/deploy-to-sae.ps1 index 046c61e5..bc6984a7 100644 --- a/deploy-to-sae.ps1 +++ b/deploy-to-sae.ps1 @@ -166,6 +166,9 @@ Set-Location .. + + + diff --git a/docs/02-通用能力层/Postgres-Only异步任务处理指南.md b/docs/02-通用能力层/Postgres-Only异步任务处理指南.md index aed26ad9..e02e6554 100644 --- a/docs/02-通用能力层/Postgres-Only异步任务处理指南.md +++ b/docs/02-通用能力层/Postgres-Only异步任务处理指南.md @@ -608,6 +608,9 @@ async saveProcessedData(recordId, newData) { + + + diff --git a/docs/02-通用能力层/通用能力层技术债务清单.md b/docs/02-通用能力层/通用能力层技术债务清单.md index 80ac911e..eb3cf007 100644 --- a/docs/02-通用能力层/通用能力层技术债务清单.md +++ b/docs/02-通用能力层/通用能力层技术债务清单.md @@ -795,6 +795,9 @@ export const AsyncProgressBar: React.FC = ({ + + + diff --git a/docs/03-业务模块/ADMIN-运营管理端/00-Phase3.5完成总结.md b/docs/03-业务模块/ADMIN-运营管理端/00-Phase3.5完成总结.md index 42b50e24..c8faae4a 100644 --- a/docs/03-业务模块/ADMIN-运营管理端/00-Phase3.5完成总结.md +++ b/docs/03-业务模块/ADMIN-运营管理端/00-Phase3.5完成总结.md @@ -294,3 +294,4 @@ Level 3: 兜底Prompt(缓存也失效) + diff --git a/docs/03-业务模块/ADMIN-运营管理端/README.md b/docs/03-业务模块/ADMIN-运营管理端/README.md index 5b1578c2..595b56f3 100644 --- a/docs/03-业务模块/ADMIN-运营管理端/README.md +++ b/docs/03-业务模块/ADMIN-运营管理端/README.md @@ -214,3 +214,4 @@ ADMIN-运营管理端/ + diff --git a/docs/03-业务模块/ADMIN运营与INST机构管理端-文档体系建立完成.md b/docs/03-业务模块/ADMIN运营与INST机构管理端-文档体系建立完成.md index fa6a169f..a15250be 100644 --- a/docs/03-业务模块/ADMIN运营与INST机构管理端-文档体系建立完成.md +++ b/docs/03-业务模块/ADMIN运营与INST机构管理端-文档体系建立完成.md @@ -311,3 +311,6 @@ INST-机构管理端/ *报告完毕 - 2026-01-11* + + + diff --git a/docs/03-业务模块/AIA-AI智能问答/01-需求分析/AIA模块PRD.md b/docs/03-业务模块/AIA-AI智能问答/01-需求分析/AIA模块PRD.md new file mode 100644 index 00000000..aca68fcc --- /dev/null +++ b/docs/03-业务模块/AIA-AI智能问答/01-需求分析/AIA模块PRD.md @@ -0,0 +1,135 @@ +# **壹证循科技 \- AI智能问答 (AIA) V2.1 产品需求文档** + +**文档状态:** Draft (V2.1) + +**关联原型:** AI问答原型图V11.html + +**架构标准:** Postgres-Only | Ant Design X | Schema Isolation + +**最后更新:** 2026-01-11 + +**本次更新:** 新增移动端适配、深度思考模式、UI/UX 细节规范 + +## **1\. 概述与目标** + +### **1.1 背景** + +原 AIA 模块功能较为单一。V2.0+ 版本旨在构建一个**全流程驱动的科研智能体大厅 (Agent Hub)**,对标 ChatGPT/Gemini 的流畅体验,并深度结合医学科研场景。 + +### **1.2 核心价值** + +1. **流程化引导**:打破“只有一个对话框”的迷茫感,通过 5 个阶段引导用户逐步推进研究。 +2. **专业分工**:不同的智能体加载不同的 System Prompt 和知识库。 +3. **全端体验**:提供桌面端到移动端的无缝衔接,随时随地记录科研灵感。 + +## **2\. 核心业务流程 (User Flow)** + +1. **进入大厅 (Dashboard)**: + * 顶部提供“全局意图搜索框”,用户输入模糊需求。 + * 系统识别意图,自动跳转到对应的智能体。 +2. **选择智能体**: + * 用户也可以直接点击具体的卡片(如“06 样本量计算”)。 +3. **沉浸式工作台 (Workspace)**: + * 进入具体的对话界面。 + * **桌面端**:三栏布局(历史记录 \+ 对话区 \+ 如果有右侧引用栏)。 + * **移动端**:单栏布局,历史记录折叠为抽屉。 +4. **结果产出**: + * AI 展示**思考过程 (Thinking Process)** 后输出最终答案。 + * 用户可一键导出 Word 报告。 + +## **3\. 功能需求详情** + +### **F1. 智能体大厅 (Dashboard) \- 基于 V11 原型** + +#### **F1.1 全局意图路由 (Intent Router)** + +* **UI**:顶部大搜索框,文案“输入研究想法...”。 +* **逻辑**:后端调用 Router Agent 识别意图 \-\> 跳转目标 Agent \-\> 自动填入 Prompt。 + +#### **F1.2 智能体流水线展示 (Agent Pipeline)** + +严格还原 V11 原型的 **5 阶段布局** 和 **3 色视觉体系**(详见原型图)。 + +* **跳转逻辑**: + * **常规卡片**:进入 Chat Workspace。 + * **工具卡片 (09, 10\)**:跳转 /dc/portal 或 /st/dashboard。 + +### **F2. 沉浸式对话工作台 (Chat Workspace)** + +#### **F2.1 界面布局与风格 (UI/UX)** + +* **设计理念**:参考 Gemini 的“大留白”风格,减少分割线,使用卡片投影区分层级。 +* **左侧侧边栏 (Sidebar)**: + * **桌面端**:固定显示,可折叠(图标化)。 + * **移动端**:默认隐藏,通过左上角“汉堡菜单”滑出(Drawer 组件)。 + * **内容**:按时间分组的历史会话(今天、昨天、7天前)。 +* **主对话区 (Main Area)**: + * **Header**:显示当前智能体名称 \+ 状态("思考中..." / "输入中...")。 + * **Input**:底部悬浮,支持多行自动增高。 + +#### **F2.2 核心对话能力增强** + +* **深度思考模式 (Thinking Process)**: + * **需求**:针对“科学问题梳理”等复杂任务,AI 需先输出推理过程。 + * **交互**:输出 \...\ 内容时,前端显示为**可折叠的灰色引用块**,默认展开,生成结束后自动收起,只显示“已深度思考 (耗时 12s)”。 +* **Markdown 渲染增强**: + * **公式**:使用 Katex 渲染 LaTeX 医学公式。 + * **表格**:支持横向滚动,防止手机端撑破布局。 + * **代码**:支持一键复制,语法高亮。 +* **快捷指令 (Slash Commands)**: + * 输入 / 弹出快捷菜单:/润色, /扩写, /翻译, /导出Word。 + +#### **F2.3 附件上传 (Attachment)** + +* **格式**:PDF, Word, TXT, Excel (限制 20MB)。 +* **处理 (Postgres-Only)**: + 1. 上传 OSS \-\> common\_schema.files。 + 2. 后端提取文本 \-\> 截取注入 LLM Context。 + 3. **UI 显示**:在气泡下方显示附件小卡片(图标+文件名)。 + +#### **F2.4 结果操作栏 (Action Bar)** + +每条 AI 回答下方提供微型工具栏(Hover 显示): + +* **复制**:复制 Markdown 源码。 +* **重新生成**:不满意当前回答,触发重试。 +* **导出 Word**:调用 RVW 模块的 docx 导出服务,将当前单轮对话导出为文档。 + +### **F3. 移动端适配 (Mobile Adaptation)** + +#### **F3.1 响应式布局** + +* **断点**:md (768px)。 +* **Dashboard**: + * 隐藏顶部复杂导航,只保留 Logo 和 用户头像。 + * 智能体卡片由 3 列变为 1 列流式布局。 + * 左侧时间轴(Timeline)在移动端需调整样式,避免占用过多水平空间(可改为顶部横向步骤条或简化左侧线条)。 + +#### **F3.2 交互优化** + +* **输入体验**: + * 输入框聚焦时,确保不被 iOS/Android 软键盘遮挡(scrollIntoView)。 + * 发送按钮在移动端需始终可见。 +* **触控反馈**:按钮和卡片增加 active 态背景色变化。 + +## **4\. 数据架构 (Postgres-Only)** + +*(保持不变,复用 V2.0 定义)* + +// schema.prisma (新增字段) + +model AiaMessage { + // ... 现有字段 + thinkingContent String? @db.Text // 存储思维链内容 (\...\) + // ... +} + +## **5\. 配置化开发策略** + +*(保持不变)* + +## **6\. 非功能性需求** + +* **流式体验**:TTFB (首字响应时间) \< 1.5s。 +* **移动端性能**:首屏加载 \< 1s (LCP)。 +* **防抖**:意图搜索框需增加 500ms 防抖,避免频繁请求 Router Agent。 \ No newline at end of file diff --git a/docs/03-业务模块/AIA-AI智能问答/01-需求分析/AI智能问答V2.html b/docs/03-业务模块/AIA-AI智能问答/01-需求分析/AI智能问答V2.html new file mode 100644 index 00000000..bc570ecd --- /dev/null +++ b/docs/03-业务模块/AIA-AI智能问答/01-需求分析/AI智能问答V2.html @@ -0,0 +1,665 @@ + + + + + + AI智能问答 V3.0 - 完整版 + + + + + + + + + +
+ + +
+ + + + +
+
+ 已接入 DeepSeek-V3 +
+

想研究什么?

+
+
+ +
+ + +
+
+ + +
+ + +
+
+

Phase 1: 选题优化

+
+ +
+ 01 +
+ +
+

科学问题梳理

+

从科学问题的清晰度、系统性、可验证性等角度使用科学理论对您的科学问题进行全面的评价。

+
+ +
+ 02 +
+ +
+

PICO 梳理

+

基于科学问题梳理研究对象、干预(暴露)、对照和结局指标,并评价并给出合理化的建议。

+
+ +
+ 03 +
+ +
+

选题评价

+

从创新性、临床价值、科学性和可行性等方面使用科学理论对您的临床问题进行全面的评价。

+
+
+
+ + +
+
+

Phase 2: 方案设计

+
+ +
+ 04 +
+ +
+

观察指标设计

+

基于研究设计和因果关系提供可能的观察指标集。

+
+ +
+ 05 +
+ +
+

病例报告表设计

+

基于研究方案设计梳理观察指标集并给出建议的病例报告表框架。

+
+ +
+ 06 +
+ +
+

样本量计算

+

基于研究阶段和研究设计为研究提供科学合理的样本量估算结果。

+
+ +
+ 07 +
+ +
+

方案撰写 (Pro)

+

基于科学问题、PICOS等信息,给出一个初步的临床研究设计方案。

+
+
+
+ + +
+
+

Phase 3: 方案预评审

+
+ +
+ 08 +
+ +
+

方法学评审

+

从研究问题、研究方案和临床意义方面,对研究进行临床研究方法学的全面评价。

+
+
+
+ + +
+
+

Phase 4: 数据与统计 (工具)

+
+ +
+ + 09 +
+ +
+

数据评价与预处理

+

对现有数据的质量进行自动评价,并给出数据质量报告,包括缺失值、异常值、定量分析等。

+
+ + +
+ + 10 +
+ +
+

智能统计分析

+

内置3条智能研究路径(队列研究、预测模型、RCT研究),以及近百种统计分析工具。

+
+
+
+ + +
+
+

Phase 5: 写作助手

+
+ +
+ 11 +
+ +
+

论文润色

+

结合目标杂志,提供专业化的润色服务,给出合理化的修改建议。

+
+ +
+ 12 +
+ +
+

论文翻译

+

结合目标杂志,提供专业化的翻译并进行润色,给出合理化的修改建议。

+
+
+
+ +
+
+ + + + +
+ + + + + \ No newline at end of file diff --git a/docs/03-业务模块/AIA-AI智能问答/01-需求分析/AI问答原型图V11.html b/docs/03-业务模块/AIA-AI智能问答/01-需求分析/AI问答原型图V11.html new file mode 100644 index 00000000..b940890e --- /dev/null +++ b/docs/03-业务模块/AIA-AI智能问答/01-需求分析/AI问答原型图V11.html @@ -0,0 +1,514 @@ + + + + + + 临床研究平台 - AI医学科研助手 V11 + + + + + + + + + + +
+ + +
+
+
+ +
+

+ 医学研究专属大模型 已接入DeepSeek +

+
+ +
+ + +
+
+ + +
+ + +
+
+
1
+
+
+ +

+ 选题优化智能体 +

+ +
+ +
+
+
+
+ +
+

科学问题梳理

+
+ 01 +
+

+ 从科学问题的清晰度、系统性、可验证性等角度使用科学理论对您的科学问题进行全面的评价。 +

+
+ + +
+
+
+
+ +
+

PICO 梳理

+
+ 02 +
+

+ 基于科学问题梳理研究对象、干预(暴露)、对照和结局指标,并评价并给出合理化的建议。 +

+
+ + +
+
+
+
+ +
+

选题评价

+
+ 03 +
+

+ 从创新性、临床价值、科学性和可行性等方面使用科学理论对您的临床问题进行全面的评价。 +

+
+
+
+ + +
+
+
2
+
+
+ +

+ 方案设计智能体 +

+ +
+ + +
+
+
+
+ +
+

观察指标设计

+
+ 04 +
+

+ 基于研究设计和因果关系提供可能的观察指标集。 +

+
+ + +
+
+
+
+ +
+

病例报告表设计

+
+ 05 +
+

+ 基于研究方案设计梳理观察指标集并给出建议的病例报告表框架。 +

+
+ + +
+
+
+
+ +
+

样本量计算

+
+ 06 +
+

+ 基于研究阶段和研究设计为研究提供科学合理的样本量估算结果。 +

+
+ + +
+
+
+
+ +
+

临床研究方案撰写

+
+ 07 +
+

+ 基于科学问题、PICOS等信息,给出一个初步的临床研究设计方案,请尽量多给一些信息和需求。 +

+
+
+
+ + +
+
+
3
+
+
+ +

+ 方案预评审 +

+ +
+ +
+
+
+
+ +
+

方法学评审智能体

+
+ 08 +
+

+ 从研究问题、研究方案和临床意义方面,对研究进行临床研究方法学的全面评价。 +

+
+
+
+ + +
+
+ +
4
+
+
+ +
+

+ 数据处理与统计分析 +

+ + 工具 +
+ +
+ +
+ + + +
+
+
+ +
+

数据评价与预处理

+
+ 09 +
+

+ 对现有数据的质量进行自动评价,并给出数据质量报告,包括缺失值、异常值、定量分析等。 +

+
+ + +
+ + +
+
+
+ +
+

智能统计分析

+
+ 10 +
+

+ 内置3条智能研究路径(队列研究、预测模型、RCT研究),以及近百种统计分析工具。 +

+
+
+
+ + +
+
+
5
+
+ +

+ 写作助手 +

+ +
+ +
+
+
+
+ +
+

论文润色

+
+ 11 +
+

+ 结合目标杂志,提供专业化的润色服务,给出合理化的修改建议。 +

+
+ + +
+
+
+
+ +
+

论文翻译

+
+ 12 +
+

+ 结合目标杂志,提供专业化的翻译并进行润色,给出合理化的修改建议。 +

+
+
+
+
+
+ +
+

© 2025 临床研究平台 - 医学研究专属大模型

+
+ + + + \ No newline at end of file diff --git a/docs/03-业务模块/AIA-AI智能问答/04-开发计划/01-AIA-V2.1开发计划.md b/docs/03-业务模块/AIA-AI智能问答/04-开发计划/01-AIA-V2.1开发计划.md new file mode 100644 index 00000000..ccbb5829 --- /dev/null +++ b/docs/03-业务模块/AIA-AI智能问答/04-开发计划/01-AIA-V2.1开发计划.md @@ -0,0 +1,540 @@ +# AIA 模块 V2.1 开发计划 + +> **版本**:V2.1 +> **创建日期**:2026-01-11 +> **计划周期**:约 8-11 天 +> **策略**:重写后端 + 复用数据库 + 新开发前端 +> **关联PRD**:`01-需求分析/AIA模块PRD.md` +> **关联原型**:`01-需求分析/AI智能问答V2.html` + +--- + +## 📋 开发策略概述 + +### 核心决策 + +| 组件 | 策略 | 理由 | +|------|------|------| +| **后端** | 🔴 **重写** | 旧版不符合云原生规范(console.log、未使用平台能力) | +| **数据库** | ✅ **复用** | aia_schema 已完善,字段满足需求 | +| **前端** | 🔴 **新开发** | 复用 shared/components/Chat 通用组件,全新UI | + +### 技术规范 + +| 规范 | 要求 | +|------|------| +| **日志** | 使用 `logger` from `@/common/logging`(禁止 console.log) | +| **存储** | 使用 `storage` from `@/common/storage` | +| **缓存** | 使用 `cache` from `@/common/cache` | +| **队列** | 使用 `jobQueue` from `@/common/jobs` | +| **Prompt** | 使用 `promptService.get()` from `@/common/prompts` | +| **代码位置** | `backend/src/modules/aia/` | +| **API路由** | `/api/v2/aia/*` | + +--- + +## 📊 数据库状态(✅ 已完成) + +### 表结构(3个表) + +``` +aia_schema.projects ✅ 保留 +aia_schema.conversations ✅ 保留 +aia_schema.messages ✅ 保留 + 新增字段 +``` + +### 新增字段(2026-01-11 已迁移) + +| 表 | 字段 | 类型 | 说明 | +|----|------|------|------| +| messages | `thinking_content` | TEXT | 深度思考内容 `...` | +| messages | `attachments` | JSONB | 附件数组(上限5个,单个≤20MB,文本≤30K tokens) | + +### 已删除表 + +| 表 | 原因 | +|----|------| +| `general_conversations` | 功能重叠,使用 conversations.project_id = NULL | +| `general_messages` | 功能重叠 | + +--- + +## 🗓️ 开发阶段 + +### Phase 1: 后端重写(3-4天) + +#### Day 1: 模块骨架 + 核心服务 + +**目标**:搭建模块结构,迁移核心对话服务 + +**任务清单**: + +- [ ] **1.1 创建模块目录结构** + ``` + backend/src/modules/aia/ + ├── controllers/ + │ ├── conversationController.ts + │ ├── agentController.ts + │ └── projectController.ts + ├── services/ + │ ├── conversationService.ts + │ ├── agentService.ts + │ └── projectService.ts + ├── routes/ + │ └── index.ts + ├── types/ + │ └── index.ts + └── index.ts + ``` + +- [ ] **1.2 重写 conversationService** + - 从 legacy 复制核心逻辑 + - 替换 `console.log` → `logger` + - 使用 `prisma.message`(已在 aia_schema) + - 添加 `thinkingContent` 处理逻辑 + - 保持流式输出能力 + +- [ ] **1.3 重写 agentService** + - 改用 `promptService.get()` 获取 Prompt + - 缓存智能体配置(使用 `cache`) + +- [ ] **1.4 注册 v2 路由** + - 注册到 `/api/v2/aia/*` + - 保持 legacy 路由兼容(逐步迁移) + +**验收标准**: +- [ ] 基础对话功能可用 +- [ ] 流式输出正常 +- [ ] 日志输出到 logger + +--- + +#### Day 2: 深度思考 + 附件上传 + +**目标**:实现 V2.1 新增功能 + +**任务清单**: + +- [ ] **2.1 深度思考模式** + - 检测 LLM 输出中的 `...` 标签 + - 提取并存储到 `messages.thinking_content` + - 从 `content` 中移除 think 标签 + - 流式输出时分离 thinking 和 content + +- [ ] **2.2 附件上传服务** + - 使用 `storage.upload()` 上传到 OSS + - 调用 Python 微服务提取文本 + - Token 计数(使用 tiktoken) + - 截断处理(超过 30K tokens) + - 存储附件信息到 `messages.attachments` + +- [ ] **2.3 附件注入 LLM 上下文** + - 组装附件文本到 User Prompt + - 控制总 Token 长度 + +**技术规格**: + +```typescript +// 附件处理配置 +const ATTACHMENT_CONFIG = { + maxCount: 5, // 每条消息最多5个附件 + maxSizePerFile: 20 * 1024 * 1024, // 单个文件20MB + maxTokens: 30000, // 提取文本最多30K tokens + supportedTypes: ['pdf', 'docx', 'txt', 'xlsx'], +}; +``` + +**验收标准**: +- [ ] 深度思考内容正确分离存储 +- [ ] 附件上传成功 +- [ ] 附件文本正确注入 LLM + +--- + +#### Day 3: 意图路由 + 知识库集成 + +**目标**:实现全局意图路由,完善知识库引用 + +**任务清单**: + +- [ ] **3.1 意图路由服务** + - 新建 `intentRouterService.ts` + - 调用 Router Agent 识别意图 + - 返回目标 Agent ID + 预填 Prompt + - 添加 500ms 防抖(前端实现) + +- [ ] **3.2 完善知识库集成** + - 复用 PKB 模块的 RAG 检索 + - 智能引用系统([来源N]) + - 引用清单格式化 + +- [ ] **3.3 API 端点完善** + ``` + POST /api/v2/aia/intent/route # 意图路由 + POST /api/v2/aia/conversations # 创建对话 + GET /api/v2/aia/conversations # 对话列表 + GET /api/v2/aia/conversations/:id # 对话详情 + POST /api/v2/aia/conversations/:id/messages/stream # 发送消息(流式) + POST /api/v2/aia/conversations/:id/attachments # 上传附件 + GET /api/v2/aia/agents # 智能体列表 + GET /api/v2/aia/agents/:id # 智能体详情 + ``` + +**验收标准**: +- [ ] 意图路由正确识别并跳转 +- [ ] 知识库引用正确显示 +- [ ] 所有 API 端点可用 + +--- + +#### Day 4: 测试 + 文档 + +**目标**:完成后端测试和文档 + +**任务清单**: + +- [ ] **4.1 单元测试** + - conversationService 测试 + - 深度思考解析测试 + - 附件处理测试 + +- [ ] **4.2 集成测试** + - 完整对话流程 + - 附件上传流程 + - 知识库检索流程 + +- [ ] **4.3 API 文档** + - 更新 REST Client 测试文件 + - 编写 API 使用示例 + +**验收标准**: +- [ ] 测试覆盖核心功能 +- [ ] API 文档完整 + +--- + +### Phase 2: 前端开发(5-7天) + +#### Day 5-6: 智能体大厅(Dashboard) + +**目标**:实现首页智能体大厅 + +**任务清单**: + +- [ ] **5.1 创建模块目录结构** + ``` + frontend-v2/src/modules/aia/ + ├── pages/ + │ ├── Dashboard.tsx # 智能体大厅 + │ └── Workspace.tsx # 对话工作台 + ├── components/ + │ ├── AgentPipeline.tsx # 5阶段流水线 + │ ├── AgentCard.tsx # 智能体卡片 + │ ├── IntentSearch.tsx # 意图搜索框 + │ ├── ConversationList.tsx # 历史会话列表 + │ ├── ThinkingBlock.tsx # 深度思考折叠块 + │ ├── AttachmentUpload.tsx # 附件上传 + │ ├── AttachmentCard.tsx # 附件卡片 + │ └── SlashCommands.tsx # 快捷指令 + ├── hooks/ + │ ├── useConversation.ts + │ ├── useAgents.ts + │ └── useIntentRouter.ts + ├── api/ + │ └── index.ts + ├── types/ + │ └── index.ts + └── index.tsx + ``` + +- [ ] **5.2 智能体流水线(AgentPipeline)** + - 5阶段布局(严格还原 V11 原型) + - 3色视觉体系 + - 卡片点击跳转 Workspace + - 工具卡片跳转外部模块(DC/ST) + +- [ ] **5.3 意图搜索框(IntentSearch)** + - 顶部大搜索框 + - 500ms 防抖 + - 调用意图路由 API + - 自动跳转目标 Agent + +**验收标准**: +- [ ] 5阶段流水线正确展示 +- [ ] 意图搜索功能可用 +- [ ] 与原型图一致 + +--- + +#### Day 7-8: 对话工作台(Workspace) + +**目标**:实现沉浸式对话界面 + +**任务清单**: + +- [ ] **7.1 工作台布局** + - Gemini 风格(大留白、少分割线) + - 左侧侧边栏(历史会话,可折叠) + - 主对话区(Header + 消息列表 + 输入框) + +- [ ] **7.2 复用 Chat 通用组件** + ```tsx + import { ChatContainer } from '@/shared/components/Chat'; + + + ``` + +- [ ] **7.3 深度思考折叠块(ThinkingBlock)** + - 可折叠灰色引用块 + - 生成中展开,完成后自动收起 + - 显示"已深度思考 (耗时 Xs)" + +- [ ] **7.4 附件上传组件** + - 支持拖拽上传 + - 文件类型/大小校验 + - 上传进度显示 + - 消息气泡下方附件卡片 + +- [ ] **7.5 历史会话列表** + - 按时间分组(今天、昨天、7天前) + - 桌面端固定显示 + - 移动端抽屉滑出 + +**验收标准**: +- [ ] Gemini 风格 UI +- [ ] 深度思考正确展示 +- [ ] 附件上传完整流程 +- [ ] 历史会话切换 + +--- + +#### Day 9: Markdown 增强 + 快捷指令 + +**目标**:增强对话体验 + +**任务清单**: + +- [ ] **9.1 Markdown 渲染增强** + - KaTeX 公式渲染(医学公式) + - 表格横向滚动 + - 代码块语法高亮 + 一键复制 + +- [ ] **9.2 快捷指令(SlashCommands)** + - 输入 `/` 弹出菜单 + - 支持:/润色, /扩写, /翻译, /导出Word + - 键盘导航 + +- [ ] **9.3 结果操作栏** + - Hover 显示工具栏 + - 复制(Markdown 源码) + - 重新生成 + - 导出 Word(调用 RVW 导出服务) + +**验收标准**: +- [ ] 公式正确渲染 +- [ ] 快捷指令可用 +- [ ] 操作栏功能完整 + +--- + +#### Day 10: 移动端适配 + +**目标**:响应式布局适配 + +**任务清单**: + +- [ ] **10.1 Dashboard 移动端** + - 隐藏复杂导航 + - 卡片单列流式布局 + - 时间轴样式调整 + +- [ ] **10.2 Workspace 移动端** + - 侧边栏改为抽屉 + - 输入框键盘适配(scrollIntoView) + - 发送按钮始终可见 + +- [ ] **10.3 触控优化** + - 按钮 active 态 + - 触控区域优化 + +**验收标准**: +- [ ] md (768px) 断点响应正确 +- [ ] 移动端交互流畅 + +--- + +#### Day 11: 集成测试 + 优化 + +**目标**:完成整体测试和优化 + +**任务清单**: + +- [ ] **11.1 端到端测试** + - 完整对话流程 + - 附件上传流程 + - 深度思考流程 + - 知识库引用流程 + +- [ ] **11.2 性能优化** + - TTFB < 1.5s + - 移动端 LCP < 1s + - 意图搜索防抖 + +- [ ] **11.3 Bug 修复** + +- [ ] **11.4 文档更新** + - 更新模块状态文档 + - 更新系统当前状态 + +**验收标准**: +- [ ] 所有功能正常 +- [ ] 性能达标 +- [ ] 文档完整 + +--- + +## 📁 文件清单 + +### 后端新增文件 + +``` +backend/src/modules/aia/ +├── controllers/ +│ ├── conversationController.ts # ~300行 +│ ├── agentController.ts # ~150行 +│ └── projectController.ts # ~200行 +├── services/ +│ ├── conversationService.ts # ~500行(核心) +│ ├── agentService.ts # ~200行 +│ ├── projectService.ts # ~150行 +│ ├── intentRouterService.ts # ~100行(新) +│ └── attachmentService.ts # ~200行(新) +├── routes/ +│ └── index.ts # ~100行 +├── types/ +│ └── index.ts # ~100行 +└── index.ts # ~20行 + +预计总计:~2000行 +``` + +### 前端新增文件 + +``` +frontend-v2/src/modules/aia/ +├── pages/ +│ ├── Dashboard.tsx # ~400行 +│ └── Workspace.tsx # ~500行 +├── components/ +│ ├── AgentPipeline.tsx # ~300行 +│ ├── AgentCard.tsx # ~100行 +│ ├── IntentSearch.tsx # ~150行 +│ ├── ConversationList.tsx # ~200行 +│ ├── ThinkingBlock.tsx # ~100行 +│ ├── AttachmentUpload.tsx # ~200行 +│ ├── AttachmentCard.tsx # ~80行 +│ └── SlashCommands.tsx # ~150行 +├── hooks/ +│ ├── useConversation.ts # ~150行 +│ ├── useAgents.ts # ~100行 +│ └── useIntentRouter.ts # ~80行 +├── api/ +│ └── index.ts # ~200行 +├── types/ +│ └── index.ts # ~100行 +└── index.tsx # ~50行 + +预计总计:~2900行 +``` + +--- + +## 🔗 依赖关系 + +### 后端依赖 + +| 依赖 | 来源 | 说明 | +|------|------|------| +| `logger` | `@/common/logging` | 日志服务 | +| `storage` | `@/common/storage` | OSS存储 | +| `cache` | `@/common/cache` | Redis/PG缓存 | +| `jobQueue` | `@/common/jobs` | 异步任务 | +| `promptService` | `@/common/prompts` | Prompt管理 | +| `LLMFactory` | `@/common/llm` | LLM适配器 | +| `prisma` | `@/config/database` | 数据库 | +| `ExtractionClient` | `@/clients` | 文档提取 | +| `TokenService` | `@/services` | Token计数 | + +### 前端依赖 + +| 依赖 | 来源 | 说明 | +|------|------|------| +| `ChatContainer` | `@/shared/components/Chat` | 通用对话组件 | +| `Ant Design` | `antd` | UI组件库 | +| `Ant Design X` | `@ant-design/x` | AI对话组件 | +| `KaTeX` | `katex` | 公式渲染 | +| `react-markdown` | `react-markdown` | Markdown渲染 | + +--- + +## 📈 风险评估 + +| 风险 | 概率 | 影响 | 缓解措施 | +|------|------|------|---------| +| 流式输出兼容性 | 中 | 高 | 复用已验证的 SSE 代码 | +| 附件提取超时 | 中 | 中 | 使用 jobQueue 异步处理 | +| 移动端适配问题 | 低 | 中 | 提前规划断点和布局 | +| Prompt管理服务未就绪 | 低 | 中 | 可临时回退到文件读取 | + +--- + +## ✅ 验收标准 + +### 功能验收 + +- [ ] 智能体大厅完整展示 +- [ ] 意图搜索正确路由 +- [ ] 多轮对话正常 +- [ ] 流式输出流畅 +- [ ] 深度思考正确折叠 +- [ ] 附件上传完整 +- [ ] 知识库引用正确 +- [ ] 快捷指令可用 +- [ ] 移动端适配正常 + +### 性能验收 + +- [ ] TTFB < 1.5s +- [ ] 移动端 LCP < 1s +- [ ] 意图搜索响应 < 500ms + +### 质量验收 + +- [ ] 无 console.log(使用 logger) +- [ ] 代码符合云原生规范 +- [ ] API 文档完整 +- [ ] 单元测试覆盖核心功能 + +--- + +## 📝 更新日志 + +| 日期 | 版本 | 内容 | +|------|------|------| +| 2026-01-11 | V1.0 | 创建开发计划 | + +--- + +**计划制定人**:AI Assistant +**审核人**:待定 +**批准人**:待定 + + + + diff --git a/docs/03-业务模块/AIA-AI智能问答/04-开发计划/02-后端API设计.md b/docs/03-业务模块/AIA-AI智能问答/04-开发计划/02-后端API设计.md new file mode 100644 index 00000000..680f6181 --- /dev/null +++ b/docs/03-业务模块/AIA-AI智能问答/04-开发计划/02-后端API设计.md @@ -0,0 +1,568 @@ +# AIA V2.1 后端 API 设计 + +> **版本**:V2.1 +> **创建日期**:2026-01-11 +> **基础路径**:`/api/v2/aia` + +--- + +## 📋 API 概览 + +| 方法 | 路径 | 描述 | 认证 | +|------|------|------|------| +| GET | `/agents` | 获取智能体列表 | ✅ | +| GET | `/agents/:id` | 获取智能体详情 | ✅ | +| POST | `/intent/route` | 意图路由 | ✅ | +| GET | `/conversations` | 获取对话列表 | ✅ | +| POST | `/conversations` | 创建对话 | ✅ | +| GET | `/conversations/:id` | 获取对话详情 | ✅ | +| DELETE | `/conversations/:id` | 删除对话 | ✅ | +| POST | `/conversations/:id/messages/stream` | 发送消息(流式) | ✅ | +| POST | `/conversations/:id/attachments` | 上传附件 | ✅ | +| GET | `/projects` | 获取项目列表 | ✅ | +| GET | `/projects/:id` | 获取项目详情 | ✅ | + +--- + +## 🔐 认证 + +所有 API 需要在请求头中携带 JWT Token: + +``` +Authorization: Bearer +``` + +--- + +## 📖 API 详细定义 + +### 1. 智能体相关 + +#### 1.1 获取智能体列表 + +```http +GET /api/v2/aia/agents +``` + +**查询参数**: + +| 参数 | 类型 | 必填 | 描述 | +|------|------|------|------| +| stage | string | 否 | 筛选阶段:`design`, `data`, `analysis`, `write`, `publish` | + +**响应**: + +```json +{ + "code": 0, + "data": { + "agents": [ + { + "id": "research-design", + "name": "科研设计小助手", + "description": "帮助您完成研究方案设计、文献检索、方法学指导", + "icon": "🔬", + "stage": "design", + "color": "#3B82F6", + "knowledgeBaseId": "kb-001", + "isTool": false + }, + { + "id": "dc-tool", + "name": "数据采集工具", + "description": "跳转到数据采集模块", + "icon": "📊", + "stage": "data", + "color": "#8B5CF6", + "targetModule": "/data-collection", + "isTool": true + } + ] + } +} +``` + +#### 1.2 获取智能体详情 + +```http +GET /api/v2/aia/agents/:id +``` + +**响应**: + +```json +{ + "code": 0, + "data": { + "id": "research-design", + "name": "科研设计小助手", + "description": "帮助您完成研究方案设计、文献检索、方法学指导", + "icon": "🔬", + "stage": "design", + "color": "#3B82F6", + "knowledgeBaseId": "kb-001", + "systemPrompt": "你是一个专业的医学科研设计专家...", + "welcomeMessage": "您好!我是科研设计小助手,我可以帮您:\n- 设计研究方案\n- 检索相关文献\n- 指导研究方法", + "suggestedQuestions": [ + "如何设计一个RCT研究?", + "帮我检索近5年糖尿病研究文献", + "什么情况下使用倾向性评分匹配?" + ] + } +} +``` + +--- + +### 2. 意图路由 + +#### 2.1 智能意图识别 + +```http +POST /api/v2/aia/intent/route +``` + +**请求体**: + +```json +{ + "query": "帮我分析一下这份数据" +} +``` + +**响应**: + +```json +{ + "code": 0, + "data": { + "agentId": "data-analysis", + "agentName": "统计分析小助手", + "confidence": 0.92, + "prefillPrompt": "请帮我分析这份数据,包括描述性统计和相关性分析" + } +} +``` + +--- + +### 3. 对话管理 + +#### 3.1 获取对话列表 + +```http +GET /api/v2/aia/conversations +``` + +**查询参数**: + +| 参数 | 类型 | 必填 | 描述 | +|------|------|------|------| +| agentId | string | 否 | 按智能体筛选 | +| projectId | string | 否 | 按项目筛选(NULL 表示通用对话) | +| page | number | 否 | 页码,默认 1 | +| pageSize | number | 否 | 每页数量,默认 20 | + +**响应**: + +```json +{ + "code": 0, + "data": { + "conversations": [ + { + "id": "conv-001", + "title": "RCT研究设计咨询", + "agentId": "research-design", + "agentName": "科研设计小助手", + "projectId": null, + "messageCount": 12, + "lastMessage": "好的,我来帮您设计研究方案...", + "createdAt": "2026-01-11T10:00:00Z", + "updatedAt": "2026-01-11T12:30:00Z" + } + ], + "pagination": { + "total": 25, + "page": 1, + "pageSize": 20, + "totalPages": 2 + } + } +} +``` + +#### 3.2 创建对话 + +```http +POST /api/v2/aia/conversations +``` + +**请求体**: + +```json +{ + "agentId": "research-design", + "projectId": null, + "title": "新对话" +} +``` + +**响应**: + +```json +{ + "code": 0, + "data": { + "id": "conv-002", + "title": "新对话", + "agentId": "research-design", + "projectId": null, + "createdAt": "2026-01-11T14:00:00Z" + } +} +``` + +#### 3.3 获取对话详情(含历史消息) + +```http +GET /api/v2/aia/conversations/:id +``` + +**查询参数**: + +| 参数 | 类型 | 必填 | 描述 | +|------|------|------|------| +| limit | number | 否 | 获取最近N条消息,默认 50 | + +**响应**: + +```json +{ + "code": 0, + "data": { + "id": "conv-001", + "title": "RCT研究设计咨询", + "agentId": "research-design", + "agentName": "科研设计小助手", + "projectId": null, + "createdAt": "2026-01-11T10:00:00Z", + "updatedAt": "2026-01-11T12:30:00Z", + "messages": [ + { + "id": "msg-001", + "role": "user", + "content": "帮我设计一个关于糖尿病的RCT研究", + "attachments": [], + "createdAt": "2026-01-11T10:00:00Z" + }, + { + "id": "msg-002", + "role": "assistant", + "content": "好的,我来帮您设计一个糖尿病RCT研究方案...", + "thinkingContent": "用户想设计RCT研究,需要考虑:1)研究目的 2)入排标准 3)样本量 4)随机化方法 5)盲法 6)结局指标...", + "model": "deepseek-v3", + "tokens": 1250, + "createdAt": "2026-01-11T10:00:30Z" + } + ] + } +} +``` + +#### 3.4 删除对话 + +```http +DELETE /api/v2/aia/conversations/:id +``` + +**响应**: + +```json +{ + "code": 0, + "data": { + "deleted": true + } +} +``` + +--- + +### 4. 消息发送(流式) + +#### 4.1 发送消息并获取流式响应 + +```http +POST /api/v2/aia/conversations/:id/messages/stream +``` + +**请求头**: + +``` +Content-Type: application/json +Accept: text/event-stream +``` + +**请求体**: + +```json +{ + "content": "帮我分析这份数据", + "attachmentIds": ["att-001", "att-002"], + "enableDeepThinking": true +} +``` + +**响应(SSE 格式)**: + +``` +event: thinking_start +data: {} + +event: thinking_delta +data: {"content": "用户上传了数据文件,需要"} + +event: thinking_delta +data: {"content": "进行描述性统计分析..."} + +event: thinking_end +data: {"duration": 3200} + +event: message_start +data: {"id": "msg-003"} + +event: delta +data: {"content": "根据您上传的数据,"} + +event: delta +data: {"content": "我来为您进行分析..."} + +event: message_end +data: {"id": "msg-003", "tokens": 850, "model": "deepseek-v3"} + +event: done +data: {} +``` + +**SSE 事件类型**: + +| 事件 | 描述 | 数据格式 | +|------|------|---------| +| `thinking_start` | 开始深度思考 | `{}` | +| `thinking_delta` | 思考内容片段 | `{"content": "..."}` | +| `thinking_end` | 思考结束 | `{"duration": number}` | +| `message_start` | 开始生成回复 | `{"id": "..."}` | +| `delta` | 回复内容片段 | `{"content": "..."}` | +| `message_end` | 回复结束 | `{"id": "...", "tokens": number, "model": "..."}` | +| `error` | 发生错误 | `{"code": "...", "message": "..."}` | +| `done` | 流结束 | `{}` | + +--- + +### 5. 附件上传 + +#### 5.1 上传附件 + +```http +POST /api/v2/aia/conversations/:id/attachments +``` + +**请求头**: + +``` +Content-Type: multipart/form-data +``` + +**请求体(FormData)**: + +| 字段 | 类型 | 必填 | 描述 | +|------|------|------|------| +| file | File | 是 | 文件(PDF/Word/TXT/Excel,最大20MB) | + +**响应**: + +```json +{ + "code": 0, + "data": { + "id": "att-001", + "filename": "研究数据.xlsx", + "mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "size": 1024000, + "ossUrl": "https://oss.example.com/attachments/att-001.xlsx", + "textExtracted": true, + "tokenCount": 15000, + "truncated": false, + "createdAt": "2026-01-11T14:00:00Z" + } +} +``` + +**错误码**: + +| 错误码 | 描述 | +|--------|------| +| `ATTACHMENT_TOO_LARGE` | 文件超过 20MB | +| `ATTACHMENT_TYPE_NOT_SUPPORTED` | 不支持的文件类型 | +| `ATTACHMENT_LIMIT_EXCEEDED` | 附件数量超过上限(5个) | +| `TEXT_EXTRACTION_FAILED` | 文本提取失败 | + +--- + +### 6. 项目管理 + +#### 6.1 获取项目列表 + +```http +GET /api/v2/aia/projects +``` + +**响应**: + +```json +{ + "code": 0, + "data": { + "projects": [ + { + "id": "proj-001", + "name": "糖尿病研究项目", + "description": "2型糖尿病患者生活方式干预研究", + "conversationCount": 5, + "createdAt": "2026-01-01T10:00:00Z", + "updatedAt": "2026-01-11T12:00:00Z" + } + ] + } +} +``` + +--- + +## 🔧 错误处理 + +### 错误响应格式 + +```json +{ + "code": -1, + "error": { + "code": "CONVERSATION_NOT_FOUND", + "message": "对话不存在" + } +} +``` + +### 通用错误码 + +| 错误码 | HTTP 状态码 | 描述 | +|--------|------------|------| +| `UNAUTHORIZED` | 401 | 未授权 | +| `FORBIDDEN` | 403 | 无权限 | +| `NOT_FOUND` | 404 | 资源不存在 | +| `VALIDATION_ERROR` | 400 | 参数验证失败 | +| `INTERNAL_ERROR` | 500 | 服务器内部错误 | +| `LLM_ERROR` | 500 | LLM 调用失败 | +| `RATE_LIMITED` | 429 | 请求过于频繁 | + +--- + +## 📊 数据模型 + +### Attachment(附件) + +```typescript +interface Attachment { + id: string; // 附件ID + filename: string; // 原始文件名 + mimeType: string; // MIME 类型 + size: number; // 文件大小(字节) + ossUrl: string; // OSS 存储地址 + textContent?: string; // 提取的文本内容(存储时截断) + tokenCount: number; // 文本 Token 数 + truncated: boolean; // 是否被截断(超过30K tokens) + createdAt: string; // 创建时间 +} +``` + +### Message(消息) + +```typescript +interface Message { + id: string; + conversationId: string; + role: 'user' | 'assistant'; + content: string; + thinkingContent?: string; // 深度思考内容 + attachments?: Attachment[]; + model?: string; + tokens?: number; + isPinned: boolean; + createdAt: string; +} +``` + +--- + +## 🧪 测试示例(REST Client) + +```http +### 获取智能体列表 +GET {{baseUrl}}/api/v2/aia/agents +Authorization: Bearer {{token}} + +### 意图路由 +POST {{baseUrl}}/api/v2/aia/intent/route +Authorization: Bearer {{token}} +Content-Type: application/json + +{ + "query": "帮我分析数据" +} + +### 创建对话 +POST {{baseUrl}}/api/v2/aia/conversations +Authorization: Bearer {{token}} +Content-Type: application/json + +{ + "agentId": "research-design", + "title": "测试对话" +} + +### 发送消息(流式) +POST {{baseUrl}}/api/v2/aia/conversations/{{conversationId}}/messages/stream +Authorization: Bearer {{token}} +Content-Type: application/json +Accept: text/event-stream + +{ + "content": "帮我设计一个RCT研究", + "enableDeepThinking": true +} + +### 上传附件 +POST {{baseUrl}}/api/v2/aia/conversations/{{conversationId}}/attachments +Authorization: Bearer {{token}} +Content-Type: multipart/form-data; boundary=----WebKitFormBoundary + +------WebKitFormBoundary +Content-Disposition: form-data; name="file"; filename="data.xlsx" +Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + +< ./data.xlsx +------WebKitFormBoundary-- +``` + +--- + +## 📝 更新日志 + +| 日期 | 版本 | 内容 | +|------|------|------| +| 2026-01-11 | V1.0 | 创建 API 设计文档 | + + + + diff --git a/docs/03-业务模块/AIA-AI智能问答/04-开发计划/03-前端组件设计.md b/docs/03-业务模块/AIA-AI智能问答/04-开发计划/03-前端组件设计.md new file mode 100644 index 00000000..09c277a4 --- /dev/null +++ b/docs/03-业务模块/AIA-AI智能问答/04-开发计划/03-前端组件设计.md @@ -0,0 +1,883 @@ +# AIA V2.1 前端组件设计 + +> **版本**:V2.1 +> **创建日期**:2026-01-11 +> **技术栈**:React 19 + TypeScript 5 + Ant Design 6 + Ant Design X 2.1 + +--- + +## 📁 模块结构 + +``` +frontend-v2/src/modules/aia/ +├── pages/ +│ ├── Dashboard.tsx # 智能体大厅(首页) +│ └── Workspace.tsx # 对话工作台 +├── components/ +│ ├── AgentPipeline/ +│ │ ├── index.tsx # 5阶段流水线容器 +│ │ ├── StageColumn.tsx # 单阶段列 +│ │ └── AgentCard.tsx # 智能体卡片 +│ ├── IntentSearch/ +│ │ ├── index.tsx # 意图搜索框 +│ │ └── SuggestionDropdown.tsx # 建议下拉框 +│ ├── ConversationList/ +│ │ ├── index.tsx # 历史会话列表 +│ │ └── ConversationItem.tsx # 会话项 +│ ├── MessageList/ +│ │ ├── index.tsx # 消息列表 +│ │ ├── UserMessage.tsx # 用户消息 +│ │ ├── AssistantMessage.tsx # AI回复 +│ │ └── ThinkingBlock.tsx # 深度思考折叠块 +│ ├── Attachment/ +│ │ ├── AttachmentUpload.tsx # 附件上传 +│ │ ├── AttachmentCard.tsx # 附件卡片 +│ │ └── AttachmentPreview.tsx # 附件预览 +│ ├── SlashCommands/ +│ │ └── index.tsx # 快捷指令菜单 +│ └── ActionBar/ +│ └── index.tsx # 结果操作栏 +├── hooks/ +│ ├── useConversation.ts # 对话管理 +│ ├── useAgents.ts # 智能体数据 +│ ├── useIntentRouter.ts # 意图路由 +│ ├── useStreamMessage.ts # 流式消息 +│ └── useAttachment.ts # 附件上传 +├── api/ +│ └── index.ts # API 封装 +├── types/ +│ └── index.ts # TypeScript 类型 +├── styles/ +│ ├── dashboard.module.css # Dashboard 样式 +│ └── workspace.module.css # Workspace 样式 +└── index.tsx # 模块入口 + 路由 +``` + +--- + +## 🎨 设计规范 + +### 色彩系统 + +```css +:root { + /* 5阶段流水线主题色 */ + --stage-design: #3B82F6; /* 蓝色 - 研究设计 */ + --stage-data: #8B5CF6; /* 紫色 - 数据采集 */ + --stage-analysis: #10B981; /* 绿色 - 统计分析 */ + --stage-write: #F59E0B; /* 橙色 - 论文撰写 */ + --stage-publish: #EF4444; /* 红色 - 成果发布 */ + + /* 功能色 */ + --ai-assistant: #6366F1; /* AI助手主色 */ + --thinking-bg: #F3F4F6; /* 思考块背景 */ + --thinking-border: #E5E7EB; /* 思考块边框 */ + + /* Gemini 风格 */ + --bg-primary: #FFFFFF; + --bg-secondary: #F9FAFB; + --text-primary: #111827; + --text-secondary: #6B7280; + --border-light: #E5E7EB; +} +``` + +### 间距系统 + +```css +/* 遵循 8px 网格 */ +--spacing-xs: 4px; +--spacing-sm: 8px; +--spacing-md: 16px; +--spacing-lg: 24px; +--spacing-xl: 32px; +--spacing-2xl: 48px; +``` + +### 断点 + +```css +/* 移动优先 */ +--breakpoint-sm: 640px; /* 手机 */ +--breakpoint-md: 768px; /* 平板 */ +--breakpoint-lg: 1024px; /* 桌面 */ +--breakpoint-xl: 1280px; /* 大屏 */ +``` + +--- + +## 📄 页面设计 + +### 1. Dashboard(智能体大厅) + +```tsx +// pages/Dashboard.tsx + +import { IntentSearch } from '../components/IntentSearch'; +import { AgentPipeline } from '../components/AgentPipeline'; + +export const Dashboard: React.FC = () => { + return ( +
+ {/* 顶部意图搜索框 */} +
+

AI 智能助手

+

有什么可以帮助您的?

+ +
+ + {/* 5阶段智能体流水线 */} +
+ +
+
+ ); +}; +``` + +**布局特点**: +- 顶部居中大搜索框 +- 5阶段流水线横向平铺(桌面)/ 纵向滚动(移动) +- Gemini 风格大留白 + +--- + +### 2. Workspace(对话工作台) + +```tsx +// pages/Workspace.tsx + +import { ChatContainer } from '@/shared/components/Chat'; +import { ConversationList } from '../components/ConversationList'; +import { ThinkingBlock } from '../components/MessageList/ThinkingBlock'; +import { AttachmentUpload } from '../components/Attachment/AttachmentUpload'; + +export const Workspace: React.FC = () => { + const { conversationId } = useParams(); + const { conversation, messages, sendMessage } = useConversation(conversationId); + + return ( +
+ {/* 左侧边栏 - 历史会话 */} + + + {/* 主对话区 */} +
+ {/* 对话头部 */} +
+ +

{conversation?.agent?.name}

+
+ + {/* 消息列表 - 复用通用 Chat 组件 */} + ( +
+ {/* 深度思考块 */} + {msg.thinkingContent && ( + + )} + {/* 消息内容 */} + + {/* 附件卡片 */} + {msg.attachments?.map(att => ( + + ))} +
+ )} + inputFooter={} + /> +
+
+ ); +}; +``` + +--- + +## 🧩 组件详细设计 + +### 1. AgentPipeline(5阶段流水线) + +```tsx +// components/AgentPipeline/index.tsx + +interface AgentPipelineProps { + onAgentClick: (agentId: string) => void; +} + +export const AgentPipeline: React.FC = ({ onAgentClick }) => { + const { agents } = useAgents(); + + const stages = [ + { key: 'design', title: '研究设计', color: 'var(--stage-design)' }, + { key: 'data', title: '数据采集', color: 'var(--stage-data)' }, + { key: 'analysis', title: '统计分析', color: 'var(--stage-analysis)' }, + { key: 'write', title: '论文撰写', color: 'var(--stage-write)' }, + { key: 'publish', title: '成果发布', color: 'var(--stage-publish)' }, + ]; + + return ( +
+ {stages.map((stage, index) => ( + a.stage === stage.key)} + onAgentClick={onAgentClick} + showConnector={index < stages.length - 1} + /> + ))} +
+ ); +}; +``` + +**样式特点**: +```css +.pipeline { + display: flex; + gap: var(--spacing-lg); + overflow-x: auto; + padding: var(--spacing-xl) 0; +} + +/* 移动端纵向布局 */ +@media (max-width: 768px) { + .pipeline { + flex-direction: column; + overflow-x: visible; + } +} +``` + +--- + +### 2. IntentSearch(意图搜索框) + +```tsx +// components/IntentSearch/index.tsx + +export const IntentSearch: React.FC = () => { + const [query, setQuery] = useState(''); + const [suggestions, setSuggestions] = useState([]); + const { routeIntent, isLoading } = useIntentRouter(); + const navigate = useNavigate(); + + // 500ms 防抖 + const debouncedQuery = useDebouncedValue(query, 500); + + useEffect(() => { + if (debouncedQuery.length >= 2) { + routeIntent(debouncedQuery).then(setSuggestions); + } + }, [debouncedQuery]); + + const handleSelect = (suggestion: IntentSuggestion) => { + // 跳转到对应智能体 + navigate(`/aia/workspace?agent=${suggestion.agentId}&prompt=${encodeURIComponent(suggestion.prefillPrompt)}`); + }; + + return ( +
+ setQuery(e.target.value)} + loading={isLoading} + className={styles.searchInput} + /> + + {suggestions.length > 0 && ( + + )} +
+ ); +}; +``` + +--- + +### 3. ThinkingBlock(深度思考折叠块) + +```tsx +// components/MessageList/ThinkingBlock.tsx + +interface ThinkingBlockProps { + content: string; + duration?: number; // 思考耗时(秒) + isStreaming?: boolean; // 是否正在生成 +} + +export const ThinkingBlock: React.FC = ({ + content, + duration, + isStreaming = false, +}) => { + // 生成中展开,完成后自动收起 + const [expanded, setExpanded] = useState(isStreaming); + + useEffect(() => { + if (!isStreaming && expanded) { + // 完成后 1.5s 自动收起 + const timer = setTimeout(() => setExpanded(false), 1500); + return () => clearTimeout(timer); + } + }, [isStreaming]); + + return ( +
+
setExpanded(!expanded)} + > + + {isStreaming ? : } + + + {isStreaming ? '正在深度思考...' : `已深度思考 (耗时 ${duration?.toFixed(1)}s)`} + + + {expanded ? : } + +
+ + {expanded && ( +
+ + {content} + +
+ )} +
+ ); +}; +``` + +**样式**: +```css +.thinkingBlock { + background: var(--thinking-bg); + border: 1px solid var(--thinking-border); + border-radius: 8px; + margin-bottom: var(--spacing-md); +} + +.header { + display: flex; + align-items: center; + padding: var(--spacing-sm) var(--spacing-md); + cursor: pointer; + user-select: none; +} + +.content { + padding: var(--spacing-md); + padding-top: 0; + font-size: 13px; + line-height: 1.6; + color: var(--text-secondary); +} +``` + +--- + +### 4. AttachmentUpload(附件上传) + +```tsx +// components/Attachment/AttachmentUpload.tsx + +interface AttachmentUploadProps { + conversationId: string; + onUploadComplete: (attachment: Attachment) => void; + maxCount?: number; // 默认 5 +} + +export const AttachmentUpload: React.FC = ({ + conversationId, + onUploadComplete, + maxCount = 5, +}) => { + const { uploadFile, uploading, progress } = useAttachment(); + const [attachments, setAttachments] = useState([]); + + const handleUpload = async (file: File) => { + if (attachments.length >= maxCount) { + message.error(`最多上传 ${maxCount} 个附件`); + return false; + } + + // 文件类型校验 + const allowedTypes = ['application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'text/plain', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']; + if (!allowedTypes.includes(file.type)) { + message.error('仅支持 PDF、Word、TXT、Excel 文件'); + return false; + } + + // 文件大小校验(20MB) + if (file.size > 20 * 1024 * 1024) { + message.error('文件大小不能超过 20MB'); + return false; + } + + const attachment = await uploadFile(conversationId, file); + setAttachments([...attachments, attachment]); + onUploadComplete(attachment); + return false; // 阻止默认上传 + }; + + return ( +
+ + + + + {/* 已上传附件列表 */} +
+ {attachments.map(att => ( + { + setAttachments(attachments.filter(a => a.id !== att.id)); + }} + /> + ))} +
+ + {/* 上传进度 */} + {uploading && ( + + )} +
+ ); +}; +``` + +--- + +### 5. SlashCommands(快捷指令) + +```tsx +// components/SlashCommands/index.tsx + +interface SlashCommandsProps { + onSelect: (command: SlashCommand) => void; + onClose: () => void; +} + +const commands: SlashCommand[] = [ + { key: 'polish', icon: '✨', label: '润色', description: '优化文本表达' }, + { key: 'expand', icon: '📝', label: '扩写', description: '扩展内容细节' }, + { key: 'translate', icon: '🌐', label: '翻译', description: '中英互译' }, + { key: 'export', icon: '📄', label: '导出Word', description: '导出为 Word 文档' }, +]; + +export const SlashCommands: React.FC = ({ + onSelect, + onClose, +}) => { + const [selectedIndex, setSelectedIndex] = useState(0); + + // 键盘导航 + useEffect(() => { + const handleKeyDown = (e: KeyboardEvent) => { + switch (e.key) { + case 'ArrowUp': + e.preventDefault(); + setSelectedIndex(i => Math.max(0, i - 1)); + break; + case 'ArrowDown': + e.preventDefault(); + setSelectedIndex(i => Math.min(commands.length - 1, i + 1)); + break; + case 'Enter': + e.preventDefault(); + onSelect(commands[selectedIndex]); + break; + case 'Escape': + onClose(); + break; + } + }; + + window.addEventListener('keydown', handleKeyDown); + return () => window.removeEventListener('keydown', handleKeyDown); + }, [selectedIndex]); + + return ( +
+ {commands.map((cmd, index) => ( +
onSelect(cmd)} + onMouseEnter={() => setSelectedIndex(index)} + > + {cmd.icon} +
+
{cmd.label}
+
{cmd.description}
+
+
+ ))} +
+ ); +}; +``` + +--- + +### 6. ActionBar(结果操作栏) + +```tsx +// components/ActionBar/index.tsx + +interface ActionBarProps { + message: Message; + onCopy: () => void; + onRegenerate: () => void; + onExport: () => void; +} + +export const ActionBar: React.FC = ({ + message, + onCopy, + onRegenerate, + onExport, +}) => { + return ( +
+ +
+ ); +}; +``` + +--- + +## 🎣 Hooks 设计 + +### useConversation + +```typescript +// hooks/useConversation.ts + +interface UseConversationReturn { + conversation: Conversation | null; + messages: Message[]; + isLoading: boolean; + sendMessage: (content: string, attachmentIds?: string[]) => Promise; + regenerate: (messageId: string) => Promise; + deleteConversation: () => Promise; +} + +export function useConversation(conversationId?: string): UseConversationReturn { + const [conversation, setConversation] = useState(null); + const [messages, setMessages] = useState([]); + const [isLoading, setIsLoading] = useState(false); + + // 加载对话 + useEffect(() => { + if (conversationId) { + api.getConversation(conversationId).then(data => { + setConversation(data); + setMessages(data.messages); + }); + } + }, [conversationId]); + + // 发送消息(流式) + const sendMessage = async (content: string, attachmentIds?: string[]) => { + setIsLoading(true); + + // 添加用户消息 + const userMessage: Message = { + id: `temp-${Date.now()}`, + role: 'user', + content, + attachments: [], + createdAt: new Date().toISOString(), + }; + setMessages(prev => [...prev, userMessage]); + + // 初始化 AI 消息 + const aiMessage: Message = { + id: `temp-ai-${Date.now()}`, + role: 'assistant', + content: '', + thinkingContent: '', + createdAt: new Date().toISOString(), + }; + setMessages(prev => [...prev, aiMessage]); + + // 流式接收 + await api.sendMessageStream(conversationId!, content, attachmentIds, { + onThinkingDelta: (delta) => { + setMessages(prev => { + const last = prev[prev.length - 1]; + return [...prev.slice(0, -1), { + ...last, + thinkingContent: (last.thinkingContent || '') + delta, + }]; + }); + }, + onDelta: (delta) => { + setMessages(prev => { + const last = prev[prev.length - 1]; + return [...prev.slice(0, -1), { + ...last, + content: last.content + delta, + }]; + }); + }, + onComplete: (finalMessage) => { + setMessages(prev => { + return [...prev.slice(0, -1), finalMessage]; + }); + setIsLoading(false); + }, + onError: (error) => { + message.error(error.message); + setIsLoading(false); + }, + }); + }; + + return { + conversation, + messages, + isLoading, + sendMessage, + regenerate: async () => {}, + deleteConversation: async () => {}, + }; +} +``` + +### useStreamMessage + +```typescript +// hooks/useStreamMessage.ts + +interface StreamCallbacks { + onThinkingStart?: () => void; + onThinkingDelta?: (content: string) => void; + onThinkingEnd?: (duration: number) => void; + onMessageStart?: (id: string) => void; + onDelta?: (content: string) => void; + onMessageEnd?: (message: Message) => void; + onComplete?: (message: Message) => void; + onError?: (error: Error) => void; +} + +export function useStreamMessage() { + const streamMessage = async ( + url: string, + body: object, + callbacks: StreamCallbacks + ) => { + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Accept': 'text/event-stream', + }, + body: JSON.stringify(body), + }); + + const reader = response.body?.getReader(); + const decoder = new TextDecoder(); + + while (true) { + const { done, value } = await reader!.read(); + if (done) break; + + const chunk = decoder.decode(value); + const events = parseSSE(chunk); + + for (const event of events) { + switch (event.type) { + case 'thinking_start': + callbacks.onThinkingStart?.(); + break; + case 'thinking_delta': + callbacks.onThinkingDelta?.(event.data.content); + break; + case 'thinking_end': + callbacks.onThinkingEnd?.(event.data.duration); + break; + case 'message_start': + callbacks.onMessageStart?.(event.data.id); + break; + case 'delta': + callbacks.onDelta?.(event.data.content); + break; + case 'message_end': + callbacks.onMessageEnd?.(event.data); + break; + case 'done': + callbacks.onComplete?.(event.data); + break; + case 'error': + callbacks.onError?.(new Error(event.data.message)); + break; + } + } + } + }; + + return { streamMessage }; +} +``` + +--- + +## 📱 响应式设计 + +### 断点策略 + +```typescript +// 断点定义 +const breakpoints = { + sm: 640, // 手机 + md: 768, // 平板(主要断点) + lg: 1024, // 桌面 + xl: 1280, // 大屏 +}; +``` + +### Dashboard 响应式 + +| 断点 | 布局 | +|------|------| +| `< 768px` | 流水线纵向滚动,卡片单列 | +| `≥ 768px` | 流水线横向 5 列 | + +### Workspace 响应式 + +| 断点 | 布局 | +|------|------| +| `< 768px` | 侧边栏隐藏(抽屉滑出),输入框键盘适配 | +| `≥ 768px` | 侧边栏固定显示 240px | + +--- + +## 📝 类型定义 + +```typescript +// types/index.ts + +export interface Agent { + id: string; + name: string; + description: string; + icon: string; + stage: 'design' | 'data' | 'analysis' | 'write' | 'publish'; + color: string; + knowledgeBaseId?: string; + isTool?: boolean; + targetModule?: string; + welcomeMessage?: string; + suggestedQuestions?: string[]; +} + +export interface Conversation { + id: string; + title: string; + agentId: string; + agent?: Agent; + projectId?: string; + messageCount: number; + lastMessage?: string; + createdAt: string; + updatedAt: string; +} + +export interface Message { + id: string; + conversationId?: string; + role: 'user' | 'assistant'; + content: string; + thinkingContent?: string; + attachments?: Attachment[]; + model?: string; + tokens?: number; + isPinned?: boolean; + createdAt: string; +} + +export interface Attachment { + id: string; + filename: string; + mimeType: string; + size: number; + ossUrl: string; + textExtracted: boolean; + tokenCount: number; + truncated: boolean; + createdAt: string; +} + +export interface IntentSuggestion { + agentId: string; + agentName: string; + confidence: number; + prefillPrompt: string; +} + +export interface SlashCommand { + key: string; + icon: string; + label: string; + description: string; +} +``` + +--- + +## 📝 更新日志 + +| 日期 | 版本 | 内容 | +|------|------|------| +| 2026-01-11 | V1.0 | 创建前端组件设计文档 | + + + + diff --git a/docs/03-业务模块/ASL-AI智能文献/04-开发计划/05-全文复筛前端开发计划.md b/docs/03-业务模块/ASL-AI智能文献/04-开发计划/05-全文复筛前端开发计划.md index f3bceb46..22fdf671 100644 --- a/docs/03-业务模块/ASL-AI智能文献/04-开发计划/05-全文复筛前端开发计划.md +++ b/docs/03-业务模块/ASL-AI智能文献/04-开发计划/05-全文复筛前端开发计划.md @@ -1288,6 +1288,9 @@ interface FulltextScreeningResult { + + + diff --git a/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-01-23_全文复筛前端开发完成.md b/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-01-23_全文复筛前端开发完成.md index c630ed0b..05a305be 100644 --- a/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-01-23_全文复筛前端开发完成.md +++ b/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-01-23_全文复筛前端开发完成.md @@ -402,6 +402,9 @@ GET /api/v1/asl/fulltext-screening/tasks/:taskId/export + + + diff --git a/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-01-23_全文复筛前端逻辑调整.md b/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-01-23_全文复筛前端逻辑调整.md index 36ab8002..c5065f41 100644 --- a/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-01-23_全文复筛前端逻辑调整.md +++ b/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-01-23_全文复筛前端逻辑调整.md @@ -345,6 +345,9 @@ Linter错误:0个 + + + diff --git a/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-11-23_Day5_全文复筛API开发.md b/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-11-23_Day5_全文复筛API开发.md index a0e70f47..0d124a68 100644 --- a/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-11-23_Day5_全文复筛API开发.md +++ b/docs/03-业务模块/ASL-AI智能文献/05-开发记录/2025-11-23_Day5_全文复筛API开发.md @@ -504,6 +504,9 @@ Failed to open file '\\tmp\\extraction_service\\temp_10000_test.pdf' + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_AI_Few-shot示例库.md b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_AI_Few-shot示例库.md index 0d990cbc..fc1140df 100644 --- a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_AI_Few-shot示例库.md +++ b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_AI_Few-shot示例库.md @@ -570,6 +570,9 @@ df['creatinine'] = pd.to_numeric(df['creatinine'], errors='coerce') + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Bug修复总结_2025-12-08.md b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Bug修复总结_2025-12-08.md index a28e3ef8..fddb27ce 100644 --- a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Bug修复总结_2025-12-08.md +++ b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Bug修复总结_2025-12-08.md @@ -408,6 +408,9 @@ npm run dev + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Day3开发计划.md b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Day3开发计划.md index c2ea98f6..c73be7a4 100644 --- a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Day3开发计划.md +++ b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Day3开发计划.md @@ -985,6 +985,9 @@ export const aiController = new AIController(); + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Day4-5前端开发计划.md b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Day4-5前端开发计划.md index 79f22286..f39101fd 100644 --- a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Day4-5前端开发计划.md +++ b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Day4-5前端开发计划.md @@ -1319,6 +1319,9 @@ npm install react-markdown + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Pivot列顺序优化总结.md b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Pivot列顺序优化总结.md index 0cc225c4..7ebf20f0 100644 --- a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Pivot列顺序优化总结.md +++ b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_Pivot列顺序优化总结.md @@ -227,6 +227,9 @@ FMA___基线 | FMA___1个月 | FMA___2个月 + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_方案B实施总结_2025-12-09.md b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_方案B实施总结_2025-12-09.md index a087f3cc..10c0fe88 100644 --- a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_方案B实施总结_2025-12-09.md +++ b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_方案B实施总结_2025-12-09.md @@ -385,6 +385,9 @@ formula = "FMA总分(0-100) / 100" + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_缺失值处理_开发进度_2025-12-10.md b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_缺失值处理_开发进度_2025-12-10.md index ad103416..1f08e892 100644 --- a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_缺失值处理_开发进度_2025-12-10.md +++ b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_缺失值处理_开发进度_2025-12-10.md @@ -219,6 +219,9 @@ async handleFillnaMice(request, reply) { + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_缺失值处理功能_更新说明.md b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_缺失值处理功能_更新说明.md index a92d9871..10966832 100644 --- a/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_缺失值处理功能_更新说明.md +++ b/docs/03-业务模块/DC-数据清洗整理/04-开发计划/工具C_缺失值处理功能_更新说明.md @@ -191,6 +191,9 @@ method: 'mean' | 'median' | 'mode' | 'constant' | 'ffill' | 'bfill' + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-02_工作总结.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-02_工作总结.md index 35beb2cf..1a6941d2 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-02_工作总结.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-02_工作总结.md @@ -341,6 +341,9 @@ Changes: + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-06_工具C_Day1开发完成总结.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-06_工具C_Day1开发完成总结.md index 3a50bab8..aa4669df 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-06_工具C_Day1开发完成总结.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-06_工具C_Day1开发完成总结.md @@ -413,6 +413,9 @@ cd path; command + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-06_工具C_Day2开发完成总结.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-06_工具C_Day2开发完成总结.md index 365a7ff4..11cf0e19 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-06_工具C_Day2开发完成总结.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-06_工具C_Day2开发完成总结.md @@ -642,6 +642,9 @@ import { logger } from '../../../../common/logging/index.js'; + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_AI对话核心功能增强总结.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_AI对话核心功能增强总结.md index ad4aa9b4..bcf90fa7 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_AI对话核心功能增强总结.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_AI对话核心功能增强总结.md @@ -646,6 +646,9 @@ Content-Length: 45234 + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Bug修复_DataGrid空数据防御.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Bug修复_DataGrid空数据防御.md index 6a54bfca..5cbe734b 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Bug修复_DataGrid空数据防御.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Bug修复_DataGrid空数据防御.md @@ -298,6 +298,9 @@ Response: + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Day5_Ant-Design-X重构完成.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Day5_Ant-Design-X重构完成.md index ed81356f..8b9200cd 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Day5_Ant-Design-X重构完成.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Day5_Ant-Design-X重构完成.md @@ -451,6 +451,9 @@ Response: + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Day5最终总结.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Day5最终总结.md index 039b4c0a..f0818895 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Day5最终总结.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_Day5最终总结.md @@ -445,6 +445,9 @@ import { ChatContainer } from '@/shared/components/Chat'; + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_UI优化与Bug修复.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_UI优化与Bug修复.md index 558215b4..afb48700 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_UI优化与Bug修复.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_UI优化与Bug修复.md @@ -355,6 +355,9 @@ const initialMessages = defaultMessages.length > 0 ? defaultMessages : [{ + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_后端API完整对接完成.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_后端API完整对接完成.md index 5880a5dc..d43823fd 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_后端API完整对接完成.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_后端API完整对接完成.md @@ -395,6 +395,9 @@ python main.py + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_完整UI优化与功能增强.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_完整UI优化与功能增强.md index eec659d7..914a4a28 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_完整UI优化与功能增强.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_完整UI优化与功能增强.md @@ -643,6 +643,9 @@ http://localhost:5173/data-cleaning/tool-c + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_工具C_Day4前端基础完成.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_工具C_Day4前端基础完成.md index 7f278bcf..922811ec 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_工具C_Day4前端基础完成.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-07_工具C_Day4前端基础完成.md @@ -253,6 +253,9 @@ Day 5 (6-8小时): + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/DC模块重建完成总结-Day1.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/DC模块重建完成总结-Day1.md index 69a31b35..556645f0 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/DC模块重建完成总结-Day1.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/DC模块重建完成总结-Day1.md @@ -431,6 +431,9 @@ Docs: docs/03-业务模块/DC-数据清洗整理/06-开发记录/DC模块重建 + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Phase1-Portal页面开发完成-2025-12-02.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Phase1-Portal页面开发完成-2025-12-02.md index 27471945..3c66d23c 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Phase1-Portal页面开发完成-2025-12-02.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Phase1-Portal页面开发完成-2025-12-02.md @@ -406,6 +406,9 @@ const mockAssets: Asset[] = [ + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Phase2-ToolB-Step1-2开发完成-2025-12-03.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Phase2-ToolB-Step1-2开发完成-2025-12-03.md index 6b575166..89b44d42 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Phase2-ToolB-Step1-2开发完成-2025-12-03.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Phase2-ToolB-Step1-2开发完成-2025-12-03.md @@ -390,6 +390,9 @@ frontend-v2/src/modules/dc/ + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Portal页面UI优化-2025-12-02.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Portal页面UI优化-2025-12-02.md index 18bec607..7aaf778f 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Portal页面UI优化-2025-12-02.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Portal页面UI优化-2025-12-02.md @@ -350,6 +350,9 @@ + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Tool-B-MVP完成总结-2025-12-03.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Tool-B-MVP完成总结-2025-12-03.md index 7e04292f..bcc004bf 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Tool-B-MVP完成总结-2025-12-03.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/Tool-B-MVP完成总结-2025-12-03.md @@ -304,6 +304,9 @@ ConflictDetectionService // 冲突检测(字段级对比) + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB-UI优化-2025-12-03.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB-UI优化-2025-12-03.md index 86e41516..7f27c27f 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB-UI优化-2025-12-03.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB-UI优化-2025-12-03.md @@ -353,6 +353,9 @@ + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB-UI优化-Round2-2025-12-03.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB-UI优化-Round2-2025-12-03.md index ce0cf774..b21ef3dd 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB-UI优化-Round2-2025-12-03.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB-UI优化-Round2-2025-12-03.md @@ -316,6 +316,9 @@ + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB浏览器测试计划-2025-12-03.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB浏览器测试计划-2025-12-03.md index 90779e9a..7892f0b0 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB浏览器测试计划-2025-12-03.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/ToolB浏览器测试计划-2025-12-03.md @@ -380,6 +380,9 @@ + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/后端API测试报告-2025-12-02.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/后端API测试报告-2025-12-02.md index e9ff029a..063bd7f3 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/后端API测试报告-2025-12-02.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/后端API测试报告-2025-12-02.md @@ -468,6 +468,9 @@ Tool B后端代码**100%复用**了平台通用能力层,无任何重复开发 + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/待办事项-下一步工作.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/待办事项-下一步工作.md index 28b604b4..5a704807 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/待办事项-下一步工作.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/待办事项-下一步工作.md @@ -314,6 +314,9 @@ + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/数据库验证报告-2025-12-02.md b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/数据库验证报告-2025-12-02.md index dfd75689..94e329eb 100644 --- a/docs/03-业务模块/DC-数据清洗整理/06-开发记录/数据库验证报告-2025-12-02.md +++ b/docs/03-业务模块/DC-数据清洗整理/06-开发记录/数据库验证报告-2025-12-02.md @@ -245,6 +245,9 @@ $ node scripts/check-dc-tables.mjs + + + diff --git a/docs/03-业务模块/DC-数据清洗整理/07-技术债务/Tool-B技术债务清单.md b/docs/03-业务模块/DC-数据清洗整理/07-技术债务/Tool-B技术债务清单.md index 8436178c..57ad3873 100644 --- a/docs/03-业务模块/DC-数据清洗整理/07-技术债务/Tool-B技术债务清单.md +++ b/docs/03-业务模块/DC-数据清洗整理/07-技术债务/Tool-B技术债务清单.md @@ -478,6 +478,9 @@ ${fields.map((f, i) => `${i + 1}. ${f.name}:${f.desc}`).join('\n')} + + + diff --git a/docs/03-业务模块/IIT Manager Agent/02-技术设计/IIT Manager Agent 技术路径与架构设计.md b/docs/03-业务模块/IIT Manager Agent/02-技术设计/IIT Manager Agent 技术路径与架构设计.md index 3a85ae38..b18ead68 100644 --- a/docs/03-业务模块/IIT Manager Agent/02-技术设计/IIT Manager Agent 技术路径与架构设计.md +++ b/docs/03-业务模块/IIT Manager Agent/02-技术设计/IIT Manager Agent 技术路径与架构设计.md @@ -687,3 +687,6 @@ private async processMessageAsync(xmlData: any) { + + + diff --git a/docs/03-业务模块/IIT Manager Agent/04-开发计划/REDCap对接技术方案与实施指南.md b/docs/03-业务模块/IIT Manager Agent/04-开发计划/REDCap对接技术方案与实施指南.md index ee1e1ddb..84a9af23 100644 --- a/docs/03-业务模块/IIT Manager Agent/04-开发计划/REDCap对接技术方案与实施指南.md +++ b/docs/03-业务模块/IIT Manager Agent/04-开发计划/REDCap对接技术方案与实施指南.md @@ -1081,3 +1081,6 @@ async function testIntegration() { + + + diff --git a/docs/03-业务模块/IIT Manager Agent/04-开发计划/企业微信注册指南.md b/docs/03-业务模块/IIT Manager Agent/04-开发计划/企业微信注册指南.md index f9bb70bf..fc4a9514 100644 --- a/docs/03-业务模块/IIT Manager Agent/04-开发计划/企业微信注册指南.md +++ b/docs/03-业务模块/IIT Manager Agent/04-开发计划/企业微信注册指南.md @@ -222,3 +222,6 @@ Content-Type: application/json + + + diff --git a/docs/03-业务模块/IIT Manager Agent/06-开发记录/2026-01-04-Dify知识库集成开发记录.md b/docs/03-业务模块/IIT Manager Agent/06-开发记录/2026-01-04-Dify知识库集成开发记录.md index e6e78d52..e4b0477e 100644 --- a/docs/03-业务模块/IIT Manager Agent/06-开发记录/2026-01-04-Dify知识库集成开发记录.md +++ b/docs/03-业务模块/IIT Manager Agent/06-开发记录/2026-01-04-Dify知识库集成开发记录.md @@ -642,3 +642,6 @@ REDCap API: exportRecords success { recordCount: 1 } + + + diff --git a/docs/03-业务模块/IIT Manager Agent/06-开发记录/Day2-REDCap实时集成开发完成记录.md b/docs/03-业务模块/IIT Manager Agent/06-开发记录/Day2-REDCap实时集成开发完成记录.md index 0ffa0521..c87374d1 100644 --- a/docs/03-业务模块/IIT Manager Agent/06-开发记录/Day2-REDCap实时集成开发完成记录.md +++ b/docs/03-业务模块/IIT Manager Agent/06-开发记录/Day2-REDCap实时集成开发完成记录.md @@ -648,3 +648,6 @@ backend/src/modules/iit-manager/ + + + diff --git a/docs/03-业务模块/IIT Manager Agent/06-开发记录/Day3-企业微信集成与端到端测试完成记录.md b/docs/03-业务模块/IIT Manager Agent/06-开发记录/Day3-企业微信集成与端到端测试完成记录.md index e0c911c8..4a2bf262 100644 --- a/docs/03-业务模块/IIT Manager Agent/06-开发记录/Day3-企业微信集成与端到端测试完成记录.md +++ b/docs/03-业务模块/IIT Manager Agent/06-开发记录/Day3-企业微信集成与端到端测试完成记录.md @@ -798,3 +798,6 @@ CREATE TABLE iit_schema.wechat_tokens ( + + + diff --git a/docs/03-业务模块/IIT Manager Agent/06-开发记录/Day3-企业微信集成开发完成记录.md b/docs/03-业务模块/IIT Manager Agent/06-开发记录/Day3-企业微信集成开发完成记录.md index f6085b9b..a1b18223 100644 --- a/docs/03-业务模块/IIT Manager Agent/06-开发记录/Day3-企业微信集成开发完成记录.md +++ b/docs/03-业务模块/IIT Manager Agent/06-开发记录/Day3-企业微信集成开发完成记录.md @@ -555,3 +555,6 @@ Day 3 的开发工作虽然遇到了多个技术问题,但最终成功完成 + + + diff --git a/docs/03-业务模块/IIT Manager Agent/06-开发记录/Phase1.5-AI对话集成REDCap完成记录.md b/docs/03-业务模块/IIT Manager Agent/06-开发记录/Phase1.5-AI对话集成REDCap完成记录.md index 45b156f9..e55e47d2 100644 --- a/docs/03-业务模块/IIT Manager Agent/06-开发记录/Phase1.5-AI对话集成REDCap完成记录.md +++ b/docs/03-业务模块/IIT Manager Agent/06-开发记录/Phase1.5-AI对话集成REDCap完成记录.md @@ -322,3 +322,6 @@ AI: "出生日期:2017-01-04 + + + diff --git a/docs/03-业务模块/IIT Manager Agent/06-开发记录/V1.1更新完成报告.md b/docs/03-业务模块/IIT Manager Agent/06-开发记录/V1.1更新完成报告.md index 1696f818..2df393d4 100644 --- a/docs/03-业务模块/IIT Manager Agent/06-开发记录/V1.1更新完成报告.md +++ b/docs/03-业务模块/IIT Manager Agent/06-开发记录/V1.1更新完成报告.md @@ -266,3 +266,6 @@ Day 4: REDCap EM(Webhook推送)← 作为增强,而非核心 + + + diff --git a/docs/03-业务模块/IIT Manager Agent/07-技术债务/IIT Manager Agent 技术债务清单.md b/docs/03-业务模块/IIT Manager Agent/07-技术债务/IIT Manager Agent 技术债务清单.md index 533e4183..91f2ce05 100644 --- a/docs/03-业务模块/IIT Manager Agent/07-技术债务/IIT Manager Agent 技术债务清单.md +++ b/docs/03-业务模块/IIT Manager Agent/07-技术债务/IIT Manager Agent 技术债务清单.md @@ -680,3 +680,6 @@ const answer = `根据研究方案[1]和CRF表格[2],纳入标准包括: + + + diff --git a/docs/03-业务模块/INST-机构管理端/00-模块当前状态与开发指南.md b/docs/03-业务模块/INST-机构管理端/00-模块当前状态与开发指南.md index 20f03cf6..2a49119f 100644 --- a/docs/03-业务模块/INST-机构管理端/00-模块当前状态与开发指南.md +++ b/docs/03-业务模块/INST-机构管理端/00-模块当前状态与开发指南.md @@ -437,3 +437,6 @@ export const calculateAvailableQuota = async (tenantId: string) => { **🚀 敬请期待!** + + + diff --git a/docs/03-业务模块/INST-机构管理端/README.md b/docs/03-业务模块/INST-机构管理端/README.md index f95b2355..ad7f595d 100644 --- a/docs/03-业务模块/INST-机构管理端/README.md +++ b/docs/03-业务模块/INST-机构管理端/README.md @@ -310,3 +310,6 @@ https://platform.example.com/t/pharma-abc/login *最后更新:2026-01-11* + + + diff --git a/docs/03-业务模块/PKB-个人知识库/06-开发记录/2026-01-07-前端迁移与批处理功能完善.md b/docs/03-业务模块/PKB-个人知识库/06-开发记录/2026-01-07-前端迁移与批处理功能完善.md index 4a300249..bd1c406e 100644 --- a/docs/03-业务模块/PKB-个人知识库/06-开发记录/2026-01-07-前端迁移与批处理功能完善.md +++ b/docs/03-业务模块/PKB-个人知识库/06-开发记录/2026-01-07-前端迁移与批处理功能完善.md @@ -360,3 +360,6 @@ const newResults = resultsData.map((docResult: any) => ({ + + + diff --git a/docs/03-业务模块/PKB-个人知识库/06-开发记录/2026-01-07_PKB模块前端V3设计实现.md b/docs/03-业务模块/PKB-个人知识库/06-开发记录/2026-01-07_PKB模块前端V3设计实现.md index 6253053a..dacd8e21 100644 --- a/docs/03-业务模块/PKB-个人知识库/06-开发记录/2026-01-07_PKB模块前端V3设计实现.md +++ b/docs/03-业务模块/PKB-个人知识库/06-开发记录/2026-01-07_PKB模块前端V3设计实现.md @@ -233,3 +233,6 @@ const chatApi = axios.create({ + + + diff --git a/docs/03-业务模块/Redcap/01-部署与配置/10-REDCap_Docker部署操作手册.md b/docs/03-业务模块/Redcap/01-部署与配置/10-REDCap_Docker部署操作手册.md index 769db96a..0d1af142 100644 --- a/docs/03-业务模块/Redcap/01-部署与配置/10-REDCap_Docker部署操作手册.md +++ b/docs/03-业务模块/Redcap/01-部署与配置/10-REDCap_Docker部署操作手册.md @@ -770,3 +770,6 @@ docker exec redcap-apache php /tmp/create-redcap-password.php + + + diff --git a/docs/03-业务模块/Redcap/README.md b/docs/03-业务模块/Redcap/README.md index d6cac4c2..29e1560e 100644 --- a/docs/03-业务模块/Redcap/README.md +++ b/docs/03-业务模块/Redcap/README.md @@ -152,3 +152,6 @@ AIclinicalresearch/redcap-docker-dev/ + + + diff --git a/docs/04-开发规范/09-数据库开发规范.md b/docs/04-开发规范/09-数据库开发规范.md index 678eab66..0390b6ae 100644 --- a/docs/04-开发规范/09-数据库开发规范.md +++ b/docs/04-开发规范/09-数据库开发规范.md @@ -318,3 +318,6 @@ npx tsx check_iit_asl_data.ts 详见:`docs/08-项目管理/2026-01-11-数据库事故总结.md` + + + diff --git a/docs/04-开发规范/10-模块认证规范.md b/docs/04-开发规范/10-模块认证规范.md index b0c6c1e7..37d9680a 100644 --- a/docs/04-开发规范/10-模块认证规范.md +++ b/docs/04-开发规范/10-模块认证规范.md @@ -188,3 +188,4 @@ interface DecodedToken { - 后端 JWT 服务: `backend/src/common/auth/jwt.service.ts` + diff --git a/docs/05-部署文档/02-SAE部署完全指南(产品经理版).md b/docs/05-部署文档/02-SAE部署完全指南(产品经理版).md index 3a94a3f3..77439928 100644 --- a/docs/05-部署文档/02-SAE部署完全指南(产品经理版).md +++ b/docs/05-部署文档/02-SAE部署完全指南(产品经理版).md @@ -885,6 +885,9 @@ ACR镜像仓库: + + + diff --git a/docs/05-部署文档/07-前端Nginx-SAE部署操作手册.md b/docs/05-部署文档/07-前端Nginx-SAE部署操作手册.md index ea4705cd..756c045b 100644 --- a/docs/05-部署文档/07-前端Nginx-SAE部署操作手册.md +++ b/docs/05-部署文档/07-前端Nginx-SAE部署操作手册.md @@ -1372,6 +1372,9 @@ SAE应用配置: + + + diff --git a/docs/05-部署文档/08-PostgreSQL数据库部署操作手册.md b/docs/05-部署文档/08-PostgreSQL数据库部署操作手册.md index 570b9f2e..3797d1e9 100644 --- a/docs/05-部署文档/08-PostgreSQL数据库部署操作手册.md +++ b/docs/05-部署文档/08-PostgreSQL数据库部署操作手册.md @@ -1188,6 +1188,9 @@ docker exec -e PGPASSWORD="密码" ai-clinical-postgres psql -h RDS地址 -U air + + + diff --git a/docs/05-部署文档/10-Node.js后端-Docker镜像构建手册.md b/docs/05-部署文档/10-Node.js后端-Docker镜像构建手册.md index a7f5911f..b31afcfd 100644 --- a/docs/05-部署文档/10-Node.js后端-Docker镜像构建手册.md +++ b/docs/05-部署文档/10-Node.js后端-Docker镜像构建手册.md @@ -599,6 +599,9 @@ scripts/*.ts + + + diff --git a/docs/05-部署文档/11-Node.js后端-SAE部署配置清单.md b/docs/05-部署文档/11-Node.js后端-SAE部署配置清单.md index c159331b..9a57bbfa 100644 --- a/docs/05-部署文档/11-Node.js后端-SAE部署配置清单.md +++ b/docs/05-部署文档/11-Node.js后端-SAE部署配置清单.md @@ -287,6 +287,9 @@ Node.js后端部署成功后: + + + diff --git a/docs/05-部署文档/12-Node.js后端-SAE部署操作手册.md b/docs/05-部署文档/12-Node.js后端-SAE部署操作手册.md index d299eb2e..2572eb20 100644 --- a/docs/05-部署文档/12-Node.js后端-SAE部署操作手册.md +++ b/docs/05-部署文档/12-Node.js后端-SAE部署操作手册.md @@ -510,6 +510,9 @@ Node.js后端 (SAE) ← http://172.17.173.88:3001 + + + diff --git a/docs/05-部署文档/13-Node.js后端-镜像修复记录.md b/docs/05-部署文档/13-Node.js后端-镜像修复记录.md index 5fdaa791..31e6af68 100644 --- a/docs/05-部署文档/13-Node.js后端-镜像修复记录.md +++ b/docs/05-部署文档/13-Node.js后端-镜像修复记录.md @@ -225,6 +225,9 @@ curl http://localhost:3001/health + + + diff --git a/docs/05-部署文档/14-Node.js后端-pino-pretty问题修复.md b/docs/05-部署文档/14-Node.js后端-pino-pretty问题修复.md index 1d905b5d..d55a14b7 100644 --- a/docs/05-部署文档/14-Node.js后端-pino-pretty问题修复.md +++ b/docs/05-部署文档/14-Node.js后端-pino-pretty问题修复.md @@ -263,6 +263,9 @@ npm run dev + + + diff --git a/docs/05-部署文档/16-前端Nginx-部署成功总结.md b/docs/05-部署文档/16-前端Nginx-部署成功总结.md index 594239ca..2885004e 100644 --- a/docs/05-部署文档/16-前端Nginx-部署成功总结.md +++ b/docs/05-部署文档/16-前端Nginx-部署成功总结.md @@ -487,6 +487,9 @@ pgm-2zex1m2y3r23hdn5.pg.rds.aliyuncs.com:5432 + + + diff --git a/docs/05-部署文档/17-完整部署实战手册-2025版.md b/docs/05-部署文档/17-完整部署实战手册-2025版.md index d82a3f50..8dc14ea4 100644 --- a/docs/05-部署文档/17-完整部署实战手册-2025版.md +++ b/docs/05-部署文档/17-完整部署实战手册-2025版.md @@ -1815,6 +1815,9 @@ curl http://8.140.53.236/ + + + diff --git a/docs/05-部署文档/18-部署文档使用指南.md b/docs/05-部署文档/18-部署文档使用指南.md index 0cb43123..de7b857f 100644 --- a/docs/05-部署文档/18-部署文档使用指南.md +++ b/docs/05-部署文档/18-部署文档使用指南.md @@ -363,6 +363,9 @@ crpi-cd5ij4pjt65mweeo.cn-beijing.personal.cr.aliyuncs.com/ai-clinical/backend-se + + + diff --git a/docs/05-部署文档/19-日常更新快速操作手册.md b/docs/05-部署文档/19-日常更新快速操作手册.md index 8252094c..569062e8 100644 --- a/docs/05-部署文档/19-日常更新快速操作手册.md +++ b/docs/05-部署文档/19-日常更新快速操作手册.md @@ -685,6 +685,9 @@ docker login --username=gofeng117@163.com \ + + + diff --git a/docs/05-部署文档/文档修正报告-20251214.md b/docs/05-部署文档/文档修正报告-20251214.md index 21d5d676..95821522 100644 --- a/docs/05-部署文档/文档修正报告-20251214.md +++ b/docs/05-部署文档/文档修正报告-20251214.md @@ -496,6 +496,9 @@ NAT网关成本¥100/月,对初创团队是一笔开销 + + + diff --git a/docs/07-运维文档/03-SAE环境变量配置指南.md b/docs/07-运维文档/03-SAE环境变量配置指南.md index 4b7f2d1f..e48aedf8 100644 --- a/docs/07-运维文档/03-SAE环境变量配置指南.md +++ b/docs/07-运维文档/03-SAE环境变量配置指南.md @@ -401,6 +401,9 @@ curl http://你的SAE地址:3001/health + + + diff --git a/docs/07-运维文档/05-Redis缓存与队列的区别说明.md b/docs/07-运维文档/05-Redis缓存与队列的区别说明.md index 462db661..8d0b04a7 100644 --- a/docs/07-运维文档/05-Redis缓存与队列的区别说明.md +++ b/docs/07-运维文档/05-Redis缓存与队列的区别说明.md @@ -733,6 +733,9 @@ const job = await queue.getJob(jobId); + + + diff --git a/docs/07-运维文档/06-长时间任务可靠性分析.md b/docs/07-运维文档/06-长时间任务可靠性分析.md index 8f2d9fcf..6821e7b4 100644 --- a/docs/07-运维文档/06-长时间任务可靠性分析.md +++ b/docs/07-运维文档/06-长时间任务可靠性分析.md @@ -500,6 +500,9 @@ processLiteraturesInBackground(task.id, projectId, testLiteratures); + + + diff --git a/docs/07-运维文档/07-Redis使用需求分析(按模块).md b/docs/07-运维文档/07-Redis使用需求分析(按模块).md index 94fb7c47..9ec25980 100644 --- a/docs/07-运维文档/07-Redis使用需求分析(按模块).md +++ b/docs/07-运维文档/07-Redis使用需求分析(按模块).md @@ -977,6 +977,9 @@ ROI = (¥22,556 - ¥144) / ¥144 × 100% = 15,564% + + + diff --git a/docs/08-项目管理/03-每周计划/2025-12-13-Postgres-Only架构改造完成.md b/docs/08-项目管理/03-每周计划/2025-12-13-Postgres-Only架构改造完成.md index 02c6d1cd..12035699 100644 --- a/docs/08-项目管理/03-每周计划/2025-12-13-Postgres-Only架构改造完成.md +++ b/docs/08-项目管理/03-每周计划/2025-12-13-Postgres-Only架构改造完成.md @@ -1034,6 +1034,9 @@ Redis 实例:¥500/月 + + + diff --git a/docs/08-项目管理/05-技术债务/通用对话服务抽取计划.md b/docs/08-项目管理/05-技术债务/通用对话服务抽取计划.md index a376a4a3..bde392f7 100644 --- a/docs/08-项目管理/05-技术债务/通用对话服务抽取计划.md +++ b/docs/08-项目管理/05-技术债务/通用对话服务抽取计划.md @@ -492,6 +492,9 @@ import { ChatContainer } from '@/shared/components/Chat'; + + + diff --git a/docs/08-项目管理/2026-01-11-数据库事故总结.md b/docs/08-项目管理/2026-01-11-数据库事故总结.md index 8784cbc9..34514672 100644 --- a/docs/08-项目管理/2026-01-11-数据库事故总结.md +++ b/docs/08-项目管理/2026-01-11-数据库事故总结.md @@ -202,3 +202,6 @@ VALUES ('user-mock-001', '13800000000', ..., 'tenant-mock-001', ...); > **声明**:本次事故发生在测试环境,未影响生产数据。但暴露的问题同样可能在生产环境发生,需要高度重视。 + + + diff --git a/docs/08-项目管理/PKB前端问题修复报告.md b/docs/08-项目管理/PKB前端问题修复报告.md index 6e05897d..2db83b5c 100644 --- a/docs/08-项目管理/PKB前端问题修复报告.md +++ b/docs/08-项目管理/PKB前端问题修复报告.md @@ -414,3 +414,6 @@ frontend-v2/src/modules/pkb/ + + + diff --git a/docs/08-项目管理/PKB前端验证指南.md b/docs/08-项目管理/PKB前端验证指南.md index 0e732374..ea27627f 100644 --- a/docs/08-项目管理/PKB前端验证指南.md +++ b/docs/08-项目管理/PKB前端验证指南.md @@ -276,3 +276,6 @@ npm run dev + + + diff --git a/docs/08-项目管理/PKB功能审查报告-阶段0.md b/docs/08-项目管理/PKB功能审查报告-阶段0.md index 1430308c..09ea821d 100644 --- a/docs/08-项目管理/PKB功能审查报告-阶段0.md +++ b/docs/08-项目管理/PKB功能审查报告-阶段0.md @@ -791,3 +791,6 @@ AIA智能问答模块 + + + diff --git a/docs/08-项目管理/PKB和RVW功能迁移计划.md b/docs/08-项目管理/PKB和RVW功能迁移计划.md index debdb9d3..9bdce0a0 100644 --- a/docs/08-项目管理/PKB和RVW功能迁移计划.md +++ b/docs/08-项目管理/PKB和RVW功能迁移计划.md @@ -933,6 +933,9 @@ CREATE INDEX idx_rvw_tasks_created_at ON rvw_schema.review_tasks(created_at); + + + diff --git a/docs/08-项目管理/PKB精细化优化报告.md b/docs/08-项目管理/PKB精细化优化报告.md index 4ba3ac40..9f48c53f 100644 --- a/docs/08-项目管理/PKB精细化优化报告.md +++ b/docs/08-项目管理/PKB精细化优化报告.md @@ -589,3 +589,6 @@ const typography = { + + + diff --git a/docs/08-项目管理/PKB迁移-超级安全执行计划.md b/docs/08-项目管理/PKB迁移-超级安全执行计划.md index 8fe80a0f..f889aab6 100644 --- a/docs/08-项目管理/PKB迁移-超级安全执行计划.md +++ b/docs/08-项目管理/PKB迁移-超级安全执行计划.md @@ -901,3 +901,6 @@ app.use('/api/v1/knowledge', (req, res) => { + + + diff --git a/docs/08-项目管理/PKB迁移-阶段1完成报告.md b/docs/08-项目管理/PKB迁移-阶段1完成报告.md index d2efbd0f..1b807c8e 100644 --- a/docs/08-项目管理/PKB迁移-阶段1完成报告.md +++ b/docs/08-项目管理/PKB迁移-阶段1完成报告.md @@ -215,3 +215,6 @@ rm -rf src/modules/pkb + + + diff --git a/docs/08-项目管理/PKB迁移-阶段2完成报告.md b/docs/08-项目管理/PKB迁移-阶段2完成报告.md index e4988c7e..f8009fe3 100644 --- a/docs/08-项目管理/PKB迁移-阶段2完成报告.md +++ b/docs/08-项目管理/PKB迁移-阶段2完成报告.md @@ -390,3 +390,6 @@ GET /api/v2/pkb/batch-tasks/batch/templates + + + diff --git a/docs/08-项目管理/PKB迁移-阶段2进行中.md b/docs/08-项目管理/PKB迁移-阶段2进行中.md index 6a1fed6c..19c70521 100644 --- a/docs/08-项目管理/PKB迁移-阶段2进行中.md +++ b/docs/08-项目管理/PKB迁移-阶段2进行中.md @@ -34,3 +34,6 @@ import pkbRoutes from './modules/pkb/routes/index.js'; + + + diff --git a/docs/08-项目管理/PKB迁移-阶段3完成报告.md b/docs/08-项目管理/PKB迁移-阶段3完成报告.md index d2db6f45..1786f0ac 100644 --- a/docs/08-项目管理/PKB迁移-阶段3完成报告.md +++ b/docs/08-项目管理/PKB迁移-阶段3完成报告.md @@ -303,3 +303,6 @@ backend/ + + + diff --git a/docs/08-项目管理/PKB迁移-阶段4完成报告.md b/docs/08-项目管理/PKB迁移-阶段4完成报告.md index bb52d0f7..74ee6c18 100644 --- a/docs/08-项目管理/PKB迁移-阶段4完成报告.md +++ b/docs/08-项目管理/PKB迁移-阶段4完成报告.md @@ -514,3 +514,6 @@ const response = await fetch('/api/v2/pkb/batch-tasks/batch/execute', { + + + diff --git a/extraction_service/.dockerignore b/extraction_service/.dockerignore index 0ca1e34e..81127fb2 100644 --- a/extraction_service/.dockerignore +++ b/extraction_service/.dockerignore @@ -67,6 +67,9 @@ models/ + + + diff --git a/extraction_service/operations/__init__.py b/extraction_service/operations/__init__.py index b5f0d66e..0920da11 100644 --- a/extraction_service/operations/__init__.py +++ b/extraction_service/operations/__init__.py @@ -55,6 +55,9 @@ __version__ = '1.0.0' + + + diff --git a/extraction_service/operations/dropna.py b/extraction_service/operations/dropna.py index a50ddd3b..2efae6d9 100644 --- a/extraction_service/operations/dropna.py +++ b/extraction_service/operations/dropna.py @@ -188,6 +188,9 @@ def get_missing_summary(df: pd.DataFrame) -> dict: + + + diff --git a/extraction_service/operations/filter.py b/extraction_service/operations/filter.py index f2e12381..540d1428 100644 --- a/extraction_service/operations/filter.py +++ b/extraction_service/operations/filter.py @@ -148,6 +148,9 @@ def apply_filter( + + + diff --git a/extraction_service/operations/unpivot.py b/extraction_service/operations/unpivot.py index f8e5f09b..72b25b7d 100644 --- a/extraction_service/operations/unpivot.py +++ b/extraction_service/operations/unpivot.py @@ -312,6 +312,9 @@ def get_unpivot_preview( + + + diff --git a/extraction_service/test_dc_api.py b/extraction_service/test_dc_api.py index fc040b13..af1c2ec7 100644 --- a/extraction_service/test_dc_api.py +++ b/extraction_service/test_dc_api.py @@ -322,6 +322,9 @@ if __name__ == "__main__": + + + diff --git a/extraction_service/test_execute_simple.py b/extraction_service/test_execute_simple.py index 0e9a8364..5b4db083 100644 --- a/extraction_service/test_execute_simple.py +++ b/extraction_service/test_execute_simple.py @@ -88,6 +88,9 @@ except Exception as e: + + + diff --git a/extraction_service/test_module.py b/extraction_service/test_module.py index 20063bf1..2f23cc25 100644 --- a/extraction_service/test_module.py +++ b/extraction_service/test_module.py @@ -68,6 +68,9 @@ except Exception as e: + + + diff --git a/frontend-v2/.dockerignore b/frontend-v2/.dockerignore index d866dca6..93400a8d 100644 --- a/frontend-v2/.dockerignore +++ b/frontend-v2/.dockerignore @@ -87,6 +87,9 @@ vite.config.*.timestamp-* + + + diff --git a/frontend-v2/docker-entrypoint.sh b/frontend-v2/docker-entrypoint.sh index 21c78b95..1fa61542 100644 --- a/frontend-v2/docker-entrypoint.sh +++ b/frontend-v2/docker-entrypoint.sh @@ -54,6 +54,9 @@ exec nginx -g 'daemon off;' + + + diff --git a/frontend-v2/nginx.conf b/frontend-v2/nginx.conf index 6ff19b22..8b288c32 100644 --- a/frontend-v2/nginx.conf +++ b/frontend-v2/nginx.conf @@ -210,6 +210,9 @@ http { + + + diff --git a/frontend-v2/src/common/api/axios.ts b/frontend-v2/src/common/api/axios.ts index daaaf5d8..97decff0 100644 --- a/frontend-v2/src/common/api/axios.ts +++ b/frontend-v2/src/common/api/axios.ts @@ -43,3 +43,4 @@ apiClient.interceptors.response.use( export default apiClient; + diff --git a/frontend-v2/src/framework/auth/AuthContext.tsx b/frontend-v2/src/framework/auth/AuthContext.tsx index 61c2e800..5ca56e06 100644 --- a/frontend-v2/src/framework/auth/AuthContext.tsx +++ b/frontend-v2/src/framework/auth/AuthContext.tsx @@ -204,3 +204,6 @@ export function useAuth(): AuthContextType { export { AuthContext }; + + + diff --git a/frontend-v2/src/framework/auth/api.ts b/frontend-v2/src/framework/auth/api.ts index 59f696bd..e2ff1784 100644 --- a/frontend-v2/src/framework/auth/api.ts +++ b/frontend-v2/src/framework/auth/api.ts @@ -240,3 +240,6 @@ export async function logout(): Promise { } } + + + diff --git a/frontend-v2/src/framework/auth/index.ts b/frontend-v2/src/framework/auth/index.ts index 83c5bbf1..f5d81be2 100644 --- a/frontend-v2/src/framework/auth/index.ts +++ b/frontend-v2/src/framework/auth/index.ts @@ -6,3 +6,6 @@ export { AuthProvider, useAuth, AuthContext } from './AuthContext'; export * from './types'; export * from './api'; + + + diff --git a/frontend-v2/src/framework/auth/moduleApi.ts b/frontend-v2/src/framework/auth/moduleApi.ts index cc120988..c3835b59 100644 --- a/frontend-v2/src/framework/auth/moduleApi.ts +++ b/frontend-v2/src/framework/auth/moduleApi.ts @@ -32,3 +32,4 @@ export async function fetchUserModules(): Promise { return result.data || []; } + diff --git a/frontend-v2/src/framework/auth/types.ts b/frontend-v2/src/framework/auth/types.ts index 9a2fbe95..7b1cf5a1 100644 --- a/frontend-v2/src/framework/auth/types.ts +++ b/frontend-v2/src/framework/auth/types.ts @@ -99,3 +99,6 @@ export interface AuthContextType extends AuthState { hasRole: (...roles: UserRole[]) => boolean; } + + + diff --git a/frontend-v2/src/modules/asl/api/index.ts b/frontend-v2/src/modules/asl/api/index.ts index 4b0f14be..88ef9769 100644 --- a/frontend-v2/src/modules/asl/api/index.ts +++ b/frontend-v2/src/modules/asl/api/index.ts @@ -14,10 +14,25 @@ import type { PaginatedResponse, ProjectStatistics } from '../types'; +import { getAccessToken } from '../../../framework/auth/api'; // API基础URL const API_BASE_URL = '/api/v1/asl'; +/** + * 获取带认证的请求头 + */ +function getAuthHeaders(): HeadersInit { + const headers: Record = { + 'Content-Type': 'application/json', + }; + const token = getAccessToken(); + if (token) { + headers['Authorization'] = `Bearer ${token}`; + } + return headers; +} + // 通用请求函数 async function request( url: string, @@ -26,7 +41,7 @@ async function request( const response = await fetch(`${API_BASE_URL}${url}`, { ...options, headers: { - 'Content-Type': 'application/json', + ...getAuthHeaders(), ...options?.headers, }, }); @@ -239,7 +254,8 @@ export async function exportScreeningResults( ).toString(); const response = await fetch( - `${API_BASE_URL}/projects/${projectId}/screening/results/export?${queryString}` + `${API_BASE_URL}/projects/${projectId}/screening/results/export?${queryString}`, + { headers: getAuthHeaders() } ); if (!response.ok) { @@ -409,7 +425,8 @@ export async function exportFulltextResults( taskId: string ): Promise { const response = await fetch( - `${API_BASE_URL}/fulltext-screening/tasks/${taskId}/export` + `${API_BASE_URL}/fulltext-screening/tasks/${taskId}/export`, + { headers: getAuthHeaders() } ); if (!response.ok) { diff --git a/frontend-v2/src/modules/asl/components/FulltextDetailDrawer.tsx b/frontend-v2/src/modules/asl/components/FulltextDetailDrawer.tsx index 403bbf77..ec451623 100644 --- a/frontend-v2/src/modules/asl/components/FulltextDetailDrawer.tsx +++ b/frontend-v2/src/modules/asl/components/FulltextDetailDrawer.tsx @@ -557,6 +557,9 @@ export default FulltextDetailDrawer; + + + diff --git a/frontend-v2/src/modules/dc/api/toolB.ts b/frontend-v2/src/modules/dc/api/toolB.ts index 7856656e..6d2d197b 100644 --- a/frontend-v2/src/modules/dc/api/toolB.ts +++ b/frontend-v2/src/modules/dc/api/toolB.ts @@ -3,8 +3,24 @@ * 病历结构化机器人 API调用 */ +import { getAccessToken } from '../../../framework/auth/api'; + const API_BASE = '/api/v1/dc/tool-b'; +/** + * 获取带认证的请求头 + */ +function getAuthHeaders(): HeadersInit { + const headers: Record = { + 'Content-Type': 'application/json', + }; + const token = getAccessToken(); + if (token) { + headers['Authorization'] = `Bearer ${token}`; + } + return headers; +} + export interface UploadFileResponse { fileKey: string; url: string; @@ -86,8 +102,16 @@ export async function uploadFile(file: File): Promise { const formData = new FormData(); formData.append('file', file); + // 文件上传不设置 Content-Type,让浏览器自动设置 multipart/form-data + const token = getAccessToken(); + const headers: HeadersInit = {}; + if (token) { + headers['Authorization'] = `Bearer ${token}`; + } + const response = await fetch(`${API_BASE}/upload`, { method: 'POST', + headers, body: formData, }); @@ -110,7 +134,7 @@ export async function uploadFile(file: File): Promise { export async function healthCheck(request: HealthCheckRequest): Promise { const response = await fetch(`${API_BASE}/health-check`, { method: 'POST', - headers: { 'Content-Type': 'application/json' }, + headers: getAuthHeaders(), body: JSON.stringify(request), }); @@ -136,7 +160,9 @@ export async function healthCheck(request: HealthCheckRequest): Promise { - const response = await fetch(`${API_BASE}/templates`); + const response = await fetch(`${API_BASE}/templates`, { + headers: getAuthHeaders(), + }); if (!response.ok) { throw new Error(`Get templates failed: ${response.statusText}`); @@ -152,7 +178,7 @@ export async function getTemplates(): Promise { export async function createTask(request: CreateTaskRequest): Promise { const response = await fetch(`${API_BASE}/tasks`, { method: 'POST', - headers: { 'Content-Type': 'application/json' }, + headers: getAuthHeaders(), body: JSON.stringify(request), }); @@ -168,7 +194,9 @@ export async function createTask(request: CreateTaskRequest): Promise { - const response = await fetch(`${API_BASE}/tasks/${taskId}/progress`); + const response = await fetch(`${API_BASE}/tasks/${taskId}/progress`, { + headers: getAuthHeaders(), + }); if (!response.ok) { throw new Error(`Get task progress failed: ${response.statusText}`); @@ -182,7 +210,9 @@ export async function getTaskProgress(taskId: string): Promise { * 获取验证网格数据 */ export async function getTaskItems(taskId: string): Promise<{ items: ExtractionItem[] }> { - const response = await fetch(`${API_BASE}/tasks/${taskId}/items`); + const response = await fetch(`${API_BASE}/tasks/${taskId}/items`, { + headers: getAuthHeaders(), + }); if (!response.ok) { throw new Error(`Get task items failed: ${response.statusText}`); @@ -202,7 +232,7 @@ export async function resolveConflict( ): Promise<{ success: boolean }> { const response = await fetch(`${API_BASE}/items/${itemId}/resolve`, { method: 'POST', - headers: { 'Content-Type': 'application/json' }, + headers: getAuthHeaders(), body: JSON.stringify({ field: fieldName, chosenValue: value }), // 🔑 后端期望field而非fieldName }); @@ -220,7 +250,9 @@ export async function resolveConflict( export async function exportResults(taskId: string): Promise { console.log('[Export] Starting export for taskId:', taskId); - const response = await fetch(`${API_BASE}/tasks/${taskId}/export`); + const response = await fetch(`${API_BASE}/tasks/${taskId}/export`, { + headers: getAuthHeaders(), + }); console.log('[Export] Response status:', response.status, response.statusText); console.log('[Export] Response headers:', { diff --git a/frontend-v2/src/modules/dc/api/toolC.ts b/frontend-v2/src/modules/dc/api/toolC.ts index f300006f..5821f2a2 100644 --- a/frontend-v2/src/modules/dc/api/toolC.ts +++ b/frontend-v2/src/modules/dc/api/toolC.ts @@ -6,7 +6,7 @@ * - AI功能:生成代码、执行代码、一步到位处理、获取历史 */ -import axios from 'axios'; +import apiClient from '../../../common/api/axios'; const BASE_URL = '/api/v1/dc/tool-c'; @@ -90,7 +90,7 @@ export const uploadFile = async (file: File): Promise => { const formData = new FormData(); formData.append('file', file); - const response = await axios.post(`${BASE_URL}/sessions/upload`, formData, { + const response = await apiClient.post(`${BASE_URL}/sessions/upload`, formData, { headers: { 'Content-Type': 'multipart/form-data' }, timeout: 30000, // 30秒超时 }); @@ -102,7 +102,7 @@ export const uploadFile = async (file: File): Promise => { * 获取Session元数据 */ export const getSession = async (sessionId: string): Promise => { - const response = await axios.get(`${BASE_URL}/sessions/${sessionId}`); + const response = await apiClient.get(`${BASE_URL}/sessions/${sessionId}`); return response.data; }; @@ -110,7 +110,7 @@ export const getSession = async (sessionId: string): Promise => { * 获取预览数据(⭐ 已改为全量加载) */ export const getPreviewData = async (sessionId: string): Promise => { - const response = await axios.get(`${BASE_URL}/sessions/${sessionId}/preview`); + const response = await apiClient.get(`${BASE_URL}/sessions/${sessionId}/preview`); return response.data; }; @@ -118,7 +118,7 @@ export const getPreviewData = async (sessionId: string): Promise => * 获取完整数据 */ export const getFullData = async (sessionId: string): Promise => { - const response = await axios.get(`${BASE_URL}/sessions/${sessionId}/full`); + const response = await apiClient.get(`${BASE_URL}/sessions/${sessionId}/full`); return response.data; }; @@ -126,7 +126,7 @@ export const getFullData = async (sessionId: string): Promise => { * 更新心跳(延长10分钟) */ export const updateHeartbeat = async (sessionId: string): Promise<{ success: boolean }> => { - const response = await axios.post(`${BASE_URL}/sessions/${sessionId}/heartbeat`); + const response = await apiClient.post(`${BASE_URL}/sessions/${sessionId}/heartbeat`); return response.data; }; @@ -134,7 +134,7 @@ export const updateHeartbeat = async (sessionId: string): Promise<{ success: boo * 删除Session */ export const deleteSession = async (sessionId: string): Promise<{ success: boolean }> => { - const response = await axios.delete(`${BASE_URL}/sessions/${sessionId}`); + const response = await apiClient.delete(`${BASE_URL}/sessions/${sessionId}`); return response.data; }; @@ -154,7 +154,7 @@ export const generateCode = async ( messageId: string; }; }> => { - const response = await axios.post(`${BASE_URL}/ai/generate`, { + const response = await apiClient.post(`${BASE_URL}/ai/generate`, { sessionId, message, }); @@ -176,7 +176,7 @@ export const executeCode = async ( } | null; error?: string; }> => { - const response = await axios.post(`${BASE_URL}/ai/execute`, { + const response = await apiClient.post(`${BASE_URL}/ai/execute`, { sessionId, code, messageId, @@ -192,7 +192,7 @@ export const processMessage = async ( message: string, maxRetries: number = 3 ): Promise => { - const response = await axios.post( + const response = await apiClient.post( `${BASE_URL}/ai/process`, { sessionId, @@ -213,7 +213,7 @@ export const getChatHistory = async ( sessionId: string, limit: number = 10 ): Promise => { - const response = await axios.get(`${BASE_URL}/ai/history/${sessionId}?limit=${limit}`); + const response = await apiClient.get(`${BASE_URL}/ai/history/${sessionId}?limit=${limit}`); return response.data; }; @@ -238,7 +238,7 @@ export const getSessionStatus = async ( }; }> => { const params = jobId ? { jobId } : {}; - const response = await axios.get(`${BASE_URL}/sessions/${sessionId}/status`, { params }); + const response = await apiClient.get(`${BASE_URL}/sessions/${sessionId}/status`, { params }); return response.data; }; diff --git a/frontend-v2/src/modules/dc/hooks/useAssets.ts b/frontend-v2/src/modules/dc/hooks/useAssets.ts index e3458afe..edd5c23e 100644 --- a/frontend-v2/src/modules/dc/hooks/useAssets.ts +++ b/frontend-v2/src/modules/dc/hooks/useAssets.ts @@ -150,6 +150,9 @@ export const useAssets = (activeTab: AssetTabType) => { + + + diff --git a/frontend-v2/src/modules/dc/hooks/useRecentTasks.ts b/frontend-v2/src/modules/dc/hooks/useRecentTasks.ts index 71f3ff50..8ad9e0de 100644 --- a/frontend-v2/src/modules/dc/hooks/useRecentTasks.ts +++ b/frontend-v2/src/modules/dc/hooks/useRecentTasks.ts @@ -140,6 +140,9 @@ export const useRecentTasks = () => { + + + diff --git a/frontend-v2/src/modules/dc/pages/tool-c/components/DropnaDialog.tsx b/frontend-v2/src/modules/dc/pages/tool-c/components/DropnaDialog.tsx index 727b4ef9..1596a17e 100644 --- a/frontend-v2/src/modules/dc/pages/tool-c/components/DropnaDialog.tsx +++ b/frontend-v2/src/modules/dc/pages/tool-c/components/DropnaDialog.tsx @@ -339,6 +339,9 @@ export default DropnaDialog; + + + diff --git a/frontend-v2/src/modules/dc/pages/tool-c/components/MetricTimePanel.tsx b/frontend-v2/src/modules/dc/pages/tool-c/components/MetricTimePanel.tsx index 4bf79e56..29fda690 100644 --- a/frontend-v2/src/modules/dc/pages/tool-c/components/MetricTimePanel.tsx +++ b/frontend-v2/src/modules/dc/pages/tool-c/components/MetricTimePanel.tsx @@ -424,6 +424,9 @@ export default MetricTimePanel; + + + diff --git a/frontend-v2/src/modules/dc/pages/tool-c/components/PivotPanel.tsx b/frontend-v2/src/modules/dc/pages/tool-c/components/PivotPanel.tsx index ef628685..25135ff1 100644 --- a/frontend-v2/src/modules/dc/pages/tool-c/components/PivotPanel.tsx +++ b/frontend-v2/src/modules/dc/pages/tool-c/components/PivotPanel.tsx @@ -310,6 +310,9 @@ export default PivotPanel; + + + diff --git a/frontend-v2/src/modules/dc/pages/tool-c/hooks/useSessionStatus.ts b/frontend-v2/src/modules/dc/pages/tool-c/hooks/useSessionStatus.ts index 567ef38d..d0eb5fc5 100644 --- a/frontend-v2/src/modules/dc/pages/tool-c/hooks/useSessionStatus.ts +++ b/frontend-v2/src/modules/dc/pages/tool-c/hooks/useSessionStatus.ts @@ -110,6 +110,9 @@ export function useSessionStatus({ + + + diff --git a/frontend-v2/src/modules/dc/pages/tool-c/types/index.ts b/frontend-v2/src/modules/dc/pages/tool-c/types/index.ts index 6784ccc9..05f8c161 100644 --- a/frontend-v2/src/modules/dc/pages/tool-c/types/index.ts +++ b/frontend-v2/src/modules/dc/pages/tool-c/types/index.ts @@ -102,6 +102,9 @@ export interface DataStats { + + + diff --git a/frontend-v2/src/modules/dc/types/portal.ts b/frontend-v2/src/modules/dc/types/portal.ts index 7a69e20f..d20e634d 100644 --- a/frontend-v2/src/modules/dc/types/portal.ts +++ b/frontend-v2/src/modules/dc/types/portal.ts @@ -98,6 +98,9 @@ export type AssetTabType = 'all' | 'processed' | 'raw'; + + + diff --git a/frontend-v2/src/modules/pkb/api/knowledgeBaseApi.ts b/frontend-v2/src/modules/pkb/api/knowledgeBaseApi.ts index 077e76b5..7c6ff332 100644 --- a/frontend-v2/src/modules/pkb/api/knowledgeBaseApi.ts +++ b/frontend-v2/src/modules/pkb/api/knowledgeBaseApi.ts @@ -4,6 +4,7 @@ */ import axios from 'axios'; +import { getAccessToken } from '../../../framework/auth/api'; const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:3000'; @@ -15,6 +16,18 @@ const api = axios.create({ }, }); +// 请求拦截器 - 自动添加 Authorization header +api.interceptors.request.use( + (config) => { + const token = getAccessToken(); + if (token) { + config.headers.Authorization = `Bearer ${token}`; + } + return config; + }, + (error) => Promise.reject(error) +); + /** * 知识库类型定义 */ @@ -221,3 +234,4 @@ export const documentSelectionApi = { + diff --git a/frontend-v2/src/modules/pkb/pages/DashboardPage.tsx b/frontend-v2/src/modules/pkb/pages/DashboardPage.tsx index 0edd84c1..2814d8ea 100644 --- a/frontend-v2/src/modules/pkb/pages/DashboardPage.tsx +++ b/frontend-v2/src/modules/pkb/pages/DashboardPage.tsx @@ -102,7 +102,9 @@ const DashboardPage: React.FC = () => { const handleCreateSubmit = async () => { try { - const kb = await createKnowledgeBase(formData.name, formData.department); + // 后端期望 description 字段,将 department 作为描述的一部分 + const description = `${formData.department || ''}科 知识库`; + const kb = await createKnowledgeBase(formData.name, description); message.success('知识库创建成功!'); setIsModalOpen(false); navigate(`/knowledge-base/workspace/${kb.id}`); @@ -111,32 +113,7 @@ const DashboardPage: React.FC = () => { } }; - // 模拟文件上传 - const simulateUpload = () => { - const newFile = { - id: Math.random().toString(), - name: `New_Clinical_Protocol_v${files.length + 1}.pdf`, - size: "3.5 MB", - status: 'uploading', - progress: 0 - }; - setFiles(prev => [...prev, newFile]); - - let progress = 0; - const interval = setInterval(() => { - progress += 2; - setFiles(prev => prev.map(f => { - if (f.id !== newFile.id) return f; - let status = 'uploading'; - if (progress > 15) status = 'analyzing_layout'; - if (progress > 50) status = 'extracting_table'; - if (progress > 85) status = 'indexing'; - if (progress >= 100) status = 'ready'; - return { ...f, progress: Math.min(progress, 100), status }; - })); - if (progress >= 100) clearInterval(interval); - }, 100); - }; + // 删除模拟上传功能,Step 3留作后续实现真实上传组件 const getStatusText = (status: string) => { switch (status) { @@ -350,14 +327,14 @@ const DashboardPage: React.FC = () => { {createStep === 3 && (
-
- +
+
-

点击上传 PDF 文件

-

支持高清 PDF 及扫描件 (MinerU 深度解析引擎已就绪)

+

上传知识资产

+

知识库创建后,可在工作台中上传文档

+

💡 提示:点击下方"完成"按钮进入工作台,在"知识资产"Tab中上传PDF文档

{files.length > 0 && ( diff --git a/frontend-v2/src/modules/pkb/pages/KnowledgePage.tsx b/frontend-v2/src/modules/pkb/pages/KnowledgePage.tsx index 61036fbb..cd5dbc13 100644 --- a/frontend-v2/src/modules/pkb/pages/KnowledgePage.tsx +++ b/frontend-v2/src/modules/pkb/pages/KnowledgePage.tsx @@ -289,3 +289,6 @@ export default KnowledgePage; + + + diff --git a/frontend-v2/src/modules/pkb/stores/useKnowledgeBaseStore.ts b/frontend-v2/src/modules/pkb/stores/useKnowledgeBaseStore.ts index a2de3d14..cbe62a7e 100644 --- a/frontend-v2/src/modules/pkb/stores/useKnowledgeBaseStore.ts +++ b/frontend-v2/src/modules/pkb/stores/useKnowledgeBaseStore.ts @@ -227,3 +227,6 @@ export const useKnowledgeBaseStore = create((set, get) => ({ + + + diff --git a/frontend-v2/src/modules/pkb/types/workspace.ts b/frontend-v2/src/modules/pkb/types/workspace.ts index b881809f..3d0ac8c8 100644 --- a/frontend-v2/src/modules/pkb/types/workspace.ts +++ b/frontend-v2/src/modules/pkb/types/workspace.ts @@ -44,3 +44,6 @@ export interface BatchTemplate { + + + diff --git a/frontend-v2/src/modules/rvw/api/index.ts b/frontend-v2/src/modules/rvw/api/index.ts index 12771477..b049b315 100644 --- a/frontend-v2/src/modules/rvw/api/index.ts +++ b/frontend-v2/src/modules/rvw/api/index.ts @@ -1,7 +1,7 @@ /** * RVW模块API */ -import axios from 'axios'; +import apiClient from '../../../common/api/axios'; import type { ReviewTask, ReviewReport, ApiResponse, AgentType } from '../types'; const API_BASE = '/api/v2/rvw'; @@ -9,7 +9,7 @@ const API_BASE = '/api/v2/rvw'; // 获取任务列表 export async function getTasks(status?: string): Promise { const params = status && status !== 'all' ? { status } : {}; - const response = await axios.get>(`${API_BASE}/tasks`, { params }); + const response = await apiClient.get>(`${API_BASE}/tasks`, { params }); return response.data.data || []; } @@ -21,7 +21,7 @@ export async function uploadManuscript(file: File, selectedAgents?: AgentType[]) formData.append('selectedAgents', JSON.stringify(selectedAgents)); } - const response = await axios.post>(`${API_BASE}/tasks`, formData, { + const response = await apiClient.post>(`${API_BASE}/tasks`, formData, { headers: { 'Content-Type': 'multipart/form-data' }, }); @@ -34,19 +34,19 @@ export async function uploadManuscript(file: File, selectedAgents?: AgentType[]) // 获取任务详情 export async function getTask(taskId: string): Promise { - const response = await axios.get>(`${API_BASE}/tasks/${taskId}`); + const response = await apiClient.get>(`${API_BASE}/tasks/${taskId}`); return response.data.data!; } // 获取任务报告 export async function getTaskReport(taskId: string): Promise { - const response = await axios.get>(`${API_BASE}/tasks/${taskId}/report`); + const response = await apiClient.get>(`${API_BASE}/tasks/${taskId}/report`); return response.data.data!; } // 运行审查任务(返回jobId供轮询) export async function runTask(taskId: string, agents: AgentType[]): Promise<{ taskId: string; jobId: string }> { - const response = await axios.post>(`${API_BASE}/tasks/${taskId}/run`, { agents }); + const response = await apiClient.post>(`${API_BASE}/tasks/${taskId}/run`, { agents }); if (!response.data.success) { throw new Error(response.data.error || '运行失败'); } @@ -55,7 +55,7 @@ export async function runTask(taskId: string, agents: AgentType[]): Promise<{ ta // 批量运行审查任务 export async function batchRunTasks(taskIds: string[], agents: AgentType[]): Promise { - const response = await axios.post>(`${API_BASE}/tasks/batch/run`, { taskIds, agents }); + const response = await apiClient.post>(`${API_BASE}/tasks/batch/run`, { taskIds, agents }); if (!response.data.success) { throw new Error(response.data.error || '批量运行失败'); } @@ -63,7 +63,7 @@ export async function batchRunTasks(taskIds: string[], agents: AgentType[]): Pro // 删除任务 export async function deleteTask(taskId: string): Promise { - await axios.delete(`${API_BASE}/tasks/${taskId}`); + await apiClient.delete(`${API_BASE}/tasks/${taskId}`); } // 轮询任务状态 @@ -129,3 +129,4 @@ export function formatTime(dateStr: string): string { } + diff --git a/frontend-v2/src/modules/rvw/components/AgentModal.tsx b/frontend-v2/src/modules/rvw/components/AgentModal.tsx index f2acd2b8..7f38b499 100644 --- a/frontend-v2/src/modules/rvw/components/AgentModal.tsx +++ b/frontend-v2/src/modules/rvw/components/AgentModal.tsx @@ -122,3 +122,6 @@ export default function AgentModal({ visible, taskCount, onClose, onConfirm }: A } + + + diff --git a/frontend-v2/src/modules/rvw/components/BatchToolbar.tsx b/frontend-v2/src/modules/rvw/components/BatchToolbar.tsx index 26d64f28..a38d0139 100644 --- a/frontend-v2/src/modules/rvw/components/BatchToolbar.tsx +++ b/frontend-v2/src/modules/rvw/components/BatchToolbar.tsx @@ -42,3 +42,6 @@ export default function BatchToolbar({ selectedCount, onRunBatch, onClearSelecti } + + + diff --git a/frontend-v2/src/modules/rvw/components/FilterChips.tsx b/frontend-v2/src/modules/rvw/components/FilterChips.tsx index 72b9ef9c..0d71e05b 100644 --- a/frontend-v2/src/modules/rvw/components/FilterChips.tsx +++ b/frontend-v2/src/modules/rvw/components/FilterChips.tsx @@ -65,3 +65,6 @@ export default function FilterChips({ filters, counts, onFilterChange }: FilterC } + + + diff --git a/frontend-v2/src/modules/rvw/components/Header.tsx b/frontend-v2/src/modules/rvw/components/Header.tsx index e6fa3d73..1825fa1d 100644 --- a/frontend-v2/src/modules/rvw/components/Header.tsx +++ b/frontend-v2/src/modules/rvw/components/Header.tsx @@ -55,3 +55,6 @@ export default function Header({ onUpload }: HeaderProps) { } + + + diff --git a/frontend-v2/src/modules/rvw/components/ReportDetail.tsx b/frontend-v2/src/modules/rvw/components/ReportDetail.tsx index 685218b6..4c0aaee4 100644 --- a/frontend-v2/src/modules/rvw/components/ReportDetail.tsx +++ b/frontend-v2/src/modules/rvw/components/ReportDetail.tsx @@ -109,3 +109,6 @@ export default function ReportDetail({ report, onBack }: ReportDetailProps) { } + + + diff --git a/frontend-v2/src/modules/rvw/components/ScoreRing.tsx b/frontend-v2/src/modules/rvw/components/ScoreRing.tsx index 5b30d66a..4cb6a192 100644 --- a/frontend-v2/src/modules/rvw/components/ScoreRing.tsx +++ b/frontend-v2/src/modules/rvw/components/ScoreRing.tsx @@ -37,3 +37,6 @@ export default function ScoreRing({ score, size = 'medium', showLabel = true }: } + + + diff --git a/frontend-v2/src/modules/rvw/components/Sidebar.tsx b/frontend-v2/src/modules/rvw/components/Sidebar.tsx index 94c2d930..c8737e47 100644 --- a/frontend-v2/src/modules/rvw/components/Sidebar.tsx +++ b/frontend-v2/src/modules/rvw/components/Sidebar.tsx @@ -72,3 +72,6 @@ export default function Sidebar({ currentView, onViewChange, onSettingsClick }: } + + + diff --git a/frontend-v2/src/modules/rvw/components/index.ts b/frontend-v2/src/modules/rvw/components/index.ts index 78dcb90e..88b70f30 100644 --- a/frontend-v2/src/modules/rvw/components/index.ts +++ b/frontend-v2/src/modules/rvw/components/index.ts @@ -14,3 +14,6 @@ export { default as ReportDetail } from './ReportDetail'; export { default as TaskDetail } from './TaskDetail'; + + + diff --git a/frontend-v2/src/modules/rvw/pages/Dashboard.tsx b/frontend-v2/src/modules/rvw/pages/Dashboard.tsx index 5a23cf82..32aca330 100644 --- a/frontend-v2/src/modules/rvw/pages/Dashboard.tsx +++ b/frontend-v2/src/modules/rvw/pages/Dashboard.tsx @@ -283,3 +283,6 @@ export default function Dashboard() { } + + + diff --git a/frontend-v2/src/modules/rvw/styles/index.css b/frontend-v2/src/modules/rvw/styles/index.css index 4eecca0f..74e64344 100644 --- a/frontend-v2/src/modules/rvw/styles/index.css +++ b/frontend-v2/src/modules/rvw/styles/index.css @@ -232,3 +232,6 @@ } + + + diff --git a/frontend-v2/src/pages/LoginPage.tsx b/frontend-v2/src/pages/LoginPage.tsx index 32b1d15b..a62694ef 100644 --- a/frontend-v2/src/pages/LoginPage.tsx +++ b/frontend-v2/src/pages/LoginPage.tsx @@ -365,3 +365,6 @@ export default function LoginPage() { ); } + + + diff --git a/frontend-v2/src/pages/admin/tenants/TenantListPage.tsx b/frontend-v2/src/pages/admin/tenants/TenantListPage.tsx index 41c8cecb..786bf2b0 100644 --- a/frontend-v2/src/pages/admin/tenants/TenantListPage.tsx +++ b/frontend-v2/src/pages/admin/tenants/TenantListPage.tsx @@ -335,3 +335,4 @@ const TenantListPage = () => { export default TenantListPage; + diff --git a/frontend-v2/src/pages/admin/tenants/api/tenantApi.ts b/frontend-v2/src/pages/admin/tenants/api/tenantApi.ts index 5def64f1..6aac3abf 100644 --- a/frontend-v2/src/pages/admin/tenants/api/tenantApi.ts +++ b/frontend-v2/src/pages/admin/tenants/api/tenantApi.ts @@ -244,3 +244,4 @@ export async function fetchModuleList(): Promise { return result.data; } + diff --git a/frontend-v2/src/shared/components/index.ts b/frontend-v2/src/shared/components/index.ts index 748be852..3bf4b6c0 100644 --- a/frontend-v2/src/shared/components/index.ts +++ b/frontend-v2/src/shared/components/index.ts @@ -53,6 +53,9 @@ export { default as Placeholder } from './Placeholder'; + + + diff --git a/frontend-v2/src/vite-env.d.ts b/frontend-v2/src/vite-env.d.ts index f420505e..826b76d3 100644 --- a/frontend-v2/src/vite-env.d.ts +++ b/frontend-v2/src/vite-env.d.ts @@ -33,6 +33,9 @@ interface ImportMeta { + + + diff --git a/frontend/src/pages/rvw/components/BatchToolbar.tsx b/frontend/src/pages/rvw/components/BatchToolbar.tsx index 6e863ebf..6f231ad6 100644 --- a/frontend/src/pages/rvw/components/BatchToolbar.tsx +++ b/frontend/src/pages/rvw/components/BatchToolbar.tsx @@ -44,3 +44,6 @@ export default function BatchToolbar({ selectedCount, onRunBatch, onClearSelecti + + + diff --git a/frontend/src/pages/rvw/components/EditorialReport.tsx b/frontend/src/pages/rvw/components/EditorialReport.tsx index 2ee4c35a..54217ec8 100644 --- a/frontend/src/pages/rvw/components/EditorialReport.tsx +++ b/frontend/src/pages/rvw/components/EditorialReport.tsx @@ -109,3 +109,6 @@ export default function EditorialReport({ data }: EditorialReportProps) { + + + diff --git a/frontend/src/pages/rvw/components/FilterChips.tsx b/frontend/src/pages/rvw/components/FilterChips.tsx index 3b293d23..3bcf4aca 100644 --- a/frontend/src/pages/rvw/components/FilterChips.tsx +++ b/frontend/src/pages/rvw/components/FilterChips.tsx @@ -67,3 +67,6 @@ export default function FilterChips({ filters, counts, onFilterChange }: FilterC + + + diff --git a/frontend/src/pages/rvw/components/Header.tsx b/frontend/src/pages/rvw/components/Header.tsx index a54cf370..2a7b6d4c 100644 --- a/frontend/src/pages/rvw/components/Header.tsx +++ b/frontend/src/pages/rvw/components/Header.tsx @@ -57,3 +57,6 @@ export default function Header({ onUpload }: HeaderProps) { + + + diff --git a/frontend/src/pages/rvw/components/ReportDetail.tsx b/frontend/src/pages/rvw/components/ReportDetail.tsx index 96f142b0..2a3bf8e4 100644 --- a/frontend/src/pages/rvw/components/ReportDetail.tsx +++ b/frontend/src/pages/rvw/components/ReportDetail.tsx @@ -111,3 +111,6 @@ export default function ReportDetail({ report, onBack }: ReportDetailProps) { + + + diff --git a/frontend/src/pages/rvw/components/ScoreRing.tsx b/frontend/src/pages/rvw/components/ScoreRing.tsx index 556b130d..08baf6a4 100644 --- a/frontend/src/pages/rvw/components/ScoreRing.tsx +++ b/frontend/src/pages/rvw/components/ScoreRing.tsx @@ -39,3 +39,6 @@ export default function ScoreRing({ score, size = 'medium', showLabel = true }: + + + diff --git a/frontend/src/pages/rvw/components/Sidebar.tsx b/frontend/src/pages/rvw/components/Sidebar.tsx index 136190c0..37c3560c 100644 --- a/frontend/src/pages/rvw/components/Sidebar.tsx +++ b/frontend/src/pages/rvw/components/Sidebar.tsx @@ -74,3 +74,6 @@ export default function Sidebar({ currentView, onViewChange, onSettingsClick }: + + + diff --git a/frontend/src/pages/rvw/index.ts b/frontend/src/pages/rvw/index.ts index d1c02bd8..10c042fb 100644 --- a/frontend/src/pages/rvw/index.ts +++ b/frontend/src/pages/rvw/index.ts @@ -8,3 +8,6 @@ export * from './api'; + + + diff --git a/frontend/src/pages/rvw/styles.css b/frontend/src/pages/rvw/styles.css index ab39798d..3c5e9fe2 100644 --- a/frontend/src/pages/rvw/styles.css +++ b/frontend/src/pages/rvw/styles.css @@ -234,3 +234,6 @@ + + + diff --git a/git-cleanup-redcap.ps1 b/git-cleanup-redcap.ps1 index 4b1cc970..5b693c52 100644 --- a/git-cleanup-redcap.ps1 +++ b/git-cleanup-redcap.ps1 @@ -30,3 +30,6 @@ Write-Host "Next step: Run the commit command" -ForegroundColor Cyan + + + diff --git a/git-commit-day1.ps1 b/git-commit-day1.ps1 index 2fdb21c5..4880ba9b 100644 --- a/git-commit-day1.ps1 +++ b/git-commit-day1.ps1 @@ -86,3 +86,6 @@ Write-Host "Git commit and push completed!" -ForegroundColor Green + + + diff --git a/git-fix-lock.ps1 b/git-fix-lock.ps1 index 7d2a00f7..187db4a9 100644 --- a/git-fix-lock.ps1 +++ b/git-fix-lock.ps1 @@ -34,3 +34,6 @@ Write-Host "Now you can run git commands again." -ForegroundColor Cyan + + + diff --git a/python-microservice/operations/__init__.py b/python-microservice/operations/__init__.py index b5f0d66e..0920da11 100644 --- a/python-microservice/operations/__init__.py +++ b/python-microservice/operations/__init__.py @@ -55,6 +55,9 @@ __version__ = '1.0.0' + + + diff --git a/python-microservice/operations/binning.py b/python-microservice/operations/binning.py index 37e99de9..0ed062dd 100644 --- a/python-microservice/operations/binning.py +++ b/python-microservice/operations/binning.py @@ -162,6 +162,9 @@ def apply_binning( + + + diff --git a/python-microservice/operations/filter.py b/python-microservice/operations/filter.py index f2e12381..540d1428 100644 --- a/python-microservice/operations/filter.py +++ b/python-microservice/operations/filter.py @@ -148,6 +148,9 @@ def apply_filter( + + + diff --git a/python-microservice/operations/recode.py b/python-microservice/operations/recode.py index a4125218..5c1818b4 100644 --- a/python-microservice/operations/recode.py +++ b/python-microservice/operations/recode.py @@ -118,6 +118,9 @@ def apply_recode( + + + diff --git a/recover_dc_code.py b/recover_dc_code.py index 92b3806c..76bed937 100644 --- a/recover_dc_code.py +++ b/recover_dc_code.py @@ -262,6 +262,9 @@ if __name__ == "__main__": + + + diff --git a/redcap-docker-dev/.gitattributes b/redcap-docker-dev/.gitattributes index 84cfd5e4..2aedd623 100644 --- a/redcap-docker-dev/.gitattributes +++ b/redcap-docker-dev/.gitattributes @@ -46,3 +46,6 @@ + + + diff --git a/redcap-docker-dev/.gitignore b/redcap-docker-dev/.gitignore index d2d8be21..cdc6358c 100644 --- a/redcap-docker-dev/.gitignore +++ b/redcap-docker-dev/.gitignore @@ -77,3 +77,6 @@ Desktop.ini + + + diff --git a/redcap-docker-dev/README.md b/redcap-docker-dev/README.md index 3c244b15..9e77c75b 100644 --- a/redcap-docker-dev/README.md +++ b/redcap-docker-dev/README.md @@ -378,3 +378,6 @@ docker-compose -f docker-compose.prod.yml up -d + + + diff --git a/redcap-docker-dev/docker-compose.prod.yml b/redcap-docker-dev/docker-compose.prod.yml index 83541fd8..f7667446 100644 --- a/redcap-docker-dev/docker-compose.prod.yml +++ b/redcap-docker-dev/docker-compose.prod.yml @@ -139,3 +139,6 @@ volumes: + + + diff --git a/redcap-docker-dev/docker-compose.yml b/redcap-docker-dev/docker-compose.yml index 3e3caaa1..2874e5f9 100644 --- a/redcap-docker-dev/docker-compose.yml +++ b/redcap-docker-dev/docker-compose.yml @@ -137,3 +137,6 @@ volumes: + + + diff --git a/redcap-docker-dev/env.template b/redcap-docker-dev/env.template index 2b89c375..6b2238eb 100644 --- a/redcap-docker-dev/env.template +++ b/redcap-docker-dev/env.template @@ -73,3 +73,6 @@ PMA_UPLOAD_LIMIT=50M + + + diff --git a/redcap-docker-dev/scripts/clean-redcap.ps1 b/redcap-docker-dev/scripts/clean-redcap.ps1 index 6373f257..b7461012 100644 --- a/redcap-docker-dev/scripts/clean-redcap.ps1 +++ b/redcap-docker-dev/scripts/clean-redcap.ps1 @@ -81,3 +81,6 @@ Write-Host "" + + + diff --git a/redcap-docker-dev/scripts/create-redcap-password.php b/redcap-docker-dev/scripts/create-redcap-password.php index 06ea7b62..36c17f4d 100644 --- a/redcap-docker-dev/scripts/create-redcap-password.php +++ b/redcap-docker-dev/scripts/create-redcap-password.php @@ -59,3 +59,6 @@ try { + + + diff --git a/redcap-docker-dev/scripts/logs-redcap.ps1 b/redcap-docker-dev/scripts/logs-redcap.ps1 index 4cf6b3fb..c2e85e0e 100644 --- a/redcap-docker-dev/scripts/logs-redcap.ps1 +++ b/redcap-docker-dev/scripts/logs-redcap.ps1 @@ -72,3 +72,6 @@ Write-Host "" + + + diff --git a/redcap-docker-dev/scripts/reset-admin-password.php b/redcap-docker-dev/scripts/reset-admin-password.php index 0d3adc13..a7e2a8c3 100644 --- a/redcap-docker-dev/scripts/reset-admin-password.php +++ b/redcap-docker-dev/scripts/reset-admin-password.php @@ -35,3 +35,6 @@ if ($result) { + + + diff --git a/redcap-docker-dev/scripts/start-redcap.ps1 b/redcap-docker-dev/scripts/start-redcap.ps1 index 224a162f..056d982b 100644 --- a/redcap-docker-dev/scripts/start-redcap.ps1 +++ b/redcap-docker-dev/scripts/start-redcap.ps1 @@ -57,3 +57,6 @@ if ($LASTEXITCODE -eq 0) { + + + diff --git a/redcap-docker-dev/scripts/stop-redcap.ps1 b/redcap-docker-dev/scripts/stop-redcap.ps1 index 586150f7..9031afd6 100644 --- a/redcap-docker-dev/scripts/stop-redcap.ps1 +++ b/redcap-docker-dev/scripts/stop-redcap.ps1 @@ -43,3 +43,6 @@ if ($LASTEXITCODE -eq 0) { + + + diff --git a/run_recovery.ps1 b/run_recovery.ps1 index 25da6be6..b8ec9d27 100644 --- a/run_recovery.ps1 +++ b/run_recovery.ps1 @@ -86,6 +86,9 @@ Write-Host "==================================================================== + + + diff --git a/tests/QUICKSTART_快速开始.md b/tests/QUICKSTART_快速开始.md index b51dd8cf..e1872a21 100644 --- a/tests/QUICKSTART_快速开始.md +++ b/tests/QUICKSTART_快速开始.md @@ -133,6 +133,9 @@ INFO: Uvicorn running on http://0.0.0.0:8001 + + + diff --git a/tests/README_测试说明.md b/tests/README_测试说明.md index bb41fe03..d7527ca6 100644 --- a/tests/README_测试说明.md +++ b/tests/README_测试说明.md @@ -289,6 +289,9 @@ df_numeric.to_excel('test_data/numeric_test.xlsx', index=False) + + + diff --git a/tests/run_tests.bat b/tests/run_tests.bat index d4aabe80..639b4a90 100644 --- a/tests/run_tests.bat +++ b/tests/run_tests.bat @@ -84,6 +84,9 @@ pause + + + diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 29d5a49e..e2f5080a 100644 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -80,6 +80,9 @@ echo "========================================" + + + diff --git a/快速部署到SAE.md b/快速部署到SAE.md index 9f7a96a4..79dca48c 100644 --- a/快速部署到SAE.md +++ b/快速部署到SAE.md @@ -345,6 +345,9 @@ OSS AccessKeySecret:_______________ + + + diff --git a/部署检查清单.md b/部署检查清单.md index f19af935..839acfd4 100644 --- a/部署检查清单.md +++ b/部署检查清单.md @@ -381,6 +381,9 @@ OSS配置: + + +