From f5c66e1712405fc2a728dcb3649251c365e60903 Mon Sep 17 00:00:00 2001 From: empty Date: Thu, 8 Jan 2026 16:05:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=B9=E7=85=A7=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=94=AF=E6=8C=81=E5=AF=BC=E5=85=A5=E8=8C=83?= =?UTF-8?q?=E5=BC=8F=E5=86=99=E4=BD=9C=E8=A6=81=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增「导入范式要求」按钮 - 自动从 activeParadigm 提取: - expertGuidelines(专家指令) - systemConstraints(系统约束) - validationRules(质检规则) - 空白状态显示快捷导入入口 --- src/components/ComparePanel.vue | 70 ++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/src/components/ComparePanel.vue b/src/components/ComparePanel.vue index 8b74eb8..a7268ce 100644 --- a/src/components/ComparePanel.vue +++ b/src/components/ComparePanel.vue @@ -24,13 +24,29 @@

📋 写作要求

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

请在下方输入写作要求

+

请在下方输入写作要求

+
import { ref, computed } from 'vue' +import { storeToRefs } from 'pinia' import { useAppStore } from '../stores/app' +import { PARADIGMS } from '../config/paradigms' const appStore = useAppStore() +const { activeParadigm } = storeToRefs(appStore) // 内容 const leftContent = ref('') @@ -201,6 +220,53 @@ const isComparing = ref(false) const lastCheckResult = ref(null) const checkResults = ref({}) +// 范式相关 +const hasParadigmRules = computed(() => { + if (!activeParadigm.value) return false + const paradigm = PARADIGMS[activeParadigm.value] + return paradigm && (paradigm.expertGuidelines || paradigm.systemConstraints) +}) + +const activeParadigmName = computed(() => { + if (!activeParadigm.value) return '' + const paradigm = PARADIGMS[activeParadigm.value] + return paradigm?.name || '' +}) + +// 导入范式写作要求 +const importParadigmRules = () => { + if (!activeParadigm.value) return + const paradigm = PARADIGMS[activeParadigm.value] + 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) { + rules.push(`【${rule.name}】${rule.failMessage}`) + } + }) + } + + leftContent.value = rules.join('\n\n') +} + // 解析段落 const leftParagraphs = computed(() => { return leftContent.value