fix: currentScriptContent 章节字段全空时用 plotJson.fullContent 作为 fallback

This commit is contained in:
2026-06-30 07:45:20 +08:00
parent 1073123360
commit 86543df75d
+18 -5
View File
@@ -619,20 +619,33 @@ const resultHasScriptReplies = computed(() => {
const currentScriptContent = computed(() => {
const targetId = selectedVersionMessageId.value || currentVersionMessageId.value
const targetMessage = messages.value.find(m => m.id === targetId && m.type === 'script')
let result
if (!targetMessage || !targetMessage.metadata) {
return {
result = {
title: currentResult.value?.title || '',
plotIntro: currentResult.value?.plotIntro || '',
plotTurning: currentResult.value?.plotTurning || '',
plotClimax: currentResult.value?.plotClimax || '',
plotEnding: currentResult.value?.plotEnding || ''
}
} else {
try {
result = JSON.parse(targetMessage.metadata)
} catch (e) {
result = { title: '', plotIntro: targetMessage.metadata || '' }
}
}
try {
return JSON.parse(targetMessage.metadata)
} catch (e) {
return { title: '', plotIntro: targetMessage.metadata || '' }
// 章节字段全空时,用 plotJson.fullContent 作为 fallback
const hasChapter = result.plotIntro || result.plotTurning || result.plotClimax || result.plotEnding
if (!hasChapter) {
const fullContent = currentResult.value?.plotJson?.fullContent || ''
if (fullContent) {
result.plotIntro = fullContent
}
}
return result
})
const displayMessages = computed(() => messages.value)