@lowdefy/docs-content 0.0.0-experimental-20260710073520

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +20 -0
  3. package/content/actions/callapi.md +66 -0
  4. package/content/actions/callmethod.md +41 -0
  5. package/content/actions/copytoclipboard.md +32 -0
  6. package/content/actions/displaymessage.md +53 -0
  7. package/content/actions/downloadcsv.md +89 -0
  8. package/content/actions/fetch.md +50 -0
  9. package/content/actions/geolocationcurrentposition.md +56 -0
  10. package/content/actions/link.md +104 -0
  11. package/content/actions/login.md +85 -0
  12. package/content/actions/logout.md +56 -0
  13. package/content/actions/pdfmake.md +304 -0
  14. package/content/actions/request.md +67 -0
  15. package/content/actions/reset.md +27 -0
  16. package/content/actions/resetvalidation.md +85 -0
  17. package/content/actions/scrollto.md +85 -0
  18. package/content/actions/setdarkmode.md +62 -0
  19. package/content/actions/setfocus.md +33 -0
  20. package/content/actions/setglobal.md +63 -0
  21. package/content/actions/setlocale.md +69 -0
  22. package/content/actions/setstate.md +70 -0
  23. package/content/actions/throw.md +72 -0
  24. package/content/actions/validate.md +87 -0
  25. package/content/actions/wait.md +24 -0
  26. package/content/agents/agent-endpoint-tools.md +190 -0
  27. package/content/agents/agent-mcp-tools.md +124 -0
  28. package/content/agents/agent-multi-agent.md +136 -0
  29. package/content/agents/agent-properties.md +174 -0
  30. package/content/agents/agent-server-hooks.md +336 -0
  31. package/content/agents/agentchat.md +515 -0
  32. package/content/agents/agentconversations.md +148 -0
  33. package/content/concepts/ai-agent-docs.md +190 -0
  34. package/content/concepts/cli.md +213 -0
  35. package/content/concepts/connections-and-requests.md +7 -0
  36. package/content/concepts/custom-html.md +3 -0
  37. package/content/concepts/custom-styling.md +161 -0
  38. package/content/concepts/events-and-actions.md +271 -0
  39. package/content/concepts/hosting-files.md +18 -0
  40. package/content/concepts/i18n.md +320 -0
  41. package/content/concepts/keyboard-shortcuts.md +218 -0
  42. package/content/concepts/layout-overview.md +478 -0
  43. package/content/concepts/lists.md +144 -0
  44. package/content/concepts/logger.md +43 -0
  45. package/content/concepts/lowdefy-schema.md +365 -0
  46. package/content/concepts/menus.md +144 -0
  47. package/content/concepts/module-authoring.md +564 -0
  48. package/content/concepts/modules.md +338 -0
  49. package/content/concepts/operators.md +45 -0
  50. package/content/concepts/overview.md +19 -0
  51. package/content/concepts/references-and-templates.md +207 -0
  52. package/content/concepts/secrets.md +24 -0
  53. package/content/concepts/selectors.md +143 -0
  54. package/content/connections/amazonredshift.md +176 -0
  55. package/content/connections/anthropic.md +232 -0
  56. package/content/connections/awss3.md +313 -0
  57. package/content/connections/azureblobstorage.md +133 -0
  58. package/content/connections/elasticsearch.md +371 -0
  59. package/content/connections/google.md +228 -0
  60. package/content/connections/googlecloudstorage.md +139 -0
  61. package/content/connections/googlesheet.md +313 -0
  62. package/content/connections/knex.md +206 -0
  63. package/content/connections/mariadb.md +177 -0
  64. package/content/connections/mcp.md +134 -0
  65. package/content/connections/mongodb.md +739 -0
  66. package/content/connections/mssql.md +191 -0
  67. package/content/connections/mysql.md +192 -0
  68. package/content/connections/openai-connection.md +228 -0
  69. package/content/connections/postgresql.md +200 -0
  70. package/content/connections/redis.md +116 -0
  71. package/content/connections/sendgridmail.md +94 -0
  72. package/content/connections/smtp.md +149 -0
  73. package/content/connections/sqlite.md +187 -0
  74. package/content/connections/stripe.md +115 -0
  75. package/content/container-blocks/affix.md +413 -0
  76. package/content/container-blocks/alert.md +937 -0
  77. package/content/container-blocks/badge.md +1222 -0
  78. package/content/container-blocks/box.md +1453 -0
  79. package/content/container-blocks/card.md +1200 -0
  80. package/content/container-blocks/carousel.md +2247 -0
  81. package/content/container-blocks/collapse.md +1335 -0
  82. package/content/container-blocks/configprovider.md +1070 -0
  83. package/content/container-blocks/confirmmodal.md +1159 -0
  84. package/content/container-blocks/content.md +597 -0
  85. package/content/container-blocks/descriptions.md +870 -0
  86. package/content/container-blocks/drawer.md +1379 -0
  87. package/content/container-blocks/dropdownmenu.md +643 -0
  88. package/content/container-blocks/flex.md +1510 -0
  89. package/content/container-blocks/footer.md +380 -0
  90. package/content/container-blocks/googlemaps.md +546 -0
  91. package/content/container-blocks/googlemapsheatmap.md +607 -0
  92. package/content/container-blocks/googlemapsscript.md +61 -0
  93. package/content/container-blocks/header.md +302 -0
  94. package/content/container-blocks/label.md +739 -0
  95. package/content/container-blocks/layout.md +604 -0
  96. package/content/container-blocks/masonry.md +1090 -0
  97. package/content/container-blocks/mobilemenu.md +1244 -0
  98. package/content/container-blocks/modal.md +1180 -0
  99. package/content/container-blocks/pageheadermenu.md +614 -0
  100. package/content/container-blocks/pagesidebarlayout.md +438 -0
  101. package/content/container-blocks/pagesidermenu.md +651 -0
  102. package/content/container-blocks/popover.md +1421 -0
  103. package/content/container-blocks/result.md +972 -0
  104. package/content/container-blocks/sider.md +1064 -0
  105. package/content/container-blocks/span.md +747 -0
  106. package/content/container-blocks/spinner.md +267 -0
  107. package/content/container-blocks/splitter.md +1735 -0
  108. package/content/container-blocks/tabs.md +1718 -0
  109. package/content/container-blocks/tooltip.md +1274 -0
  110. package/content/container-blocks/watermark.md +515 -0
  111. package/content/controls/for.md +103 -0
  112. package/content/controls/if.md +107 -0
  113. package/content/controls/log.md +50 -0
  114. package/content/controls/parallel.md +71 -0
  115. package/content/controls/parallel_for.md +36 -0
  116. package/content/controls/reject.md +56 -0
  117. package/content/controls/return.md +66 -0
  118. package/content/controls/set_state.md +98 -0
  119. package/content/controls/switch.md +90 -0
  120. package/content/controls/throw.md +79 -0
  121. package/content/controls/try.md +88 -0
  122. package/content/deployment/docker.md +149 -0
  123. package/content/deployment/node-server.md +27 -0
  124. package/content/deployment/vercel.md +101 -0
  125. package/content/display-blocks/aggrid.md +1459 -0
  126. package/content/display-blocks/anchor.md +336 -0
  127. package/content/display-blocks/avatar.md +1154 -0
  128. package/content/display-blocks/breadcrumb.md +517 -0
  129. package/content/display-blocks/button.md +758 -0
  130. package/content/display-blocks/calendar.md +156 -0
  131. package/content/display-blocks/dangeroushtml.md +314 -0
  132. package/content/display-blocks/dangerousmarkdown.md +423 -0
  133. package/content/display-blocks/diffgit.md +44 -0
  134. package/content/display-blocks/difflist.md +225 -0
  135. package/content/display-blocks/diffsidebyside.md +56 -0
  136. package/content/display-blocks/difftimeline.md +94 -0
  137. package/content/display-blocks/divider.md +406 -0
  138. package/content/display-blocks/download.md +60 -0
  139. package/content/display-blocks/dropdownbutton.md +661 -0
  140. package/content/display-blocks/echart.md +418 -0
  141. package/content/display-blocks/floatbutton.md +545 -0
  142. package/content/display-blocks/html.md +311 -0
  143. package/content/display-blocks/icon.md +717 -0
  144. package/content/display-blocks/img.md +479 -0
  145. package/content/display-blocks/markdown.md +520 -0
  146. package/content/display-blocks/markdownwithcode.md +730 -0
  147. package/content/display-blocks/menu.md +1123 -0
  148. package/content/display-blocks/message.md +941 -0
  149. package/content/display-blocks/notification.md +1410 -0
  150. package/content/display-blocks/paragraph.md +643 -0
  151. package/content/display-blocks/progress.md +818 -0
  152. package/content/display-blocks/qrcode.md +519 -0
  153. package/content/display-blocks/s3download.md +240 -0
  154. package/content/display-blocks/search.md +360 -0
  155. package/content/display-blocks/skeleton.md +272 -0
  156. package/content/display-blocks/skeletonavatar.md +222 -0
  157. package/content/display-blocks/skeletonbutton.md +245 -0
  158. package/content/display-blocks/skeletoninput.md +223 -0
  159. package/content/display-blocks/skeletonparagraph.md +201 -0
  160. package/content/display-blocks/statistic.md +485 -0
  161. package/content/display-blocks/steps.md +585 -0
  162. package/content/display-blocks/tag.md +620 -0
  163. package/content/display-blocks/title.md +654 -0
  164. package/content/display-blocks/tour.md +2359 -0
  165. package/content/input-blocks/autocomplete.md +786 -0
  166. package/content/input-blocks/buttonselector.md +964 -0
  167. package/content/input-blocks/checkboxselector.md +765 -0
  168. package/content/input-blocks/checkboxswitch.md +497 -0
  169. package/content/input-blocks/colorselector.md +884 -0
  170. package/content/input-blocks/daterangeselector.md +777 -0
  171. package/content/input-blocks/dateselector.md +693 -0
  172. package/content/input-blocks/datetimeselector.md +791 -0
  173. package/content/input-blocks/inputgallery.md +528 -0
  174. package/content/input-blocks/monthselector.md +717 -0
  175. package/content/input-blocks/multipleselector.md +1337 -0
  176. package/content/input-blocks/numberinput.md +855 -0
  177. package/content/input-blocks/pagination.md +679 -0
  178. package/content/input-blocks/paragraphinput.md +1664 -0
  179. package/content/input-blocks/passwordinput.md +480 -0
  180. package/content/input-blocks/phonenumberinput.md +688 -0
  181. package/content/input-blocks/radioselector.md +820 -0
  182. package/content/input-blocks/ratingslider.md +684 -0
  183. package/content/input-blocks/s3uploadbutton.md +384 -0
  184. package/content/input-blocks/s3uploaddragger.md +305 -0
  185. package/content/input-blocks/s3uploadphoto.md +288 -0
  186. package/content/input-blocks/segmentedselector.md +782 -0
  187. package/content/input-blocks/selector.md +1162 -0
  188. package/content/input-blocks/switch.md +552 -0
  189. package/content/input-blocks/textarea.md +714 -0
  190. package/content/input-blocks/textinput.md +639 -0
  191. package/content/input-blocks/tiptapinput.md +226 -0
  192. package/content/input-blocks/tiptapmentioninput.md +471 -0
  193. package/content/input-blocks/titleinput.md +1094 -0
  194. package/content/input-blocks/treeinput.md +144 -0
  195. package/content/input-blocks/treemultipleselector.md +162 -0
  196. package/content/input-blocks/treeselector.md +185 -0
  197. package/content/input-blocks/upload.md +149 -0
  198. package/content/input-blocks/uploaddragger.md +85 -0
  199. package/content/input-blocks/uploadphoto.md +84 -0
  200. package/content/input-blocks/weekselector.md +630 -0
  201. package/content/list-blocks/controlledlist.md +498 -0
  202. package/content/list-blocks/list.md +529 -0
  203. package/content/list-blocks/listselector.md +301 -0
  204. package/content/list-blocks/masonrylist.md +230 -0
  205. package/content/migration/upgrade-guide.md +106 -0
  206. package/content/migration/v4-to-v5.md +589 -0
  207. package/content/migration/v5-to-v6.md +36 -0
  208. package/content/operators/_actions.md +58 -0
  209. package/content/operators/_and.md +76 -0
  210. package/content/operators/_api.md +254 -0
  211. package/content/operators/_app.md +114 -0
  212. package/content/operators/_args.md +65 -0
  213. package/content/operators/_array.md +331 -0
  214. package/content/operators/_base64.md +49 -0
  215. package/content/operators/_boolean.md +33 -0
  216. package/content/operators/_build.md +166 -0
  217. package/content/operators/_change_case.md +357 -0
  218. package/content/operators/_date.md +415 -0
  219. package/content/operators/_dayjs.md +128 -0
  220. package/content/operators/_diff.md +61 -0
  221. package/content/operators/_divide.md +32 -0
  222. package/content/operators/_eq.md +52 -0
  223. package/content/operators/_event.md +86 -0
  224. package/content/operators/_function.md +52 -0
  225. package/content/operators/_get.md +92 -0
  226. package/content/operators/_global.md +86 -0
  227. package/content/operators/_gt.md +50 -0
  228. package/content/operators/_gte.md +50 -0
  229. package/content/operators/_hash.md +112 -0
  230. package/content/operators/_if.md +30 -0
  231. package/content/operators/_if_none.md +47 -0
  232. package/content/operators/_index.md +48 -0
  233. package/content/operators/_input.md +86 -0
  234. package/content/operators/_intl.md +135 -0
  235. package/content/operators/_item.md +166 -0
  236. package/content/operators/_js.md +113 -0
  237. package/content/operators/_json.md +120 -0
  238. package/content/operators/_jsonata.md +152 -0
  239. package/content/operators/_locale.md +65 -0
  240. package/content/operators/_location.md +40 -0
  241. package/content/operators/_log.md +22 -0
  242. package/content/operators/_lt.md +50 -0
  243. package/content/operators/_lte.md +50 -0
  244. package/content/operators/_math.md +407 -0
  245. package/content/operators/_media.md +83 -0
  246. package/content/operators/_menu.md +62 -0
  247. package/content/operators/_module.md +340 -0
  248. package/content/operators/_mql.md +95 -0
  249. package/content/operators/_ne.md +62 -0
  250. package/content/operators/_not.md +33 -0
  251. package/content/operators/_number.md +159 -0
  252. package/content/operators/_nunjucks.md +117 -0
  253. package/content/operators/_object.md +253 -0
  254. package/content/operators/_operator.md +33 -0
  255. package/content/operators/_or.md +67 -0
  256. package/content/operators/_product.md +45 -0
  257. package/content/operators/_random.md +90 -0
  258. package/content/operators/_ref.md +80 -0
  259. package/content/operators/_regex.md +69 -0
  260. package/content/operators/_request.md +35 -0
  261. package/content/operators/_request_details.md +29 -0
  262. package/content/operators/_secret.md +56 -0
  263. package/content/operators/_state.md +134 -0
  264. package/content/operators/_step.md +98 -0
  265. package/content/operators/_string.md +327 -0
  266. package/content/operators/_subtract.md +24 -0
  267. package/content/operators/_sum.md +45 -0
  268. package/content/operators/_switch.md +37 -0
  269. package/content/operators/_t.md +96 -0
  270. package/content/operators/_theme.md +65 -0
  271. package/content/operators/_type.md +78 -0
  272. package/content/operators/_uri.md +49 -0
  273. package/content/operators/_url_query.md +92 -0
  274. package/content/operators/_user.md +154 -0
  275. package/content/operators/_uuid.md +118 -0
  276. package/content/operators/_var.md +88 -0
  277. package/content/operators/_yaml.md +96 -0
  278. package/content/other/introduction.md +39 -0
  279. package/content/other/next-auth-providers.md +3 -0
  280. package/content/other/updatesession.md +26 -0
  281. package/content/plugins/plugins-actions.md +80 -0
  282. package/content/plugins/plugins-connections.md +98 -0
  283. package/content/plugins/plugins-dev.md +138 -0
  284. package/content/plugins/plugins-introduction.md +29 -0
  285. package/content/plugins/plugins-operators.md +71 -0
  286. package/content/testing/e2e-auth.md +108 -0
  287. package/content/testing/e2e-configuration.md +107 -0
  288. package/content/testing/e2e-getting-started.md +96 -0
  289. package/content/testing/e2e-introduction.md +53 -0
  290. package/content/testing/e2e-mocking.md +155 -0
  291. package/content/testing/e2e-writing-tests.md +214 -0
  292. package/content/tutorial/tutorial-actions-operators.md +222 -0
  293. package/content/tutorial/tutorial-add-blocks.md +86 -0
  294. package/content/tutorial/tutorial-create-page.md +57 -0
  295. package/content/tutorial/tutorial-display-data-page.md +181 -0
  296. package/content/tutorial/tutorial-next-steps.md +53 -0
  297. package/content/tutorial/tutorial-requests-sql.md +22 -0
  298. package/content/tutorial/tutorial-start.md +71 -0
  299. package/content/user-authentication/auth-providers.md +15 -0
  300. package/content/user-authentication/login-and-logout.md +122 -0
  301. package/content/user-authentication/users-introduction.md +31 -0
  302. package/index.json +2281 -0
  303. package/package.json +34 -0
  304. package/scripts/extractAgentDocs.js +130 -0
