diff --git a/src/components/ComparePanel.vue b/src/components/ComparePanel.vue index 6bda9de..12f6df5 100644 --- a/src/components/ComparePanel.vue +++ b/src/components/ComparePanel.vue @@ -16,37 +16,46 @@ + +
+
+ 📚 当前写作范式: + {{ activeParadigmName }} + ({{ paradigmRulesCount }} 条专家规则将自动纳入对照依据) +
+ +
+ + +
+
+
+ {{ rule }} +
+
+
+
- +

- 📋 写作要求 + 📋 要求原文

-
- - {{ leftParagraphs.length }} 段 -
+ {{ leftParagraphs.length }} 段
📝 -

请在下方输入写作要求

- +

请在下方粘贴写作要求的原文

+

(如:红头文件、通知要求等)

{ const p = activeParadigm.value return p && (p.expertGuidelines || p.systemConstraints || p.validationRules) @@ -237,28 +248,25 @@ const activeParadigmName = computed(() => { return activeParadigm.value?.name || '' }) -// 导入范式写作要求 -const importParadigmRules = () => { +// 提取范式规则列表 +const paradigmRulesList = computed(() => { const paradigm = activeParadigm.value - if (!paradigm) return + if (!paradigm) return [] const rules = [] - // 从 expertGuidelines 提取 if (paradigm.expertGuidelines) { paradigm.expertGuidelines.forEach(g => { rules.push(`【${g.title}】${g.description}`) }) } - // 从 systemConstraints 提取 if (paradigm.systemConstraints) { paradigm.systemConstraints.forEach(c => { rules.push(c) }) } - // 从 validationRules 提取 if (paradigm.validationRules) { Object.values(paradigm.validationRules).forEach(rule => { if (rule.name && rule.failMessage) { @@ -267,7 +275,15 @@ const importParadigmRules = () => { }) } - leftContent.value = rules.join('\n\n') + return rules +}) + +const paradigmRulesCount = computed(() => paradigmRulesList.value.length) + +// 获取范式规则文本(用于 Prompt 构建) +const getParadigmRulesText = () => { + if (paradigmRulesList.value.length === 0) return '' + return paradigmRulesList.value.join('\n') } // 解析段落 @@ -342,26 +358,43 @@ const runCompare = async () => { const requirement = getSelectedLeftText() const content = getSelectedRightText() + const paradigmRules = getParadigmRulesText() isComparing.value = true lastCheckResult.value = null try { - const prompt = `你是一个严格的写作质检专家。请对比以下"写作要求"和"写作内容",判断内容是否符合要求。 + // 构建包含要求原文 + 范式规则的完整对照依据 + let prompt = `你是一个严格的写作质检专家。请对比以下"对照依据"和"写作内容",判断内容是否符合要求。 -# 写作要求(共 ${selectedLeftIdxs.value.length} 段) +# 对照依据 + +## 一、要求原文(共 ${selectedLeftIdxs.value.length} 段) ${requirement} +` + // 如果有范式规则,追加到对照依据中 + if (paradigmRules) { + prompt += ` +## 二、写作范式专家规则(共 ${paradigmRulesCount.value} 条) +${paradigmRules} +` + } + + prompt += ` # 写作内容(共 ${selectedRightIdxs.value.length} 段) ${content} +# 检查说明 +请综合"要求原文"${paradigmRules ? '和"写作范式专家规则"' : ''},对写作内容进行全面检查。 + # 输出要求 请严格按照以下 JSON 格式输出检查结果(不要输出其他内容): { "overall": "pass|warning|fail", "summary": "一句话总结检查结果", "details": [ - {"aspect": "检查维度", "status": "pass|warning|fail", "message": "具体说明"} + {"aspect": "检查维度(如:内容完整性/篇幅占比/关键词覆盖)", "status": "pass|warning|fail", "message": "具体说明"} ], "suggestions": ["改进建议1", "改进建议2"] }`