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