Summary
Create a new built-in layout component (<chat>) that renders a persistent multi-turn chat interface backed by an HTTP streaming connection to an LLM API. The component manages conversation history, handles SSE streaming responses, and exposes handler hooks for message interception.
Context
Usage:
<chat id="assistant"
api-url="${env.ANTHROPIC_API_URL}"
api-key="${env.ANTHROPIC_API_KEY}"
model="claude-sonnet-4-6"
system-prompt="You are a Nemo configuration assistant..."
placeholder="Describe the UI you want to build..." />
This is a general-purpose component — any Nemo application can embed a chat panel, not just the authoring assistant. It needs to:
- Render a scrollable message list with user/assistant role indicators
- Provide a text input area at the bottom
- Stream LLM responses in real-time via SSE
- Maintain conversation history in component state
- Support configurable system prompts and model selection
The HTTP streaming backend reuses nemo-integration::HttpClient with SSE support (built in the generate command work), or can use its own streaming implementation.
Acceptance Criteria
Relevant Files
crates/nemo-registry/src/builtins.rs — component registration
crates/nemo/src/components/ — component implementations
crates/nemo/src/components/state.rs — component state management
crates/nemo-integration/src/http.rs — HTTP client
crates/nemo-data/src/sources/http.rs — HTTP data source (SSE patterns)
Stack Base
- Stack on:
main
- Blocked by: none (can be developed independently — chat component needs HTTP streaming but doesn't depend on the generate command)
Summary
Create a new built-in layout component (
<chat>) that renders a persistent multi-turn chat interface backed by an HTTP streaming connection to an LLM API. The component manages conversation history, handles SSE streaming responses, and exposes handler hooks for message interception.Context
Usage:
This is a general-purpose component — any Nemo application can embed a chat panel, not just the authoring assistant. It needs to:
The HTTP streaming backend reuses
nemo-integration::HttpClientwith SSE support (built in the generate command work), or can use its own streaming implementation.Acceptance Criteria
<chat>registered as a built-in component innemo-registry/src/builtins.rsunderComponentCategory::Displayor a new categoryapi-url(string, required) — LLM endpoint URLapi-key(string, required) — API keymodel(string, default: provider default) — model namesystem-prompt(string) — system prompt textplaceholder(string, default: "Type a message...") — input placeholdermax-tokens(integer) — response token limiton-messagehandler hook: RHAI scripts can inspect/transform messages before sendingon-responsehandler hook: scripts can intercept the final assistant responseRelevant Files
crates/nemo-registry/src/builtins.rs— component registrationcrates/nemo/src/components/— component implementationscrates/nemo/src/components/state.rs— component state managementcrates/nemo-integration/src/http.rs— HTTP clientcrates/nemo-data/src/sources/http.rs— HTTP data source (SSE patterns)Stack Base
main