6. Runtime view
Chatting with an orb
sequenceDiagram
autonumber
participant C as Client
participant E as Conversation endpoint
participant S as ChatService
participant R as Repositories / DB
participant A as IModelAdapter
participant P as Provider
C->>E: POST /api/conversations/{id}/messages {content}
E->>S: SendAsync(id, content)
S->>R: load conversation, orb, providers, linked context
S->>S: ModelResolver picks provider + model
Note over S: no usable model? -> 409 before anything is stored
S->>R: add user message, save
S-->>E: IAsyncEnumerable<ChatEvent>
E-->>C: 200 text/event-stream
E-->>C: event: start {model}
S->>S: PromptBuilder builds system prompt + history
S->>A: StreamChatAsync(connection, request)
A->>P: POST /chat/completions (stream)
loop every fragment
P-->>A: data: {delta}
A-->>S: text
S-->>C: event: delta {text}
end
S->>R: add assistant message, save
S-->>C: event: done {messageId}
If the provider fails mid-reply, the stream ends with event: error {text} and no assistant message is stored; the user message stays so nothing typed is lost.
Connecting a context source
POST /api/context-sources {name, kind, location | input}.ContextServiceresolves the connector forkindand validates what it needs (a location, or input).- The connector reads the source right away. Success stores the text and marks it
Ready; failure is recorded asFailedwith the error, and the request still succeeds so the user can fix and retry (POST /{id}/sync). - The user links the source to orbs in the orb editor.
First start
- The API applies migrations (PostgreSQL) or creates the schema (SQLite).
- With
Orbs__SeedDemoData=trueand an empty database,DemoSeederadds the Echo provider, a welcome note and Pip. - The web app is served from
wwwroot; unknown paths fall back toindex.htmlfor client-side routing.