documentation /concept

Chat

Concept

An AI chat panel that can only be attached to a handler’s chat field; it is not a reusable tab-segment module

Placement

Chat placement: a module with this concept may only be referenced from a handler’s chat: slot. Placing it in a tab segment is a type error. A type: page handler renders it as a slide-out panel; a type: chat handler renders it as the whole page.

Outline Display: Chat with an AI assistant using {{queryTools}}

Details

A module with this concept can only be referenced from a handler’s chat: slot. Referencing it from a tab segment is a type error.

Maintains persistent message history in the database, storing each message with its author (User or Assistant), content, and timestamp. Supports LLM tool use during reasoning, including database table lookups, email sending, and web search and page reading through the Search the web and Fetch web page tools. The maximum number of tool call rounds is configurable; the model comes from the chosen LLM connection (a model service setting, or the provider’s default). Users can reset the conversation history.

By default, queryTools is empty: the assistant has no access to app tables, the app outline, or the current user, and answers as a generic chatbot. Make the chat useful by populating queryTools. Sane starting points:

  • One Look up in table per table the LLM should be able to read (use rowFilters with currentUser to scope to the signed-in user).
  • App outline so the LLM understands the app’s structure (tables, pages, modules).
  • Search the web (with a Fetch web page beside it) for open-ended factual questions. Add insert/update/delete tools or Send email when the assistant should take actions, not just answer questions. Any API endpoint wrapped on this app – including endpoints from connected services and custom-defined APIs – can also be exposed to the LLM via Call API endpoint or Call list API endpoint.

A queryTools entry may carry roles: (beside its settings) naming roles the handler’s authenticator declares: only a signed-in user holding any of them gets that tool – for anyone else the model never sees its definition and dispatch treats it as unknown. Absent means every signed-in user; [] means nobody.

Settings

Required

  • LLM Connection : API connection (API category: LLM)
    LLM Connection
    Set this to the name of an api: item whose provider: is in the LLM category, or which reaches LLM on another category’s behalf – a brokered api counts when its own settings point it at that service, and its provider page says which setting decides. Do not set it to a service name; pick the API the service points at.

Optional

  • queryTools : ingredient slot of llmQueryToolIngredients (many)
    Database tables the LLM can query during its reasoning

  • maxToolCalls : constant value (type: integer; required, non-nullable)
    Maximum number of tool call rounds the LLM can make (usually omit this parameter)