/
Ambitwin · source-available, not open source · © 2026 Nicolò Ghignatti
| Word | Meaning | Example |
|---|---|---|
| Conversation | One person’s thread of questions and answers | “Library heating” |
| Exchange | One question and its answer | “Is room 2 hot?” and the reply |
| History window | The last messages sent along with a new question | Last 10 |
| SSE | Server-Sent Events: the answer arrives word by word on one open response | Text appearing as it is written |
| Frame | One piece of that stream | A word, or “done” |
Realises the Knowledge & Assistance domain, with agent. Rust, MongoDB. Code-level page: Chat Service.
chat remembers conversations. agent answers one question at a time and remembers nothing. Together they make a conversation.
flowchart LR
C["client"] -- "conversations, questions" --> Ch["chat"]
Ch -- "question, history, same claims" --> A["agent"]
Ch --> DB[("MongoDB")]flowchart LR
H["HTTP, and the stream"] --> UC["Use cases: create, list, open, rename, delete, ask"]
UC --> D["Rules: limits, history, titles"]
UC --> P["Ports: store, assistant"]
P -.-> M["MongoDB"]
P -.-> AG["agent, streamed"]Two things outside, so two ports. A test fails the build if a layer imports the wrong way.
sequenceDiagram
participant C as client
participant Ch as chat
participant A as agent
C->>Ch: question
Note over Ch: owner? limits? room left?
Ch->>A: question and last 10 messages
A-->>Ch: words, as written
Ch-->>C: words, as written
A-->>Ch: done, final answer
Note over Ch: save the exchange now
Ch-->>C: done, with the saved message| Rule | Why |
|---|---|
| Only the last 10 messages go along | A long conversation does not grow the cost of each question |
| Stream, do not wait | The first words show in milliseconds, not seconds |
| Save only at the end | A broken answer leaves no half message behind |
| Forward the same claims | agent acts with the person’s own rights, no more |
Errors depend on timing. Before the first word: a normal error status, like 404. After: the status line is already sent as 200, so the error comes as a last frame.
| What | Limit |
|---|---|
| Messages per conversation | 100 |
| Characters per message | 8000 |
| Characters per title | 120 |
Checked before anything is saved.
flush_interval -1 on /chat.