feat(core): finalize rvw stability updates and pending module changes
Summary: - Harden RVW prompt protocol handling and methodology review flow with 20-checkpoint coverage, divide-and-conquer execution, and timeout tuning - Update RVW frontend methodology report rendering to show real structured outputs and grouped checkpoint sections - Include pending backend/frontend updates across IIT admin, SSA, extraction forensics, and related integration files - Sync system and RVW status documentation, deployment checklist, and RVW architecture/plan docs Validation: - Verified lint diagnostics for touched RVW backend/frontend files show no new errors - Kept backup dump files and local test artifacts untracked Made-with: Cursor
This commit is contained in:
@@ -11,6 +11,7 @@ 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 { composeRvwSystemPrompt } from './promptProtocols.js';
|
||||
|
||||
export interface ClinicalReviewResult {
|
||||
report: string;
|
||||
@@ -31,7 +32,7 @@ export async function reviewClinical(
|
||||
): Promise<ClinicalReviewResult> {
|
||||
try {
|
||||
const promptService = getPromptService(prisma);
|
||||
const { content: systemPrompt, isDraft } = await promptService.get(
|
||||
const { content: businessPrompt, isDraft } = await promptService.get(
|
||||
'RVW_CLINICAL',
|
||||
{},
|
||||
{ userId }
|
||||
@@ -42,8 +43,11 @@ export async function reviewClinical(
|
||||
}
|
||||
|
||||
const messages = [
|
||||
{ role: 'system' as const, content: systemPrompt },
|
||||
{ role: 'user' as const, content: `请对以下医学稿件进行临床专业评估:\n\n${text}` },
|
||||
{ role: 'system' as const, content: composeRvwSystemPrompt('clinical', businessPrompt) },
|
||||
{
|
||||
role: 'user' as const,
|
||||
content: `请对以下医学稿件进行临床专业评估。\n\n稿件内容如下:\n${text}`,
|
||||
},
|
||||
];
|
||||
|
||||
logger.info('[RVW:Clinical] 开始临床专业评估', { modelType });
|
||||
@@ -58,11 +62,22 @@ export async function reviewClinical(
|
||||
responseLength: content.length,
|
||||
});
|
||||
|
||||
// 提取摘要:取第一段非标题文本(最多200字)
|
||||
const lines = content.split('\n').filter(l => l.trim() && !l.startsWith('#'));
|
||||
const summary = lines.length > 0
|
||||
? lines[0].trim().substring(0, 200)
|
||||
: '临床专业评估已完成';
|
||||
// 优先提取“总体评价”段落作为摘要,提取失败再兜底首段文本
|
||||
let summary = '临床专业评估已完成';
|
||||
const overallMatch = content.match(/(?:^|\n)\s*(?:#*\s*)?1[\.\、]\s*总体评价[\s\S]*?(?:\n(?:#*\s*)?2[\.\、]\s*详细问题清单与建议|$)/);
|
||||
if (overallMatch) {
|
||||
const extracted = overallMatch[0]
|
||||
.replace(/(?:^|\n)\s*(?:#*\s*)?1[\.\、]\s*总体评价\s*/m, '')
|
||||
.trim();
|
||||
if (extracted) {
|
||||
summary = extracted.substring(0, 200);
|
||||
}
|
||||
} else {
|
||||
const lines = content.split('\n').filter(l => l.trim() && !l.startsWith('#'));
|
||||
if (lines.length > 0) {
|
||||
summary = lines[0].trim().substring(0, 200);
|
||||
}
|
||||
}
|
||||
|
||||
return { report: content, summary };
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user