feat: 实现范式库到工作台的数据流转机制
- 新增 src/config/paradigms.js:范式配置库,包含专家指令和评价量表 - 实现范式预设填充:点击卡片自动注入参考案例、标签、约束 - WriterPanel.vue:新增「专家指令」只读展示区(金色高亮) - AnalysisPanel.vue:使用统一的范式配置,调用 loadParadigmPreset - appStore.js:新增 activeParadigm、expertGuidelines、qualityReport 状态 - 支持民主生活会对照检查等6种范式的完整专家标准
This commit is contained in:
@@ -25,17 +25,17 @@
|
|||||||
<div class="space-y-3">
|
<div class="space-y-3">
|
||||||
<div
|
<div
|
||||||
v-for="paradigm in paradigms"
|
v-for="paradigm in paradigms"
|
||||||
:key="paradigm.type"
|
:key="paradigm.id"
|
||||||
@click="selectParadigm(paradigm)"
|
@click="selectParadigm(paradigm)"
|
||||||
:class="['bg-slate-700/50 rounded-lg p-4 border transition cursor-pointer',
|
:class="['bg-slate-700/50 rounded-lg p-4 border transition cursor-pointer',
|
||||||
selectedParadigm?.type === paradigm.type
|
selectedParadigm?.id === paradigm.id
|
||||||
? 'border-blue-500 bg-blue-900/20'
|
? 'border-blue-500 bg-blue-900/20'
|
||||||
: 'border-slate-600 hover:border-blue-500']"
|
: 'border-slate-600 hover:border-blue-500']"
|
||||||
>
|
>
|
||||||
<div class="flex justify-between items-start mb-2">
|
<div class="flex justify-between items-start mb-2">
|
||||||
<h4 class="font-medium text-white">{{ paradigm.icon }} {{ paradigm.name }}</h4>
|
<h4 class="font-medium text-white">{{ paradigm.icon }} {{ paradigm.name }}</h4>
|
||||||
<button
|
<button
|
||||||
v-if="selectedParadigm?.type === paradigm.type"
|
v-if="selectedParadigm?.id === paradigm.id"
|
||||||
@click.stop="applyParadigm(paradigm)"
|
@click.stop="applyParadigm(paradigm)"
|
||||||
class="text-xs px-2 py-1 bg-blue-600 text-white rounded hover:bg-blue-500 transition"
|
class="text-xs px-2 py-1 bg-blue-600 text-white rounded hover:bg-blue-500 transition"
|
||||||
>
|
>
|
||||||
@@ -108,9 +108,10 @@ import { ref, onMounted } from 'vue'
|
|||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import { useAppStore } from '../stores/app'
|
import { useAppStore } from '../stores/app'
|
||||||
import DeepSeekAPI from '../api/deepseek.js'
|
import DeepSeekAPI from '../api/deepseek.js'
|
||||||
|
import { getParadigmList } from '../config/paradigms.js'
|
||||||
|
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
const { analysisText, isAnalyzing, selectedTags, inputTask } = storeToRefs(appStore)
|
const { analysisText, isAnalyzing } = storeToRefs(appStore)
|
||||||
|
|
||||||
// 选中的范式
|
// 选中的范式
|
||||||
const selectedParadigm = ref(null)
|
const selectedParadigm = ref(null)
|
||||||
@@ -118,84 +119,17 @@ const selectedParadigm = ref(null)
|
|||||||
// 分析历史
|
// 分析历史
|
||||||
const analysisHistory = ref([])
|
const analysisHistory = ref([])
|
||||||
|
|
||||||
const paradigms = [
|
// 从配置文件获取范式列表
|
||||||
{
|
const paradigms = getParadigmList()
|
||||||
type: 'tech',
|
|
||||||
name: '技术博客范式',
|
|
||||||
icon: '📝',
|
|
||||||
description: '适用于技术分享、教程类文章',
|
|
||||||
tags: ['问题引入', '解决方案', '代码示例', '总结'],
|
|
||||||
tagClass: 'bg-blue-900/30 text-blue-300',
|
|
||||||
prompt: '请按照技术博客的范式写作,包含:1) 问题背景引入 2) 具体解决方案 3) 代码示例说明 4) 总结与最佳实践',
|
|
||||||
constraints: ['Markdown格式', '总分总结构', '数据支撑']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'business',
|
|
||||||
name: '商业分析范式',
|
|
||||||
icon: '📊',
|
|
||||||
description: '适用于行业分析、市场报告',
|
|
||||||
tags: ['背景介绍', '数据支撑', '趋势分析', '建议'],
|
|
||||||
tagClass: 'bg-green-900/30 text-green-300',
|
|
||||||
prompt: '请按照商业分析的范式写作,包含:1) 行业背景介绍 2) 数据分析与支撑 3) 趋势预测 4) 战略建议',
|
|
||||||
constraints: ['Markdown格式', '数据支撑', '引用权威来源']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'marketing',
|
|
||||||
name: '产品文案范式',
|
|
||||||
icon: '🎯',
|
|
||||||
description: '适用于产品介绍、营销文案',
|
|
||||||
tags: ['痛点切入', '价值主张', '功能亮点', '行动号召'],
|
|
||||||
tagClass: 'bg-purple-900/30 text-purple-300',
|
|
||||||
prompt: '请按照产品文案的范式写作,包含:1) 用户痛点切入 2) 核心价值主张 3) 产品功能亮点 4) 明确的行动号召',
|
|
||||||
constraints: ['语气幽默', '严禁被动语态']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'academic',
|
|
||||||
name: '学术论文范式',
|
|
||||||
icon: '📖',
|
|
||||||
description: '适用于学术写作、研究报告',
|
|
||||||
tags: ['摘要', '引言', '文献综述', '方法论', '结果'],
|
|
||||||
tagClass: 'bg-orange-900/30 text-orange-300',
|
|
||||||
prompt: '请按照学术论文的范式写作,包含:1) 摘要 2) 引言 3) 文献综述 4) 研究方法论 5) 结果与讨论 6) 结论',
|
|
||||||
constraints: ['引用权威来源', '严禁被动语态']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'party-review',
|
|
||||||
name: '民主生活会对照检查',
|
|
||||||
icon: '🏛️',
|
|
||||||
description: '适用于党政机关民主生活会个人对照检查材料',
|
|
||||||
tags: ['开篇引言', '对照查摆', '根源剖析', '整改措施', '表态'],
|
|
||||||
tagClass: 'bg-red-900/30 text-red-300',
|
|
||||||
prompt: '请按照民主生活会对照检查材料的范式写作,包含:1) 开篇说明会议主题和学习依据 2) 对照查摆存在的主要问题(按要求逐条分析) 3) 问题产生的根源剖析 4) 下一步整改措施 5) 结尾总结表态。语言要规范使用政治术语,体现自我批评精神,问题剖析要深入,整改措施要具体可行。',
|
|
||||||
constraints: ['总分总结构', '引用权威来源']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'gov-report',
|
|
||||||
name: '政府工作报告',
|
|
||||||
icon: '📋',
|
|
||||||
description: '适用于政府工作总结、述职报告',
|
|
||||||
tags: ['工作回顾', '成绩总结', '问题分析', '下步计划'],
|
|
||||||
tagClass: 'bg-cyan-900/30 text-cyan-300',
|
|
||||||
prompt: '请按照政府工作报告的范式写作,包含:1) 过去工作回顾 2) 主要成绩和亮点 3) 存在问题和不足 4) 下一步工作计划和目标。语言要严谨规范,数据要准确,措施要具体。',
|
|
||||||
constraints: ['Markdown格式', '数据支撑', '总分总结构']
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
// 选择范式
|
// 选择范式
|
||||||
const selectParadigm = (paradigm) => {
|
const selectParadigm = (paradigm) => {
|
||||||
selectedParadigm.value = paradigm
|
selectedParadigm.value = paradigm
|
||||||
}
|
}
|
||||||
|
|
||||||
// 应用范式到写作
|
// 应用范式到写作(使用新的 loadParadigmPreset 方法)
|
||||||
const applyParadigm = (paradigm) => {
|
const applyParadigm = (paradigm) => {
|
||||||
// 更新写作任务
|
appStore.loadParadigmPreset(paradigm.id)
|
||||||
inputTask.value = paradigm.prompt
|
|
||||||
|
|
||||||
// 更新选中的约束标签
|
|
||||||
selectedTags.value = [...paradigm.constraints]
|
|
||||||
|
|
||||||
// 切换到写作页面
|
|
||||||
appStore.switchPage('writer')
|
|
||||||
|
|
||||||
// 显示提示
|
// 显示提示
|
||||||
alert(`已应用"${paradigm.name}"到写作任务`)
|
alert(`已应用"${paradigm.name}"到写作任务`)
|
||||||
|
|||||||
@@ -99,6 +99,40 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<!-- 专家指令(范式预设时显示) -->
|
||||||
|
<section v-if="activeParadigm">
|
||||||
|
<div class="flex justify-between items-center mb-2">
|
||||||
|
<label class="text-sm font-medium text-amber-400 flex items-center gap-1">
|
||||||
|
⭐ 专家指令 (Expert Guidelines)
|
||||||
|
</label>
|
||||||
|
<button
|
||||||
|
@click="clearParadigm"
|
||||||
|
class="text-[10px] text-slate-500 hover:text-red-400 transition"
|
||||||
|
>
|
||||||
|
清除范式
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="bg-amber-950/20 border border-amber-500/30 rounded-lg p-3 space-y-2">
|
||||||
|
<div class="flex items-center gap-2 mb-2">
|
||||||
|
<span class="text-amber-400">{{ activeParadigm.icon }}</span>
|
||||||
|
<span class="text-xs font-medium text-amber-300">已加载【{{ activeParadigm.name }}】专家标准</span>
|
||||||
|
</div>
|
||||||
|
<div class="space-y-1.5">
|
||||||
|
<div
|
||||||
|
v-for="(guideline, idx) in expertGuidelines"
|
||||||
|
:key="idx"
|
||||||
|
class="text-[11px] text-slate-400 flex items-start gap-2"
|
||||||
|
>
|
||||||
|
<span class="text-amber-500/70 shrink-0">{{ idx + 1 }}.</span>
|
||||||
|
<div>
|
||||||
|
<span class="text-amber-300/80 font-medium">{{ guideline.title }}:</span>
|
||||||
|
<span class="text-slate-500">{{ guideline.description }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
<!-- 输出规范 -->
|
<!-- 输出规范 -->
|
||||||
<section>
|
<section>
|
||||||
<label class="block text-sm font-medium text-slate-400 mb-2">3. 输出规范 (Constraints)</label>
|
<label class="block text-sm font-medium text-slate-400 mb-2">3. 输出规范 (Constraints)</label>
|
||||||
@@ -194,6 +228,8 @@ const {
|
|||||||
newRefContent,
|
newRefContent,
|
||||||
selectedTags,
|
selectedTags,
|
||||||
customConstraint,
|
customConstraint,
|
||||||
|
activeParadigm,
|
||||||
|
expertGuidelines,
|
||||||
isGenerating,
|
isGenerating,
|
||||||
showPromptDebug,
|
showPromptDebug,
|
||||||
apiUrl,
|
apiUrl,
|
||||||
@@ -203,7 +239,7 @@ const {
|
|||||||
outlinePoints
|
outlinePoints
|
||||||
} = storeToRefs(appStore)
|
} = storeToRefs(appStore)
|
||||||
|
|
||||||
const { switchPage } = appStore
|
const { switchPage, clearParadigm } = appStore
|
||||||
|
|
||||||
const presetTags = ['Markdown格式', '总分总结构', '数据支撑', '语气幽默', '严禁被动语态', '引用权威来源']
|
const presetTags = ['Markdown格式', '总分总结构', '数据支撑', '语气幽默', '严禁被动语态', '引用权威来源']
|
||||||
|
|
||||||
|
|||||||
294
src/config/paradigms.js
Normal file
294
src/config/paradigms.js
Normal file
@@ -0,0 +1,294 @@
|
|||||||
|
// ============================================
|
||||||
|
// 写作范式配置库 - 包含专家指令和评价量表
|
||||||
|
// ============================================
|
||||||
|
|
||||||
|
export const PARADIGMS = {
|
||||||
|
// 民主生活会对照检查材料
|
||||||
|
'party-review': {
|
||||||
|
id: 'party-review',
|
||||||
|
name: '民主生活会对照检查',
|
||||||
|
icon: '🏛️',
|
||||||
|
description: '适用于党政机关民主生活会个人对照检查材料',
|
||||||
|
tags: ['开篇引言', '对照查摆', '根源剖析', '整改措施', '表态'],
|
||||||
|
tagClass: 'bg-red-900/30 text-red-300',
|
||||||
|
|
||||||
|
// 默认参考范文路径
|
||||||
|
defaultReference: {
|
||||||
|
title: '高质量对照检查材料范本',
|
||||||
|
content: `本材料是一份高质量、规范性强的个人对照检查材料范本。其核心构思在于严格遵循"五个带头"的政治标尺,以彻底的自我革命精神,完成一次深刻的自我政治体检与党性分析。
|
||||||
|
|
||||||
|
全文采用"查摆问题—剖析根源—整改提升"的经典逻辑闭环,体现了"把自己摆进去、把职责摆进去、把工作摆进去"的务实要求。材料立意高远,既全面对标了党员领导干部的共性政治要求,又紧密贴合了个人思想与履职实际,旨在通过刀刃向内的深刻反思,达到"红脸出汗、排毒治病"的效果。`
|
||||||
|
},
|
||||||
|
|
||||||
|
// 专家指令(映射图片中的5点要求)
|
||||||
|
expertGuidelines: [
|
||||||
|
{
|
||||||
|
title: '结构典范,逻辑严密',
|
||||||
|
description: '严格遵循"问题-原因-措施"三段式经典结构,各部分环环相扣,从表象到根源再到行动,形成完整、清晰、有力的论证闭环。',
|
||||||
|
checkKey: 'structure'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '画像精准,个性鲜明',
|
||||||
|
description: '问题查摆真正做到了"个人对照",紧密结合分管领域和日常工作,避免了空泛化和"集体病"表述,精准勾勒出个人的思想动态与行为短板。',
|
||||||
|
checkKey: 'personalization'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '剖析深刻,直击根本',
|
||||||
|
description: '原因剖析没有停留在表面,而是从思想、政治、作风、能力、纪律五个维度深挖根源,触及世界观、人生观、价值观这个"总开关"。',
|
||||||
|
checkKey: 'depth'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '措施务实,路径清晰',
|
||||||
|
description: '整改措施方向明确、内容具体,部分条款设计了量化指标(如学习篇目、调研天数),并与前文问题严格对应,具备较强的可操作性、可考核性。',
|
||||||
|
checkKey: 'actionable'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '语言规范,分寸得体',
|
||||||
|
description: '用语严谨、准确、恳切。在自我批评时,善用"有差距"、"仍需加强"、"有待提升"等谦抑性、建设性表述;在剖析整改时,则使用"持续用力"、"筑牢"、"压实"等坚定有力的词语。',
|
||||||
|
checkKey: 'language'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
// System Prompt 约束(注入到 AI 生成指令中)
|
||||||
|
systemConstraints: [
|
||||||
|
'结构严格遵循"问题-原因-措施"三段式闭环,各部分必须环环相扣',
|
||||||
|
'拒绝"脸谱化",问题查摆必须结合分管领域和具体工作实际',
|
||||||
|
'剖析必须触及世界观、人生观、价值观这个"总开关"',
|
||||||
|
'整改措施需包含可量化指标,体现可操作性和可考核性',
|
||||||
|
'自我批评用语谦抑(有差距/待加强/仍需),整改用语坚定(持续用力/筑牢/压实)'
|
||||||
|
],
|
||||||
|
|
||||||
|
// 推荐的 UI 标签
|
||||||
|
recommendedTags: ['总分总结构', '语气严肃', '数据支撑', '引用权威来源']
|
||||||
|
},
|
||||||
|
|
||||||
|
// 技术博客范式
|
||||||
|
'tech': {
|
||||||
|
id: 'tech',
|
||||||
|
name: '技术博客范式',
|
||||||
|
icon: '💻',
|
||||||
|
description: '适用于技术分享、教程类文章',
|
||||||
|
tags: ['问题引入', '解决方案', '代码示例', '总结'],
|
||||||
|
tagClass: 'bg-blue-900/30 text-blue-300',
|
||||||
|
|
||||||
|
defaultReference: {
|
||||||
|
title: '技术博客风格范本',
|
||||||
|
content: '本文深入探讨了...(此处省略2000字,这是为了让AI模仿这种干练的技术风格)...'
|
||||||
|
},
|
||||||
|
|
||||||
|
expertGuidelines: [
|
||||||
|
{
|
||||||
|
title: '问题导向',
|
||||||
|
description: '开篇直击痛点,明确文章要解决的技术问题',
|
||||||
|
checkKey: 'problem'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '代码质量',
|
||||||
|
description: '代码示例完整可运行,注释清晰,遵循最佳实践',
|
||||||
|
checkKey: 'code'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '逻辑递进',
|
||||||
|
description: '从简单到复杂,循序渐进,读者能跟上思路',
|
||||||
|
checkKey: 'progression'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
systemConstraints: [
|
||||||
|
'开篇必须明确阐述要解决的技术问题和痛点',
|
||||||
|
'代码示例必须完整可运行,包含必要的导入语句',
|
||||||
|
'技术术语首次出现时需简要解释',
|
||||||
|
'结尾需总结核心要点和最佳实践'
|
||||||
|
],
|
||||||
|
|
||||||
|
recommendedTags: ['Markdown格式', '总分总结构', '数据支撑']
|
||||||
|
},
|
||||||
|
|
||||||
|
// 商业分析范式
|
||||||
|
'business': {
|
||||||
|
id: 'business',
|
||||||
|
name: '商业分析范式',
|
||||||
|
icon: '📊',
|
||||||
|
description: '适用于行业分析、市场报告',
|
||||||
|
tags: ['背景介绍', '数据支撑', '趋势分析', '建议'],
|
||||||
|
tagClass: 'bg-green-900/30 text-green-300',
|
||||||
|
|
||||||
|
defaultReference: null,
|
||||||
|
|
||||||
|
expertGuidelines: [
|
||||||
|
{
|
||||||
|
title: '数据驱动',
|
||||||
|
description: '所有论点必须有数据支撑,引用权威来源',
|
||||||
|
checkKey: 'data'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '趋势洞察',
|
||||||
|
description: '不仅描述现状,更要预测未来发展趋势',
|
||||||
|
checkKey: 'trend'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '可执行建议',
|
||||||
|
description: '结论部分需提供具体、可操作的战略建议',
|
||||||
|
checkKey: 'actionable'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
systemConstraints: [
|
||||||
|
'所有数据必须标注来源和时间',
|
||||||
|
'使用SWOT、波特五力等专业分析框架',
|
||||||
|
'趋势预测需基于现有数据的逻辑推演',
|
||||||
|
'建议部分需区分短期和长期策略'
|
||||||
|
],
|
||||||
|
|
||||||
|
recommendedTags: ['Markdown格式', '数据支撑', '引用权威来源']
|
||||||
|
},
|
||||||
|
|
||||||
|
// 产品文案范式
|
||||||
|
'marketing': {
|
||||||
|
id: 'marketing',
|
||||||
|
name: '产品文案范式',
|
||||||
|
icon: '🚀',
|
||||||
|
description: '适用于产品介绍、营销文案',
|
||||||
|
tags: ['痛点切入', '价值主张', '功能亮点', '行动号召'],
|
||||||
|
tagClass: 'bg-purple-900/30 text-purple-300',
|
||||||
|
|
||||||
|
defaultReference: null,
|
||||||
|
|
||||||
|
expertGuidelines: [
|
||||||
|
{
|
||||||
|
title: '情感共鸣',
|
||||||
|
description: '开篇触及用户痛点,建立情感连接',
|
||||||
|
checkKey: 'emotion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '价值清晰',
|
||||||
|
description: '核心价值主张一句话说清楚',
|
||||||
|
checkKey: 'value'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '行动引导',
|
||||||
|
description: '结尾有明确的CTA(Call to Action)',
|
||||||
|
checkKey: 'cta'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
systemConstraints: [
|
||||||
|
'开篇3秒内必须抓住用户注意力',
|
||||||
|
'避免自嗨式描述,聚焦用户利益',
|
||||||
|
'功能描述转化为用户价值',
|
||||||
|
'结尾必须有明确的行动号召'
|
||||||
|
],
|
||||||
|
|
||||||
|
recommendedTags: ['语气幽默', '严禁被动语态']
|
||||||
|
},
|
||||||
|
|
||||||
|
// 学术论文范式
|
||||||
|
'academic': {
|
||||||
|
id: 'academic',
|
||||||
|
name: '学术论文范式',
|
||||||
|
icon: '📚',
|
||||||
|
description: '适用于学术写作、研究报告',
|
||||||
|
tags: ['摘要', '引言', '文献综述', '方法论', '结果'],
|
||||||
|
tagClass: 'bg-orange-900/30 text-orange-300',
|
||||||
|
|
||||||
|
defaultReference: null,
|
||||||
|
|
||||||
|
expertGuidelines: [
|
||||||
|
{
|
||||||
|
title: '学术规范',
|
||||||
|
description: '严格遵循学术写作规范,引用格式正确',
|
||||||
|
checkKey: 'format'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '逻辑严谨',
|
||||||
|
description: '论证过程无逻辑跳跃,因果关系清晰',
|
||||||
|
checkKey: 'logic'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创新贡献',
|
||||||
|
description: '明确指出研究的创新点和学术贡献',
|
||||||
|
checkKey: 'contribution'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
systemConstraints: [
|
||||||
|
'摘要需包含研究目的、方法、结果、结论四要素',
|
||||||
|
'引言需明确研究问题和研究意义',
|
||||||
|
'文献综述需系统梳理相关研究',
|
||||||
|
'结论不超出研究数据支持的范围'
|
||||||
|
],
|
||||||
|
|
||||||
|
recommendedTags: ['引用权威来源', '严禁被动语态']
|
||||||
|
},
|
||||||
|
|
||||||
|
// 政府工作报告范式
|
||||||
|
'gov-report': {
|
||||||
|
id: 'gov-report',
|
||||||
|
name: '政府工作报告',
|
||||||
|
icon: '🏢',
|
||||||
|
description: '适用于政府工作总结、述职报告',
|
||||||
|
tags: ['工作回顾', '成绩总结', '问题分析', '下步计划'],
|
||||||
|
tagClass: 'bg-cyan-900/30 text-cyan-300',
|
||||||
|
|
||||||
|
defaultReference: null,
|
||||||
|
|
||||||
|
expertGuidelines: [
|
||||||
|
{
|
||||||
|
title: '政治站位',
|
||||||
|
description: '体现党的领导和中央精神',
|
||||||
|
checkKey: 'political'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '数据详实',
|
||||||
|
description: '工作成绩用具体数据说话',
|
||||||
|
checkKey: 'data'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '问题导向',
|
||||||
|
description: '正视问题,不回避矛盾',
|
||||||
|
checkKey: 'problem'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
systemConstraints: [
|
||||||
|
'开篇需体现政治站位和指导思想',
|
||||||
|
'工作回顾需分条目、有数据支撑',
|
||||||
|
'问题分析需客观务实',
|
||||||
|
'下步计划需具体可考核'
|
||||||
|
],
|
||||||
|
|
||||||
|
recommendedTags: ['Markdown格式', '数据支撑', '总分总结构']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取所有范式列表
|
||||||
|
export const getParadigmList = () => {
|
||||||
|
return Object.values(PARADIGMS)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据ID获取范式详情
|
||||||
|
export const getParadigmById = (id) => {
|
||||||
|
return PARADIGMS[id] || null
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建范式专用的 System Prompt 约束
|
||||||
|
export const buildParadigmConstraints = (paradigmId) => {
|
||||||
|
const paradigm = PARADIGMS[paradigmId]
|
||||||
|
if (!paradigm) return ''
|
||||||
|
|
||||||
|
let constraints = `\n# 专家级写作标准 (${paradigm.name})\n`
|
||||||
|
constraints += `请严格遵循以下专家评价标准:\n\n`
|
||||||
|
|
||||||
|
paradigm.expertGuidelines.forEach((g, idx) => {
|
||||||
|
constraints += `${idx + 1}. 【${g.title}】${g.description}\n`
|
||||||
|
})
|
||||||
|
|
||||||
|
if (paradigm.systemConstraints?.length > 0) {
|
||||||
|
constraints += `\n# 硬性约束\n`
|
||||||
|
paradigm.systemConstraints.forEach(c => {
|
||||||
|
constraints += `- ${c}\n`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return constraints
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ import { ref } from 'vue'
|
|||||||
import { config } from '../utils/config.js'
|
import { config } from '../utils/config.js'
|
||||||
import DeepSeekAPI from '../api/deepseek.js'
|
import DeepSeekAPI from '../api/deepseek.js'
|
||||||
import { buildPrompt, createStreamParser, parseGhostwriterOutput } from '../utils/promptBuilder.js'
|
import { buildPrompt, createStreamParser, parseGhostwriterOutput } from '../utils/promptBuilder.js'
|
||||||
|
import { PARADIGMS, getParadigmById, buildParadigmConstraints } from '../config/paradigms.js'
|
||||||
|
|
||||||
export const useAppStore = defineStore('app', () => {
|
export const useAppStore = defineStore('app', () => {
|
||||||
// 页面状态
|
// 页面状态
|
||||||
@@ -30,6 +31,13 @@ export const useAppStore = defineStore('app', () => {
|
|||||||
const selectedTags = ref(['Markdown格式', '总分总结构'])
|
const selectedTags = ref(['Markdown格式', '总分总结构'])
|
||||||
const customConstraint = ref('')
|
const customConstraint = ref('')
|
||||||
|
|
||||||
|
// 范式相关
|
||||||
|
const activeParadigm = ref(null) // 当前激活的范式配置
|
||||||
|
const expertGuidelines = ref([]) // 专家指令列表
|
||||||
|
|
||||||
|
// 质检报告(深度模式)
|
||||||
|
const qualityReport = ref(null) // { checks: [{key, title, status, message}], overall: 'pass'|'warning'|'fail' }
|
||||||
|
|
||||||
// 生成相关
|
// 生成相关
|
||||||
const isGenerating = ref(false)
|
const isGenerating = ref(false)
|
||||||
const isDeepMode = ref(false)
|
const isDeepMode = ref(false)
|
||||||
@@ -266,6 +274,59 @@ export const useAppStore = defineStore('app', () => {
|
|||||||
currentPage.value = page
|
currentPage.value = page
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 加载范式预设
|
||||||
|
const loadParadigmPreset = (paradigmId) => {
|
||||||
|
const paradigm = getParadigmById(paradigmId)
|
||||||
|
if (!paradigm) {
|
||||||
|
console.warn('Store: Paradigm not found:', paradigmId)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Store: Loading paradigm preset:', paradigm.name)
|
||||||
|
|
||||||
|
// 1. 设置当前范式
|
||||||
|
activeParadigm.value = paradigm
|
||||||
|
expertGuidelines.value = paradigm.expertGuidelines || []
|
||||||
|
|
||||||
|
// 2. 清空写作任务(等用户填具体内容)
|
||||||
|
inputTask.value = ''
|
||||||
|
|
||||||
|
// 3. 自动挂载默认参考案例
|
||||||
|
if (paradigm.defaultReference) {
|
||||||
|
references.value = [{
|
||||||
|
title: paradigm.defaultReference.title,
|
||||||
|
content: paradigm.defaultReference.content,
|
||||||
|
styleTags: [],
|
||||||
|
isAnalyzing: false
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 自动选中推荐标签
|
||||||
|
if (paradigm.recommendedTags) {
|
||||||
|
selectedTags.value = [...paradigm.recommendedTags]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. 注入系统约束到自定义要求
|
||||||
|
if (paradigm.systemConstraints?.length > 0) {
|
||||||
|
customConstraint.value = paradigm.systemConstraints.join(';')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. 清空之前的生成内容
|
||||||
|
generatedContent.value = ''
|
||||||
|
thinkingContent.value = ''
|
||||||
|
qualityReport.value = null
|
||||||
|
|
||||||
|
// 7. 跳转到写作页面
|
||||||
|
currentPage.value = 'writer'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清除当前范式
|
||||||
|
const clearParadigm = () => {
|
||||||
|
activeParadigm.value = null
|
||||||
|
expertGuidelines.value = []
|
||||||
|
qualityReport.value = null
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// 状态
|
// 状态
|
||||||
currentPage,
|
currentPage,
|
||||||
@@ -277,6 +338,9 @@ export const useAppStore = defineStore('app', () => {
|
|||||||
references,
|
references,
|
||||||
selectedTags,
|
selectedTags,
|
||||||
customConstraint,
|
customConstraint,
|
||||||
|
activeParadigm,
|
||||||
|
expertGuidelines,
|
||||||
|
qualityReport,
|
||||||
isGenerating,
|
isGenerating,
|
||||||
isDeepMode,
|
isDeepMode,
|
||||||
generationStage,
|
generationStage,
|
||||||
@@ -296,6 +360,8 @@ export const useAppStore = defineStore('app', () => {
|
|||||||
switchPage,
|
switchPage,
|
||||||
addReferenceFromAnalysis,
|
addReferenceFromAnalysis,
|
||||||
generateContentAction,
|
generateContentAction,
|
||||||
analyzeArticleAction
|
analyzeArticleAction,
|
||||||
|
loadParadigmPreset,
|
||||||
|
clearParadigm
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user