@@ -0,0 +1,515 @@
1
+ # AgentChat
2
+
3
+ The `AgentChat` block renders a streaming AI chat interface. It connects to a [Lowdefy agent](/agents-introduction) and handles message sending, streaming responses, tool approvals, file attachments, and conversation management.
4
+
5
+ > The `AgentChat` block is provided by the `@lowdefy/blocks-antd-x` package, which is included by default.
6
+
7
+ ###### Minimal example:
8
+ ```yaml
9
+ - id: chat
10
+ type: AgentChat
11
+ properties:
12
+ agentId: assistant
13
+ ```
14
+
15
+ ###### Full-featured example:
16
+ ```yaml
17
+ - id: chat
18
+ type: AgentChat
19
+ properties:
20
+ agentId: support_agent
21
+ conversationId:
22
+ _state: activeConversationId
23
+ welcome:
24
+ title: How can we help?
25
+ description: Ask about products, orders, or returns.
26
+ prompts:
27
+ - label: Find a product
28
+ description: Search our catalog
29
+ - label: Track my order
30
+ description: Look up order status
31
+ messageDisplay:
32
+ showReasoning: false
33
+ toolResultDisplay: summary
34
+ actions:
35
+ copy: true
36
+ feedback: true
37
+ regenerate: true
38
+ roles:
39
+ assistant:
40
+ name: Support Bot
41
+ avatar: /images/bot.png
42
+ sender:
43
+ placeholder: Describe your issue...
44
+ attachments:
45
+ enabled: true
46
+ accept: image/*,.pdf
47
+ events:
48
+ onMessageComplete:
49
+ - id: save_state
50
+ type: SetState
51
+ params:
52
+ lastResponse:
53
+ _event: content
54
+ onTitleGenerated:
55
+ - id: update_title
56
+ type: SetState
57
+ params:
58
+ conversationTitle:
59
+ _event: title
60
+ ```
61
+
62
+ ## Properties
63
+
64
+ ### Core
65
+
66
+ | Property | Type | Default | Description |
67
+ | --- | --- | --- | --- |
68
+ | `agentId` | string | | __Required__ - The `id` of the agent to connect to. |
69
+ | `conversationId` | string | | Active conversation ID. When this changes, messages are cleared. If left empty, the block auto-mints a stable id for the session and surfaces it via `onConversationStart`, so every turn posts a consistent id. App-supplied ids are always authoritative. |
70
+ | `messages` | array | | Load messages externally. `undefined` = no sync, `null` = clear, array = load. |
71
+ | `urlQuery` | object | | Query parameters sent with each request. Available server-side via `_payload`. |
72
+ | `sharedState` | object | | Two-way bridge between page state and the agent. See [Shared State](#shared-state). |
73
+ | `height` | string | `'calc(100dvh - 170px)'` | CSS height of the chat container. Only applies when `display` is `'inline'`. |
74
+ | `maxWidth` | number | `800` | Maximum width in pixels. |
75
+ | `display` | string | `'inline'` | `'inline'` renders directly on the page. `'drawer'` renders in a slide-out drawer. |
76
+
77
+ ### Welcome Screen
78
+
79
+ Shown when the chat has no messages. Clicking a prompt sends the `label` as a message.
80
+
81
+ - `welcome: object`:
82
+ - `title: string`: Welcome title.
83
+ - `description: string`: Welcome description.
84
+ - `icon`: Icon to display.
85
+ - `variant: string`: `'filled'` or `'borderless'`.
86
+ - `prompts: object[]`: Suggested prompts. Each item:
87
+ - `label: string`: Button label (sent as message when clicked).
88
+ - `description: string`: Button description.
89
+ - `icon`: Button icon.
90
+
91
+ ### Suggestions
92
+
93
+ Shown below the last assistant message. Clicking a suggestion sends its `label` as the next message.
94
+
95
+ - `suggestions: object[]`: Static suggestions. Each item:
96
+ - `key: string`: Unique key.
97
+ - `label: string`: Suggestion text.
98
+ - `description: string`: Optional description.
99
+ - `icon`: Optional icon.
100
+
101
+ Dynamic suggestions can be sent from the agent's `onFinish` hook as `data-suggestions` data parts. They replace any static suggestions.
102
+
103
+ ### Message Display
104
+
105
+ - `messageDisplay: object`:
106
+
107
+ | Property | Type | Default | Description |
108
+ | --- | --- | --- | --- |
109
+ | `markdownRendering` | boolean | `true` | Render markdown in messages. |
110
+ | `renderMermaid` | boolean | `true` | Render Mermaid diagrams in code blocks. |
111
+ | `codeHighlighter` | boolean | `true` | Syntax-highlight code blocks. |
112
+ | `renderLatex` | boolean | `false` | Render LaTeX math expressions. |
113
+ | `showThoughtChain` | boolean | `true` | Show the tool call chain. |
114
+ | `showReasoning` | boolean | `true` | Show reasoning/thinking content. |
115
+ | `reasoningDisplay` | string | `'interleaved'` | `'interleaved'` shows reasoning inline, `'grouped'` groups it. |
116
+ | `showSources` | boolean | `false` | Show source citations from tool results. |
117
+ | `showStatusUpdates` | boolean | `true` | Show status update messages. |
118
+ | `showStepSeparators` | boolean | `false` | Show separators between agent steps. |
119
+ | `showToolInputStreaming` | boolean | `true` | Show tool input as it streams. |
120
+ | `editableMessages` | boolean | `true` | Allow editing sent messages by clicking on them. |
121
+ | `thinkingMessages` | string \| string[] | | Optional label shown next to the typing dots on a loading assistant bubble. Pass a string for a single label, or an array to rotate through several. Leave unset to show dots only. |
122
+ | `thinkingMessageDelay` | number | `3000` | Milliseconds of continuous loading before the first `thinkingMessages` label appears. Clamped to a 500 ms minimum. Ignored when `thinkingMessages` is unset. |
123
+ | `thinkingMessageRotationInterval` | number | `8000` | Milliseconds between label rotations when `thinkingMessages` is an array with 2 or more entries. Minimum 500 ms. Ignored for a single string. |
124
+
125
+ #### Tool Result Display
126
+
127
+ - `messageDisplay.toolResultDisplay: string | object`: Default: `'summary'` - How to show tool results.
128
+ - `'summary'` — Collapsed summary.
129
+ - `'full'` — Full JSON output.
130
+ - `'readable'` — Formatted, readable view.
131
+ - `'none'` — Hidden.
132
+ - As an object for per-tool settings:
133
+
134
+ ```yaml
135
+ messageDisplay:
136
+ toolResultDisplay:
137
+ default: summary
138
+ search-products: full
139
+ get-analytics: readable
140
+ ```
141
+
142
+ #### Source Display
143
+
144
+ - `messageDisplay.sourcesDisplay: object`:
145
+ - `inline: boolean`: Default: `false` - Show sources inline instead of in a collapsible section.
146
+ - `expandIconPosition: string`: Default: `'end'` - Position of the expand icon. `'start'` or `'end'`.
147
+
148
+ #### Message Actions
149
+
150
+ - `messageDisplay.actions: string[] | object`: Action buttons on messages.
151
+ - Array form: `['copy', 'feedback', 'regenerate', 'delete', 'audio']`
152
+ - Object form with defaults:
153
+
154
+ | Action | Default | Description |
155
+ | --- | --- | --- |
156
+ | `copy` | `true` | Copy message text. |
157
+ | `feedback` | `true` | Thumbs up/down rating. |
158
+ | `regenerate` | `false` | Regenerate the response. |
159
+ | `delete` | `false` | Delete the message. |
160
+ | `audio` | `false` | Text-to-speech playback. |
161
+
162
+ #### Roles
163
+
164
+ Customize message appearance by role:
165
+
166
+ - `messageDisplay.roles: object`:
167
+ - `assistant: object`:
168
+ - `name: string`: Display name.
169
+ - `avatar: string`: Avatar image URL.
170
+ - `variant: string`: `'filled'`, `'outlined'`, `'shadow'`, or `'borderless'`.
171
+ - `shape: string`: `'default'`, `'round'`, or `'corner'`.
172
+ - `user: object`: Same properties as `assistant`.
173
+
174
+ ```yaml
175
+ messageDisplay:
176
+ roles:
177
+ assistant:
178
+ name: Acme AI
179
+ avatar: /images/acme-bot.png
180
+ variant: filled
181
+ shape: round
182
+ user:
183
+ name: You
184
+ variant: outlined
185
+ ```
186
+
187
+ ### Sender
188
+
189
+ - `sender: object`:
190
+ - `placeholder: string`: Default: `'Type a message...'` — Input placeholder. When `config.i18n` is configured, falls back to the localized `agent.sender.placeholder` builtin key. See the [i18n concept page](/i18n) for the full list of localizable agent UI keys (tool approval buttons, message actions, tool-result captions, etc.).
191
+ - `submitType: string`: Default: `'enter'` - Submit key. `'enter'` or `'shiftEnter'`.
192
+ - `allowSpeech: boolean`: Default: `false` - Enable speech input.
193
+
194
+ #### File Attachments
195
+
196
+ - `sender.attachments: object`:
197
+ - `enabled: boolean`: Enable file attachments.
198
+ - `accept: string`: Accepted MIME types (e.g. `'image/*,.pdf'`).
199
+ - `maxSize: number`: Maximum file size in bytes.
200
+ - `uploadPolicyRequestId: string`: Id of an upload-policy request (e.g. `AwsS3PresignedPostPolicy`, `GcsSignedPostPolicy`, `AzureBlobUploadSas`). When set, files are uploaded to storage and their URLs are sent to the model instead of base64 data.
201
+ - `downloadPolicyRequestId: string`: Id of a download request used to resolve the URL of an uploaded attachment. The URL is fetched by the model provider, so it must remain reachable — set `public: true` on the request for public buckets, or use a long expiry. When unset, a legacy unsigned object URL is constructed from the upload response (S3-shaped, deprecated).
202
+ - `s3PostPolicyRequestId: string`: __Deprecated__ — use `uploadPolicyRequestId` instead.
203
+
204
+ ###### Attachments uploaded to storage:
205
+ ```yaml
206
+ sender:
207
+ attachments:
208
+ enabled: true
209
+ accept: image/*,.pdf,.docx
210
+ maxSize: 10485760
211
+ uploadPolicyRequestId: get_upload_policy
212
+ downloadPolicyRequestId: get_download_url
213
+ ```
214
+
215
+ #### Sender Switches
216
+
217
+ Toggle switches in the sender footer. The switch state is included in the `onBeforeSend` event and in message metadata.
218
+
219
+ - `sender.switches: object[]`: Each item:
220
+ - `key: string`: __Required__ - Unique key.
221
+ - `label: string`: __Required__ - Switch label.
222
+ - `icon`: Optional icon.
223
+ - `default: boolean`: Default: `false` - Initial state.
224
+
225
+ ```yaml
226
+ sender:
227
+ switches:
228
+ - key: deep_research
229
+ label: Deep Research
230
+ icon: AiOutlineSearch
231
+ default: false
232
+ - key: use_knowledge_base
233
+ label: Use Knowledge Base
234
+ default: true
235
+ ```
236
+
237
+ ### Drawer Mode
238
+
239
+ Display the chat in a slide-out drawer with a floating button trigger:
240
+
241
+ - `drawer: object`: (only when `display: 'drawer'`)
242
+ - `placement: string`: Default: `'right'` - `'left'`, `'right'`, `'top'`, or `'bottom'`.
243
+ - `width: number`: Drawer width in pixels.
244
+ - `title: string`: Drawer title text.
245
+
246
+ ```yaml
247
+ properties:
248
+ agentId: assistant
249
+ display: drawer
250
+ drawer:
251
+ placement: right
252
+ width: 500
253
+ title: AI Assistant
254
+ ```
255
+
256
+ ### Shared State
257
+
258
+ `sharedState` is a two-way bridge between the page's state and the agent. It is an operator expression that is evaluated at send time, so the latest values are always forwarded.
259
+
260
+ When the evaluated value is a non-empty object, the block:
261
+
262
+ 1. Sends the object with each request. It is available server-side via `_payload` and is included in the agent's context block when the agent has [`pageContext: true`](/agent-properties).
263
+ 2. Auto-registers the platform `update-page-state` tool for that turn. The tool's description lists the top-level keys currently in `sharedState`, so the model knows exactly what it can write.
264
+
265
+ When the agent calls `update-page-state`, the block routes the write through a synthetic `SetState` event. Only keys currently exposed in `sharedState` are applied — any other keys in the agent's call are dropped and returned to the agent as `ignored: [...]` in the tool result so it can self-correct next turn.
266
+
267
+ ###### Expose the entire page state:
268
+ ```yaml
269
+ - id: chat
270
+ type: AgentChat
271
+ properties:
272
+ agentId: assistant
273
+ sharedState:
274
+ _state: true
275
+ ```
276
+
277
+ ###### Expose a curated shape:
278
+ ```yaml
279
+ - id: chat
280
+ type: AgentChat
281
+ properties:
282
+ agentId: form_filler
283
+ sharedState:
284
+ legal_name:
285
+ _state: legal_name
286
+ registration_number:
287
+ _state: registration_number
288
+ ```
289
+
290
+ With the curated form above, the agent can read `legal_name` and `registration_number`, and calling `update-page-state` with either key writes straight back into the page state — no custom endpoint or `onToolResult` handler required.
291
+
292
+ ## Events
293
+
294
+ | Event | When | Event data |
295
+ | --- | --- | --- |
296
+ | `onBeforeSend` | Before a message is sent. Return `success: false` to cancel. | `text`, `files`, `messages`, `switches` |
297
+ | `onConversationStart` | Once per conversation, on its first user message. | `conversationId` |
298
+ | `onUserMessage` | User sends a message. | `role`, `content`, `messageId`, `parts`, `messages` |
299
+ | `onMessageComplete` | Agent finishes responding. | `role`, `content`, `messageId`, `parts`, `finishReason`, `isAbort`, `isDisconnect`, `messages` |
300
+ | `onToolCall` | Agent calls a tool. | `toolName`, `toolCallId`, `input` |
301
+ | `onToolResult` | A tool returns a result. | `toolName`, `toolCallId`, `output`, `error` |
302
+ | `onError` | A streaming error occurs. | `message` |
303
+ | `onStop` | User stops generation. | `messages` |
304
+ | `onFeedback` | User clicks thumbs up/down. | `messageId`, `messageContent`, `rating` |
305
+ | `onRegenerate` | User clicks regenerate. | `messageId`, `messages` |
306
+ | `onDeleteMessage` | User deletes a message. | `messageId`, `content`, `messages` |
307
+ | `onEditMessage` | User edits and resubmits. | `messageId`, `originalContent`, `newContent`, `messages` |
308
+ | `onSuggestionClick` | User clicks a suggestion. | `suggestion` |
309
+ | `onSwitchChange` | User toggles a sender switch. | `key`, `checked` |
310
+ | `onTitleGenerated` | A `data-chat-title` data part arrives — emitted automatically when the agent's [`generateTitle`](/agent-properties) property is set, or manually from an `onFinish` hook. | `title` |
311
+ | `onDataPart` | Any data part arrives from the server. | `type`, `data`, `id` |
312
+
313
+ ###### Validate messages before sending:
314
+ ```yaml
315
+ events:
316
+ onBeforeSend:
317
+ - id: check_empty
318
+ type: Throw
319
+ skip:
320
+ _gt:
321
+ - _string.length:
322
+ _event: text
323
+ - 0
324
+ params:
325
+ message: Please enter a message.
326
+ ```
327
+
328
+ ###### Save feedback to the database:
329
+ ```yaml
330
+ events:
331
+ onFeedback:
332
+ - id: save
333
+ type: Request
334
+ params:
335
+ - save_feedback
336
+ - id: notify
337
+ type: DisplayMessage
338
+ params:
339
+ content: Thanks for your feedback!
340
+ type: success
341
+ ```
342
+
343
+ ###### Adapt behavior based on sender switches:
344
+ ```yaml
345
+ events:
346
+ onSwitchChange:
347
+ - id: update_state
348
+ type: SetState
349
+ params:
350
+ switches:
351
+ _event:
352
+ ```
353
+
354
+ ## Methods
355
+
356
+ Control the chat programmatically using [`CallMethod`](/CallMethod):
357
+
358
+ | Method | Arguments | Description |
359
+ | --- | --- | --- |
360
+ | `sendMessage` | `{ text, files?, metadata? }` | Send a message programmatically. |
361
+ | `regenerate` | `{ messageId? }` | Regenerate the last (or a specific) assistant message. |
362
+ | `setMessages` | `{ messages }` | Replace all messages with a new array. |
363
+ | `clearMessages` | | Clear all messages. |
364
+ | `deleteMessage` | `{ messageId }` | Delete a specific message by ID. |
365
+ | `stop` | | Stop the current streaming response. |
366
+ | `clearError` | | Clear the current error state. |
367
+ | `scrollToBottom` | | Scroll the chat to the bottom. |
368
+
369
+ ###### Send a message from a button:
370
+ ```yaml
371
+ - id: quick_action
372
+ type: Button
373
+ properties:
374
+ title: Summarize this page
375
+ events:
376
+ onClick:
377
+ - id: send
378
+ type: CallMethod
379
+ params:
380
+ blockId: chat
381
+ method: sendMessage
382
+ args:
383
+ - text: Please summarize the current page content.
384
+ ```
385
+
386
+ ###### New conversation button:
387
+ ```yaml
388
+ - id: new_chat
389
+ type: Button
390
+ properties:
391
+ title: New Chat
392
+ icon: AiOutlinePlus
393
+ events:
394
+ onClick:
395
+ - id: new_id
396
+ type: SetState
397
+ params:
398
+ activeConversationId:
399
+ _uuid: v4
400
+ ```
401
+
402
+ ## Conversation Management
403
+
404
+ The `AgentChat` block manages the current session in memory. To persist conversations, combine `conversationId` with events and the [`AgentConversations`](/AgentConversations) block.
405
+
406
+ ###### Complete chat page with conversation history:
407
+ ```yaml
408
+ - id: page
409
+ type: PageHeaderMenu
410
+ requests:
411
+ - id: list_conversations
412
+ type: MongoDBFind
413
+ connectionId: app_db
414
+ properties:
415
+ collection: conversations
416
+ query:
417
+ userId:
418
+ _user: id
419
+ options:
420
+ sort:
421
+ updatedAt: -1
422
+ - id: load_messages
423
+ type: MongoDBFindOne
424
+ connectionId: app_db
425
+ properties:
426
+ collection: conversations
427
+ query:
428
+ _id:
429
+ _state: activeConversationId
430
+ events:
431
+ onMount:
432
+ - id: load_list
433
+ type: Request
434
+ params:
435
+ - list_conversations
436
+ blocks:
437
+ - id: layout
438
+ type: Flex
439
+ blocks:
440
+ - id: sidebar
441
+ type: Box
442
+ style:
443
+ width: 280px
444
+ blocks:
445
+ - id: conversations
446
+ type: AgentConversations
447
+ properties:
448
+ items:
449
+ _array.map:
450
+ on:
451
+ _request: list_conversations
452
+ callback:
453
+ _function:
454
+ __args: 0
455
+ key:
456
+ __args: 0._id
457
+ label:
458
+ __args: 0.title
459
+ group:
460
+ __args: 0.group
461
+ activeKey:
462
+ _state: activeConversationId
463
+ creation:
464
+ label: New Chat
465
+ menu:
466
+ - key: delete
467
+ label: Delete
468
+ danger: true
469
+ events:
470
+ onSelect:
471
+ - id: switch
472
+ type: SetState
473
+ params:
474
+ activeConversationId:
475
+ _event: key
476
+ - id: load
477
+ type: Request
478
+ params:
479
+ - load_messages
480
+ onNew:
481
+ - id: new_id
482
+ type: SetState
483
+ params:
484
+ activeConversationId:
485
+ _uuid: v4
486
+ - id: main
487
+ type: Box
488
+ style:
489
+ flex: 1
490
+ blocks:
491
+ - id: chat
492
+ type: AgentChat
493
+ properties:
494
+ agentId: support_agent
495
+ conversationId:
496
+ _state: activeConversationId
497
+ messages:
498
+ _if:
499
+ test:
500
+ _ne:
501
+ - _request: load_messages
502
+ - null
503
+ then:
504
+ _request: load_messages.messages
505
+ else: null
506
+ events:
507
+ onTitleGenerated:
508
+ - id: update_title
509
+ type: SetState
510
+ params:
511
+ conversationTitle:
512
+ _event: title
513
+ ```
514
+
515
+ The agent's `onFinish` hook handles server-side persistence. See [Server Hooks](/agent-server-hooks) for details.
@@ -0,0 +1,148 @@
1
+ # AgentConversations
2
+
3
+ The `AgentConversations` block renders a conversation list sidebar. It displays a list of conversations that the user can select, create, and manage. Use it alongside [`AgentChat`](/AgentChat) to build a full chat interface with conversation history.
4
+
5
+ > The `AgentConversations` block is provided by the `@lowdefy/blocks-antd-x` package, which is included by default.
6
+
7
+ The block does not manage data — you load conversations from your database and handle events to persist changes. This gives you full control over storage and retrieval.
8
+
9
+ ###### Example with grouped conversations and a context menu:
10
+ ```yaml
11
+ - id: conversations
12
+ type: AgentConversations
13
+ properties:
14
+ items:
15
+ - key: conv-1
16
+ label: How do I reset my password?
17
+ group: Today
18
+ - key: conv-2
19
+ label: Billing question about Pro plan
20
+ group: Today
21
+ - key: conv-3
22
+ label: API rate limits
23
+ group: Yesterday
24
+ activeKey:
25
+ _state: activeConversationId
26
+ creation:
27
+ label: New Chat
28
+ icon: AiOutlinePlus
29
+ menu:
30
+ - key: rename
31
+ label: Rename
32
+ - key: delete
33
+ label: Delete
34
+ icon: AiOutlineDelete
35
+ danger: true
36
+ groupable:
37
+ collapsible: true
38
+ defaultExpandedKeys:
39
+ - Today
40
+ events:
41
+ onSelect:
42
+ - id: switch
43
+ type: SetState
44
+ params:
45
+ activeConversationId:
46
+ _event: key
47
+ - id: load
48
+ type: Request
49
+ params:
50
+ - load_messages
51
+ onNew:
52
+ - id: new_id
53
+ type: SetState
54
+ params:
55
+ activeConversationId:
56
+ _uuid: v4
57
+ onMenuClick:
58
+ - id: handle_delete
59
+ type: Request
60
+ skip:
61
+ _ne:
62
+ - _event: key
63
+ - delete
64
+ params:
65
+ - delete_conversation
66
+ ```
67
+
68
+ ## Properties
69
+
70
+ ### Items
71
+
72
+ - `items: object[]`: Default: `[]` - List of conversations to display. Each item:
73
+ - `key: string`: Unique conversation identifier.
74
+ - `label: string`: Conversation title.
75
+ - `icon`: Optional icon.
76
+ - `disabled: boolean`: Whether the item is disabled.
77
+ - `timestamp: number`: Timestamp for sorting or display.
78
+ - `group: string`: Group key (e.g. `'Today'`, `'Yesterday'`, `'Last week'`).
79
+
80
+ - `activeKey: string`: The `key` of the currently selected conversation. Highlights the active item.
81
+ - `width: number`: Default: `250` - Sidebar width in pixels.
82
+
83
+ ### Creation Button
84
+
85
+ - `creation: object`: Show a button for creating new conversations.
86
+ - `label: string`: Button label.
87
+ - `icon`: Button icon.
88
+ - `align: string`: `'start'`, `'center'`, or `'end'`.
89
+
90
+ ### Context Menu
91
+
92
+ - `menu: object[]`: Right-click or overflow menu on each conversation. Each item:
93
+ - `key: string`: Unique key for the action.
94
+ - `label: string`: Menu item label.
95
+ - `icon`: Menu item icon.
96
+ - `danger: boolean`: Style as a danger action (red).
97
+
98
+ ### Grouping
99
+
100
+ - `groupable: object`: Configure conversation grouping.
101
+ - `collapsible: boolean`: Default: `true` - Whether groups can be collapsed.
102
+ - `label: string`: Label for ungrouped items.
103
+ - `defaultExpandedKeys: string[]`: Groups expanded by default.
104
+
105
+ ## Events
106
+
107
+ | Event | When | Event data |
108
+ | --- | --- | --- |
109
+ | `onSelect` | User clicks a conversation. | `key` |
110
+ | `onNew` | User clicks the creation button. | |
111
+ | `onMenuClick` | User clicks a context menu item. | `key` (menu action), `item` (conversation) |
112
+
113
+ ###### Handle menu actions:
114
+ ```yaml
115
+ events:
116
+ onMenuClick:
117
+ - id: handle_rename
118
+ type: CallMethod
119
+ skip:
120
+ _ne:
121
+ - _event: key
122
+ - rename
123
+ params:
124
+ blockId: rename_modal
125
+ method: toggleOpen
126
+ args:
127
+ - open: true
128
+ - id: handle_delete
129
+ type: Request
130
+ skip:
131
+ _ne:
132
+ - _event: key
133
+ - delete
134
+ params:
135
+ - delete_conversation
136
+ - id: refresh
137
+ type: Request
138
+ skip:
139
+ _ne:
140
+ - _event: key
141
+ - delete
142
+ params:
143
+ - list_conversations
144
+ ```
145
+
146
+ ## Usage with AgentChat
147
+
148
+ See the [AgentChat conversation management](/AgentChat) section for a complete example showing `AgentConversations` and `AgentChat` wired together with database persistence.