Files
happy-life-star/docs/superpowers/specs/2026-05-24-mini-program-script-generation-feedback-design.md

1.7 KiB

Mini Program Script Generation Feedback Design

Goal

Improve the mini-program 心愿实现中 screen so users can clearly tell that generation is running, understand long waits, and recover gently if the AI stream fails or produces no output.

Approved Approach

Use option A: add a scene-friendly loading state with phased guidance and a graceful failure panel.

Behavior

When script generation starts:

  1. The page stays on the current 心愿实现中 screen.
  2. The existing chat bubble and orbit motif remain.
  3. The orbit gets breathing/rotating animation and small star-dot motion.
  4. A rotating hint line appears while no stream text has arrived.
  5. If no stream text arrives after about 8 seconds, show a gentle slow-wait message.
  6. If no stream text arrives after about 20 seconds, show a warmer network-slow message, while still waiting for the stream.
  7. Once stream text arrives, switch to the existing typewriter text output.
  8. If the call fails or returns empty output, keep the user on the generation screen and show a soft failure state with 再试一次 and 返回修改.

Implementation Notes

Only mini-program/src/pages/main/ScriptView.vue needs to change.

Add a small local generation feedback state:

  • generationStatus: idle | waiting | slow | verySlow | streaming | failed
  • generationError: user-facing failure copy
  • timers for rotating hints and long-wait thresholds

Do not change backend API calls or stream protocol. streamAiScene remains the source of stream output. Existing useTypewriterStream continues to render text progressively after the first output arrives.

Validation

Run:

cd mini-program
npm run build:mp-weixin

Expected result: build succeeds with no new errors.