diff --git a/mini-program/src/pages/main/ScriptView.vue b/mini-program/src/pages/main/ScriptView.vue
index a235a8a..c34b59c 100644
--- a/mini-program/src/pages/main/ScriptView.vue
+++ b/mini-program/src/pages/main/ScriptView.vue
@@ -86,6 +86,56 @@
+
+
+
+
+ 在开始创作前,我想再了解你一点
+
+
+
+
+
+
+
+
+
+
+
+ {{ novelOutline.title }}
+
+
+ {{ novelOutline.logline }}
+
+
+
+ {{ beat.order || idx + 1 }}
+
+ {{ beat.title || '' }}
+ {{ beat.summary }}
+
+
+
+
+ 结局
+ {{ novelOutline.ending }}
+
+
+
+
+
+ 修改大纲
+ 确认大纲
+
+
+
+
+
+
{
+ markGenerationFailed(msg)
+ analytics.track('script_generate_fail', {
+ source,
+ error: msg
+ }, { eventType: 'script', pagePath })
+ }
+ })
} catch (error) {
markGenerationFailed(error.message || '生成失败')
analytics.track('script_generate_fail', {
@@ -1634,10 +1672,82 @@ const runGeneration = async ({ prompt, displayText, source = 'text', saveTheme }
}, { eventType: 'script', pagePath })
} finally {
generating.value = false
- generationStatus.value = 'idle'
}
}
+const handleShortNovelEvent = (event) => {
+ const { type, session_id, payload = {} } = event
+ if (session_id) novelSessionId.value = session_id
+
+ switch (type) {
+ case 'status':
+ generationStatus.value = payload.stage || 'processing'
+ break
+ case 'clarification_card':
+ clarificationCard.value = payload.card || null
+ viewState.value = 'clarifying'
+ break
+ case 'outline_created':
+ novelOutline.value = payload.outline || null
+ viewState.value = 'outlining'
+ break
+ case 'novel_start':
+ streamContent.value = ''
+ novelFullText.value = ''
+ viewState.value = 'novel-generating'
+ break
+ case 'novel_delta':
+ streamContent.value += payload.delta || ''
+ break
+ case 'novel_done':
+ novelFullText.value = payload.full_text || streamContent.value
+ streamContent.value = novelFullText.value
+ scriptId.value = payload.scriptId || ''
+ conversationId.value = payload.conversationId || ''
+ currentVersionMessageId.value = payload.currentVersionMessageId || ''
+ viewState.value = 'result'
+ viewMode.value = 'chat'
+ break
+ case 'error':
+ markGenerationFailed(payload.message || '生成失败')
+ break
+ }
+}
+
+const submitClarification = (answer) => {
+ if (answeringClarification.value) return
+ answeringClarification.value = true
+ currentStreamTask.value = followupStream({
+ sessionId: novelSessionId.value,
+ action: 'answer_clarification',
+ payload: { answer },
+ onEvent: handleShortNovelEvent,
+ onError: (msg) => markGenerationFailed(msg)
+ })
+ setTimeout(() => { answeringClarification.value = false }, 200)
+}
+
+const confirmOutline = () => {
+ currentStreamTask.value = followupStream({
+ sessionId: novelSessionId.value,
+ action: 'confirm_outline',
+ payload: null,
+ onEvent: handleShortNovelEvent,
+ onError: (msg) => markGenerationFailed(msg)
+ })
+}
+
+const modifyOutline = (feedback) => {
+ if (!feedback || !feedback.trim()) return
+ currentStreamTask.value = followupStream({
+ sessionId: novelSessionId.value,
+ action: 'modify_outline',
+ payload: { feedback },
+ onEvent: handleShortNovelEvent,
+ onError: (msg) => markGenerationFailed(msg)
+ })
+}
+
const submitWish = async (source = 'text') => {
const text = wishText.value.trim()
if (!text || generating.value) return
@@ -1962,6 +2072,162 @@ onUnmounted(() => {