Skip to main content
Users looking at a reviewed record (an application, a claim, an order) often have questions: why was this referred? what is missing? what should I ask the customer? This guide adds a collapsible chat panel to the record’s page that answers from the record’s own data. You will use: a chatbot with per-user sessions and streamed replies.

1. Create the chatbot

chatbots/record-assistant.yaml
Deploy it with your deploy script. Chatbots start disabled; enabled: true turns this one on.

2. Build the context

Write a function in your application that turns the record and its review into compact text:
  • Leave out what the user may not see, and mask identifiers (show the last digits only). The model repeats whatever is in the context.
  • Stay under the message limit (32,000 characters per message): summarise long sections.

3. Sessions: one per user per record

Find the chatbot’s id by name (GET /floware/v1/chatbots, then match namespace and name) instead of hard-coding it.

4. Send messages

When showing history, run user messages through stripContext, so the context block never appears in the panel.

5. The panel

  • Collapsed by default, as a slim bar on the side of the page, so it does not take space until needed; remember the user’s choice in local storage.
  • Suggested questions before the first message: “Why did this record get its decision?”, “What is missing?”, “What should I ask the customer?”.
  • A “new chat” button that starts a fresh session with up-to-date context, because the context is a snapshot from when the session started.
  • Markdown rendering for replies, and a visible error when a turn fails.

Limits to design around

  • Each turn sends the last 50 messages. In a very long conversation, the first message, and the context in it, drops out; the “new chat” button is the remedy.
  • A session keeps the system prompt as it was when the session started. After changing the prompt, new sessions pick it up; old ones keep the old prompt.