feat: 增强'应用到写作'功能,实现分析结果与案例的自动同步
This commit is contained in:
@@ -239,13 +239,25 @@ const copyAnalysis = () => {
|
||||
// 应用到写作
|
||||
const applyToWriting = () => {
|
||||
if (analysisResult.value) {
|
||||
// 1. 将原文添加为参考案例
|
||||
appStore.addReferenceFromAnalysis(
|
||||
`参考范文_${analysisResult.value.paradigm}`,
|
||||
appStore.analysisText
|
||||
)
|
||||
|
||||
// 2. 将风格分析结果应用到自定义要求中
|
||||
appStore.customConstraint = `请模仿以下风格分析进行创作:\n${analysisResult.value.analysis}`
|
||||
|
||||
// 3. 应用范式预设(可选,如果有匹配的预设)
|
||||
const paradigm = getParadigmDetails()
|
||||
if (paradigm) {
|
||||
inputTask.value = paradigm.prompt
|
||||
selectedTags.value = [...paradigm.constraints]
|
||||
appStore.switchPage('writer')
|
||||
alert(`已应用"${paradigm.name}"到写作任务`)
|
||||
}
|
||||
|
||||
// 4. 切换页面
|
||||
appStore.switchPage('writer')
|
||||
alert(`已将分析结果及原文应用到写作工坊`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,18 +26,27 @@ export const useAppStore = defineStore('app', () => {
|
||||
const analysisText = ref('')
|
||||
const analysisResult = ref(null)
|
||||
const isAnalyzing = ref(false)
|
||||
|
||||
const styleAnalysis = ref('') // 存储具体的风格分析内容
|
||||
|
||||
// UI状态
|
||||
const showPromptDebug = ref(false)
|
||||
const showRefInput = ref(false)
|
||||
const newRefTitle = ref('')
|
||||
const newRefContent = ref('')
|
||||
|
||||
|
||||
// 方法
|
||||
const addReferenceFromAnalysis = (title, content) => {
|
||||
references.value.push({
|
||||
title: title || `参考范文_${new Date().toLocaleDateString()}`,
|
||||
content: content
|
||||
})
|
||||
}
|
||||
|
||||
// 切换页面
|
||||
const switchPage = (page) => {
|
||||
currentPage.value = page
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
// 状态
|
||||
currentPage,
|
||||
@@ -52,12 +61,14 @@ export const useAppStore = defineStore('app', () => {
|
||||
analysisText,
|
||||
analysisResult,
|
||||
isAnalyzing,
|
||||
styleAnalysis,
|
||||
showPromptDebug,
|
||||
showRefInput,
|
||||
newRefTitle,
|
||||
newRefContent,
|
||||
|
||||
|
||||
// 方法
|
||||
switchPage
|
||||
switchPage,
|
||||
addReferenceFromAnalysis
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user