feat: 对照检查页面支持导入范式写作要求
- 新增「导入范式要求」按钮 - 自动从 activeParadigm 提取: - expertGuidelines(专家指令) - systemConstraints(系统约束) - validationRules(质检规则) - 空白状态显示快捷导入入口
This commit is contained in:
@@ -24,13 +24,29 @@
|
|||||||
<h2 class="text-sm font-medium text-amber-400 flex items-center gap-2">
|
<h2 class="text-sm font-medium text-amber-400 flex items-center gap-2">
|
||||||
📋 写作要求
|
📋 写作要求
|
||||||
</h2>
|
</h2>
|
||||||
<span class="text-xs text-slate-500">{{ leftParagraphs.length }} 段</span>
|
<div class="flex items-center gap-2">
|
||||||
|
<button
|
||||||
|
v-if="hasParadigmRules"
|
||||||
|
@click="importParadigmRules"
|
||||||
|
class="text-xs px-2 py-1 rounded bg-amber-900/50 text-amber-300 border border-amber-700/50 hover:bg-amber-800/50 transition flex items-center gap-1"
|
||||||
|
>
|
||||||
|
📥 导入范式要求
|
||||||
|
</button>
|
||||||
|
<span class="text-xs text-slate-500">{{ leftParagraphs.length }} 段</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1 overflow-y-auto p-4 space-y-3 min-h-0">
|
<div class="flex-1 overflow-y-auto p-4 space-y-3 min-h-0">
|
||||||
<div v-if="!leftContent" class="h-full flex items-center justify-center">
|
<div v-if="!leftContent" class="h-full flex items-center justify-center">
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<span class="text-4xl opacity-20 block mb-2">📝</span>
|
<span class="text-4xl opacity-20 block mb-2">📝</span>
|
||||||
<p class="text-slate-600 text-sm">请在下方输入写作要求</p>
|
<p class="text-slate-600 text-sm mb-3">请在下方输入写作要求</p>
|
||||||
|
<button
|
||||||
|
v-if="hasParadigmRules"
|
||||||
|
@click="importParadigmRules"
|
||||||
|
class="text-xs px-3 py-1.5 rounded bg-amber-600 text-white hover:bg-amber-500 transition"
|
||||||
|
>
|
||||||
|
📥 从「{{ activeParadigmName }}」导入
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -184,9 +200,12 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
|
import { storeToRefs } from 'pinia'
|
||||||
import { useAppStore } from '../stores/app'
|
import { useAppStore } from '../stores/app'
|
||||||
|
import { PARADIGMS } from '../config/paradigms'
|
||||||
|
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
|
const { activeParadigm } = storeToRefs(appStore)
|
||||||
|
|
||||||
// 内容
|
// 内容
|
||||||
const leftContent = ref('')
|
const leftContent = ref('')
|
||||||
@@ -201,6 +220,53 @@ const isComparing = ref(false)
|
|||||||
const lastCheckResult = ref(null)
|
const lastCheckResult = ref(null)
|
||||||
const checkResults = ref({})
|
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(() => {
|
const leftParagraphs = computed(() => {
|
||||||
return leftContent.value
|
return leftContent.value
|
||||||
|
|||||||
Reference in New Issue
Block a user