From 67758a7fff528553fed34a067db6a5a94778666d Mon Sep 17 00:00:00 2001 From: empty Date: Thu, 8 Jan 2026 11:49:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=9E=E7=8E=B0=E8=8C=83=E5=BC=8F?= =?UTF-8?q?=E5=BA=93=E5=88=B0=E5=B7=A5=E4=BD=9C=E5=8F=B0=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=B5=81=E8=BD=AC=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 src/config/paradigms.js:范式配置库,包含专家指令和评价量表 - 实现范式预设填充:点击卡片自动注入参考案例、标签、约束 - WriterPanel.vue:新增「专家指令」只读展示区(金色高亮) - AnalysisPanel.vue:使用统一的范式配置,调用 loadParadigmPreset - appStore.js:新增 activeParadigm、expertGuidelines、qualityReport 状态 - 支持民主生活会对照检查等6种范式的完整专家标准 --- src/components/AnalysisPanel.vue | 84 +-------- src/components/WriterPanel.vue | 38 +++- src/config/paradigms.js | 294 +++++++++++++++++++++++++++++++ src/stores/app.js | 68 ++++++- 4 files changed, 407 insertions(+), 77 deletions(-) create mode 100644 src/config/paradigms.js diff --git a/src/components/AnalysisPanel.vue b/src/components/AnalysisPanel.vue index 1344c7d..58f6866 100644 --- a/src/components/AnalysisPanel.vue +++ b/src/components/AnalysisPanel.vue @@ -25,17 +25,17 @@

{{ paradigm.icon }} {{ paradigm.name }}

+ +
+
+ + +
+
+
+ {{ activeParadigm.icon }} + 已加载【{{ activeParadigm.name }}】专家标准 +
+
+
+ {{ idx + 1 }}. +
+ {{ guideline.title }}: + {{ guideline.description }} +
+
+
+
+
+
@@ -194,6 +228,8 @@ const { newRefContent, selectedTags, customConstraint, + activeParadigm, + expertGuidelines, isGenerating, showPromptDebug, apiUrl, @@ -203,7 +239,7 @@ const { outlinePoints } = storeToRefs(appStore) -const { switchPage } = appStore +const { switchPage, clearParadigm } = appStore const presetTags = ['Markdown格式', '总分总结构', '数据支撑', '语气幽默', '严禁被动语态', '引用权威来源'] diff --git a/src/config/paradigms.js b/src/config/paradigms.js new file mode 100644 index 0000000..a2c4acd --- /dev/null +++ b/src/config/paradigms.js @@ -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 +} diff --git a/src/stores/app.js b/src/stores/app.js index 09e517e..b77af06 100644 --- a/src/stores/app.js +++ b/src/stores/app.js @@ -3,6 +3,7 @@ import { ref } from 'vue' import { config } from '../utils/config.js' import DeepSeekAPI from '../api/deepseek.js' import { buildPrompt, createStreamParser, parseGhostwriterOutput } from '../utils/promptBuilder.js' +import { PARADIGMS, getParadigmById, buildParadigmConstraints } from '../config/paradigms.js' export const useAppStore = defineStore('app', () => { // 页面状态 @@ -30,6 +31,13 @@ export const useAppStore = defineStore('app', () => { const selectedTags = ref(['Markdown格式', '总分总结构']) 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 isDeepMode = ref(false) @@ -266,6 +274,59 @@ export const useAppStore = defineStore('app', () => { 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 { // 状态 currentPage, @@ -277,6 +338,9 @@ export const useAppStore = defineStore('app', () => { references, selectedTags, customConstraint, + activeParadigm, + expertGuidelines, + qualityReport, isGenerating, isDeepMode, generationStage, @@ -296,6 +360,8 @@ export const useAppStore = defineStore('app', () => { switchPage, addReferenceFromAnalysis, generateContentAction, - analyzeArticleAction + analyzeArticleAction, + loadParadigmPreset, + clearParadigm } })