AI chat

Multi-turn AI chat textbox embedded in the form, the user converses, the model can write back to form fields.

The AI chat component embeds a multi-turn chat window into the form. Unlike the single-shot AI button, AI chat keeps a conversation history, the user can ask follow-ups, refine a draft, or have the model walk them through filling out the form step by step.

Properties

PropertyDescription
aiPlaceholder
string
default: Ask the AI…
Placeholder text for the user input box.
aiSendLabel
string
default: Send
Label on the send button.
aiGreeting
string
default: Hi! Ask me anything about this form, or tell me what to do.
Greeting bubble shown when the chat first mounts. Leave empty for no greeting.
aiMaxTurns
number
default: 10
Max conversation turns kept in memory before older turns are trimmed.
aiSuccessToast
string
Toast text shown after the AI successfully runs an action.
aiErrorToast
string
Toast text shown when the AI call fails. Defaults to a generic "couldn't run the AI right now" message.
ai
AiConfig
The AI configuration object, see the sub-properties below. Set in the Properties pane via the AI config editor.

The ai object (configured in the Properties pane, serialised with the component) carries:

PropertyDescription
ai.promptTemplate
string
The prompt sent before each user message. Supports the {{form.allFields}} placeholder to inline current form state.
ai.allowedActions
string[]
Allow-list of actions the model may call, e.g. reply, set_field_value, set_field_values, show_toast, append_linked_list_row, append_linked_list_rows. See docs/ai-form-actions.md.
ai.includeAllFields
boolean
default: true
Send the full form field set to the model as context.

JavaScript recipes

AI chat writes back to the form through the same field-value path as any other control, so you react to its actions with ordinary f365.events, there is no separate AI event surface.

React when the chat fills a field

f365.events.onChange((e) => {
  // The chat sets fields via set_field_value, observe it like any change.
  if (e.fieldKey === 'Summary' && e.newValue) {
    f365.field('Status').value = 'Drafted by AI';
  }
});

Seed context the chat can read before the user types

f365.events.onLoad(() => {
  // includeAllFields sends every field to the model, so pre-filling here
  // gives the chat richer starting context.
  if (!f365.field('RequestType').value) {
    f365.field('RequestType').value = 'General enquiry';
  }
});

Validate AI-populated fields before save

f365.events.onBeforeSave(async () => {
  const summary = String(f365.field('Summary').value ?? '');
  if (summary.length < 20) {
    await f365.ui.showAlert('Ask the AI to expand the summary before submitting.');
    return false; // cancels save, keeps the form open
  }
  return true;
});

Related articles

  • AI button

    Single-shot AI action, runs a prompt against the form's current values and applies the model's tool calls back to the form.