fix: currentScriptContent 章节字段全空时用 plotJson.fullContent 作为 fallback
This commit is contained in:
@@ -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 {
|
||||||
|
result = JSON.parse(targetMessage.metadata)
|
||||||
|
} catch (e) {
|
||||||
|
result = { title: '', plotIntro: targetMessage.metadata || '' }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
return JSON.parse(targetMessage.metadata)
|
// 章节字段全空时,用 plotJson.fullContent 作为 fallback
|
||||||
} catch (e) {
|
const hasChapter = result.plotIntro || result.plotTurning || result.plotClimax || result.plotEnding
|
||||||
return { title: '', plotIntro: targetMessage.metadata || '' }
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user