Files
AgenticCode/openspec/changes/archive/2026-04-04-wire-responses-api/proposal.md
local 00e7df2802 feat: wire chat UI to Responses API with streaming
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>
2026-04-04 01:54:28 +01:00

31 lines
1.6 KiB
Markdown

## Why
The chat UI currently returns hardcoded responses. A local OpenAI-compatible proxy is running at `localhost:8317` that exposes the Responses API (`POST /v1/responses`) backed by Anthropic Claude models. This change wires the chat to produce real AI responses via streaming, replacing the hardcoded stub.
## What Changes
- Add a chat endpoint to the API backend that proxies requests to the local Responses API
- Stream tokens from the Responses API back to the WASM client as SSE
- Update ChatApiClient with a streaming chat method
- Replace the hardcoded response in Chat.razor with live streaming from the API
- Add a "thinking" indicator while the assistant is responding
- Disable input during streaming to prevent overlapping requests
## Capabilities
### New Capabilities
- `chat-streaming`: Streaming AI responses from the Responses API proxy through the backend to the WASM client
### Modified Capabilities
- `chat-ui`: Replace hardcoded response with streaming AI response, add typing indicator, disable input during streaming
## Impact
- `src/ChatAgent.Api/ChatAgent.Api.csproj`: Add no new packages (uses built-in HttpClient)
- `src/ChatAgent.Api/Controllers/ChatController.cs`: New controller proxying to Responses API
- `src/ChatAgent.Api/Program.cs`: Register HttpClient for the proxy, add configuration
- `src/ChatAgent.Api/appsettings.json`: New — configure Responses API base URL and model
- `src/ChatAgent.Client/Services/ChatApiClient.cs`: Add streaming chat method
- `src/ChatAgent.Client/Pages/Chat.razor`: Replace hardcoded response with streaming call
- `src/ChatAgent.Shared/Models/`: New request/response DTOs for the chat endpoint