Add ChatController that proxies POST /api/chat to the local Responses API (localhost:8317/v1/responses) with SSE streaming. Client reads tokens via SetBrowserResponseStreamingEnabled and renders them incrementally. Includes thinking indicator, input disabled during streaming, and error handling. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
51 lines
1.7 KiB
Markdown
51 lines
1.7 KiB
Markdown
## MODIFIED Requirements
|
|
|
|
### Requirement: Hardcoded response
|
|
|
|
The assistant SHALL reply with a real AI response streamed from the backend API, replacing the previous hardcoded stub. Tokens appear incrementally as they arrive.
|
|
|
|
#### Scenario: Bot replies with streamed AI response
|
|
|
|
- **WHEN** the user sends any message
|
|
- **THEN** the assistant message appears and grows token by token as the stream delivers text
|
|
|
|
### Requirement: Message input
|
|
|
|
The chat page SHALL provide a text input area at the bottom of the page where the user can type and submit messages.
|
|
|
|
#### Scenario: Submit via button
|
|
|
|
- **WHEN** the user types text and clicks the send button
|
|
- **THEN** the message is added to the conversation and the input is cleared
|
|
|
|
#### Scenario: Submit via Enter key
|
|
|
|
- **WHEN** the user types text and presses Enter
|
|
- **THEN** the message is submitted (same as clicking send)
|
|
|
|
#### Scenario: Empty input blocked
|
|
|
|
- **WHEN** the user attempts to send an empty or whitespace-only message
|
|
- **THEN** nothing is sent and no message is added
|
|
|
|
#### Scenario: Input disabled during streaming
|
|
|
|
- **WHEN** the assistant is currently streaming a response
|
|
- **THEN** the input field and send button are disabled until streaming completes
|
|
|
|
## ADDED Requirements
|
|
|
|
### Requirement: Thinking indicator
|
|
|
|
The chat page SHALL show a visual indicator while waiting for the first token from the assistant.
|
|
|
|
#### Scenario: Indicator shown during wait
|
|
|
|
- **WHEN** the user sends a message and the assistant has not yet started streaming
|
|
- **THEN** a thinking indicator (e.g., animated dots) is shown in the assistant message area
|
|
|
|
#### Scenario: Indicator replaced by content
|
|
|
|
- **WHEN** the first token arrives from the stream
|
|
- **THEN** the thinking indicator is replaced by the streamed text
|