UXInteract / task_012 /instruction.md
DojiSum's picture
Publish the current 141-task UXInteract release
ef987bb verified
|
Raw History Blame Contribute Delete
1.82 kB

Keyboard-first prompt composer

Extend the local chat page at /app/index.html to support keyboard submission and an observable offline response. Keep the send button working and preserve data-testid hooks chat-input, send-button, title, response, and status.

Composer and reply behavior

  • Plain Enter submits the current nonblank prompt without adding a newline. Shift+Enter inserts a newline without submitting; let the textarea grow when multiline text exceeds its starting height. Ignore whitespace-only submissions.
  • On send, show that generation is in progress. Use the local mock to produce a single direct, prompt-specific title and readable response text. No suggestion-style introduction or fixed titles/responses. The visible reply first contains partial text, then grows to the final text and leaves loading within five seconds.
  • Expose window.__setMockMode('timeout'|'normal'). In timeout mode, end loading within five seconds, show “Timeout” or “超时” in the status, and keep the reply area visible with timeout or retry feedback. Returning to normal mode permits a successful new submission. Use “Loading” or “生成中” when generating and “Complete” or “完成” on success, or include those terms in a longer status message. No external network is required.

Acceptance Checklist

  • Enter submits promptly without inserting a newline; blank drafts are ignored. Shift+Enter leaves the draft unsent and grows the input for longer multiline content.
  • Two different prompts produce distinct titles and readable responses in the visible reply. The loading state gives way to a partial reply and a longer completed reply.
  • Timeout leaves a visible feedback region and a terminal status; after restoring normal mode, a subsequent request completes offline.