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

This commit is contained in:
2026-06-30 07:45:20 +08:00
parent 1073123360
commit 86543df75d
+17 -4
View File
@@ -619,20 +619,33 @@ const resultHasScriptReplies = computed(() => {
const currentScriptContent = computed(() => { const currentScriptContent = computed(() => {
const targetId = selectedVersionMessageId.value || currentVersionMessageId.value const targetId = selectedVersionMessageId.value || currentVersionMessageId.value
const targetMessage = messages.value.find(m => m.id === targetId && m.type === 'script') const targetMessage = messages.value.find(m => m.id === targetId && m.type === 'script')
let result
if (!targetMessage || !targetMessage.metadata) { if (!targetMessage || !targetMessage.metadata) {
return { result = {
title: currentResult.value?.title || '', title: currentResult.value?.title || '',
plotIntro: currentResult.value?.plotIntro || '', plotIntro: currentResult.value?.plotIntro || '',
plotTurning: currentResult.value?.plotTurning || '', plotTurning: currentResult.value?.plotTurning || '',
plotClimax: currentResult.value?.plotClimax || '', plotClimax: currentResult.value?.plotClimax || '',
plotEnding: currentResult.value?.plotEnding || '' plotEnding: currentResult.value?.plotEnding || ''
} }
} } else {
try { try {
return JSON.parse(targetMessage.metadata) result = JSON.parse(targetMessage.metadata)
} catch (e) { } catch (e) {
return { title: '', plotIntro: targetMessage.metadata || '' } result = { 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) const displayMessages = computed(() => messages.value)