ai sidebar - BevvyTech/BrewskiDocs GitHub Wiki

AI Sidebar

Purpose

  • Provide an always-available assistant that can execute Brewski workflows (navigation, creation dialogs, searches) without leaving the current page.
  • Stream summaries of tool output so operators can review AI actions before confirming them.

Data & Dependencies

  • Establishes a websocket session with the API (/ai/sessions/:id/stream) and persists message history plus session ID in local storage.
  • Consumes the AI tool framework (navigate, start_ui_flow, search tools, docs lookup) and honours the active team context from the auth token.

Key Interactions

  • Accepts freeform prompts; whenever the assistant calls navigate, the sidebar triggers useNavigate to change the current route.
  • When the assistant uses start_ui_flow with target="beer" and a prefill payload, the sidebar opens the “New beer” dialog via quick actions and injects the provided defaults.
  • When a single beer match scores ≥ 40% confidence, the assistant now auto-opens the new batch dialog without requiring a confirmation message.
  • Tool call debug bubbles (and their “Assistant action • …” headings) show only when the debug toggle is enabled, so everyday operators just see the assistant reply while engineers can inspect tool payloads as needed.
  • Brewing intents like “Start brewing Sombrero” trigger a beer search; the assistant confirms if confidence is low, then opens the “New batch” dialog pre-selecting the chosen beer once approved.
  • You can also ask for “the last batch of …” and the sidebar will surface the top match and open the batch detail (with a confirmation step when confidence is low).
  • When the sidebar opens, the message input automatically receives focus so operators can start typing immediately.
  • Debug visibility and the “Latest question only” filter remember their last state via cookies so engineers can keep preferred diagnostics between sessions.
  • Supports other quick actions (order, client, batch) by invoking the corresponding modal through the quick action context.
  • Captures tool debug output (route, props, command) for the built-in trace viewer so engineers can audit the conversation.
  • Recognises light-weight corrections (“name is …”, “it’s called …”) and replays the prefill so operators receive an updated dialog without losing context.
  • Each speech bubble exposes a copy-to-clipboard icon and uses a neutral light-grey text selection highlight so copied snippets are easy to see before sharing.
⚠️ **GitHub.com Fallback** ⚠️