@rodrigocoliveira/agno-react 1.4.0 → 2.0.0
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.
- package/README.md +32 -46
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1738 -87
- package/dist/index.js.map +31 -3
- package/dist/index.mjs +1759 -87
- package/dist/index.mjs.map +31 -3
- package/dist/ui/composed/AgnoMessageItem.d.ts +12 -24
- package/dist/ui/composed/AgnoMessageItem.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/agno-chat.d.ts +23 -3
- package/dist/ui/composed/agno-chat/agno-chat.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/context.d.ts +4 -3
- package/dist/ui/composed/agno-chat/context.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/messages.d.ts +9 -15
- package/dist/ui/composed/agno-chat/messages.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/render-tool.d.ts +11 -0
- package/dist/ui/composed/agno-chat/render-tool.d.ts.map +1 -0
- package/dist/ui/composed/agno-chat/tool-building-blocks.d.ts +11 -0
- package/dist/ui/composed/agno-chat/tool-building-blocks.d.ts.map +1 -0
- package/dist/ui/composed/agno-message/content.d.ts +2 -0
- package/dist/ui/composed/agno-message/content.d.ts.map +1 -0
- package/dist/ui/composed/agno-message/context.d.ts +21 -0
- package/dist/ui/composed/agno-message/context.d.ts.map +1 -0
- package/dist/ui/composed/agno-message/footer.d.ts +6 -0
- package/dist/ui/composed/agno-message/footer.d.ts.map +1 -0
- package/dist/ui/composed/agno-message/index.d.ts +13 -0
- package/dist/ui/composed/agno-message/index.d.ts.map +1 -0
- package/dist/ui/composed/agno-message/media.d.ts +2 -0
- package/dist/ui/composed/agno-message/media.d.ts.map +1 -0
- package/dist/ui/composed/agno-message/message.d.ts +41 -0
- package/dist/ui/composed/agno-message/message.d.ts.map +1 -0
- package/dist/ui/composed/agno-message/reasoning.d.ts +2 -0
- package/dist/ui/composed/agno-message/reasoning.d.ts.map +1 -0
- package/dist/ui/composed/agno-message/references.d.ts +2 -0
- package/dist/ui/composed/agno-message/references.d.ts.map +1 -0
- package/dist/ui/composed/agno-message/tools.d.ts +7 -0
- package/dist/ui/composed/agno-message/tools.d.ts.map +1 -0
- package/dist/ui/composed/index.d.ts +6 -0
- package/dist/ui/composed/index.d.ts.map +1 -1
- package/dist/ui/index.d.ts +6 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/primitives/badge.d.ts +1 -1
- package/dist/ui/primitives/button.d.ts +1 -1
- package/dist/ui/primitives/command.d.ts +1 -1
- package/dist/ui.js +1146 -643
- package/dist/ui.js.map +22 -7
- package/dist/ui.mjs +1139 -645
- package/dist/ui.mjs.map +22 -7
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -288,7 +288,7 @@ npm install @radix-ui/react-accordion @radix-ui/react-avatar @radix-ui/react-col
|
|
|
288
288
|
All UI components are imported from the `/ui` sub-path:
|
|
289
289
|
|
|
290
290
|
```tsx
|
|
291
|
-
import { AgnoChat,
|
|
291
|
+
import { AgnoChat, AgnoChatInput, AgnoMessage, byToolName, Button, Response } from '@rodrigocoliveira/agno-react/ui';
|
|
292
292
|
```
|
|
293
293
|
|
|
294
294
|
---
|
|
@@ -298,8 +298,8 @@ import { AgnoChat, AgnoChatInterface, AgnoChatInput, Button, Response } from '@r
|
|
|
298
298
|
The primary way to build a full-featured chat interface. Uses a compound component pattern — compose only the pieces you need.
|
|
299
299
|
|
|
300
300
|
```tsx
|
|
301
|
-
import { AgnoChat } from '@rodrigocoliveira/agno-react/ui';
|
|
302
|
-
import type { ToolHandler } from '@rodrigocoliveira/agno-react';
|
|
301
|
+
import { AgnoChat, byToolName } from '@rodrigocoliveira/agno-react/ui';
|
|
302
|
+
import type { ToolHandler, RenderTool } from '@rodrigocoliveira/agno-react';
|
|
303
303
|
|
|
304
304
|
const toolHandlers: Record<string, ToolHandler> = {
|
|
305
305
|
show_alert: async (args) => {
|
|
@@ -308,21 +308,37 @@ const toolHandlers: Record<string, ToolHandler> = {
|
|
|
308
308
|
},
|
|
309
309
|
};
|
|
310
310
|
|
|
311
|
+
// Optional: customize per-tool rendering. `byToolName` is a helper that
|
|
312
|
+
// dispatches by `tool.tool_name`; unlisted tools fall through to the default.
|
|
313
|
+
const renderTool: RenderTool = byToolName({
|
|
314
|
+
internal_log: false, // hide entirely
|
|
315
|
+
search_flights: (tool) => <FlightResults tool={tool} />, // custom widget
|
|
316
|
+
});
|
|
317
|
+
|
|
311
318
|
function ChatPage() {
|
|
312
319
|
return (
|
|
313
|
-
<AgnoChat
|
|
320
|
+
<AgnoChat
|
|
321
|
+
toolHandlers={toolHandlers}
|
|
322
|
+
autoExecuteTools={true}
|
|
323
|
+
renderTool={renderTool}
|
|
324
|
+
// debug auto-detects from NODE_ENV; set explicitly to force the debug
|
|
325
|
+
// tool card on/off (e.g. enable in prod to investigate a live bug).
|
|
326
|
+
debug={false}
|
|
327
|
+
>
|
|
314
328
|
<AgnoChat.Messages
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
329
|
+
avatars={{
|
|
330
|
+
user: <img src="/user.png" className="h-8 w-8 rounded-full" />,
|
|
331
|
+
assistant: <img src="/bot.png" className="h-8 w-8 rounded-full" />,
|
|
332
|
+
}}
|
|
333
|
+
actions={{
|
|
334
|
+
visibility: 'hover-last-visible',
|
|
335
|
+
assistant: (message) => (
|
|
321
336
|
<button onClick={() => navigator.clipboard.writeText(message.content || '')}>
|
|
322
337
|
Copy
|
|
323
338
|
</button>
|
|
324
339
|
),
|
|
325
340
|
}}
|
|
341
|
+
showReasoning={false}
|
|
326
342
|
>
|
|
327
343
|
<AgnoChat.EmptyState>
|
|
328
344
|
<h3>Welcome!</h3>
|
|
@@ -348,12 +364,16 @@ function ChatPage() {
|
|
|
348
364
|
}
|
|
349
365
|
```
|
|
350
366
|
|
|
367
|
+
For custom message layouts (reordering slots, replacing sections), use the
|
|
368
|
+
`<AgnoMessage>` compound components via `renderMessage`. See
|
|
369
|
+
[docs/tool-rendering.md](../../docs/tool-rendering.md) for the full reference.
|
|
370
|
+
|
|
351
371
|
**Sub-components:**
|
|
352
372
|
|
|
353
373
|
| Component | Description |
|
|
354
374
|
|-----------|-------------|
|
|
355
|
-
| `AgnoChat` | Root wrapper. Accepts `toolHandlers`
|
|
356
|
-
| `AgnoChat.Messages` | Message list with auto-scroll. Accepts `
|
|
375
|
+
| `AgnoChat` | Root wrapper. Accepts `toolHandlers`, `autoExecuteTools`, `renderTool`, `debug`, `skipHydration`. |
|
|
376
|
+
| `AgnoChat.Messages` | Message list with auto-scroll. Accepts `avatars`, `actions`, `showReasoning`, `showReferences`, `showTimestamp`, `renderMessage`, `renderTool`, and more. |
|
|
357
377
|
| `AgnoChat.EmptyState` | Shown when there are no messages. Place inside `Messages`. |
|
|
358
378
|
| `AgnoChat.SuggestedPrompts` | Clickable prompt suggestions. Place inside `EmptyState`. |
|
|
359
379
|
| `AgnoChat.ErrorBar` | Error display bar. |
|
|
@@ -361,40 +381,6 @@ function ChatPage() {
|
|
|
361
381
|
|
|
362
382
|
---
|
|
363
383
|
|
|
364
|
-
### AgnoChatInterface
|
|
365
|
-
|
|
366
|
-
A single-component shortcut that renders a complete chat interface. Less flexible than `AgnoChat` but requires zero composition.
|
|
367
|
-
|
|
368
|
-
```tsx
|
|
369
|
-
import { AgnoChatInterface } from '@rodrigocoliveira/agno-react/ui';
|
|
370
|
-
|
|
371
|
-
function ChatPage() {
|
|
372
|
-
return (
|
|
373
|
-
<AgnoChatInterface
|
|
374
|
-
placeholder="Type a message..."
|
|
375
|
-
suggestedPrompts={[
|
|
376
|
-
{ text: 'What can you help me with?' },
|
|
377
|
-
{ text: 'Explain how you work' },
|
|
378
|
-
]}
|
|
379
|
-
toolHandlers={toolHandlers}
|
|
380
|
-
showAudioRecorder={true}
|
|
381
|
-
userAvatar={<img src="/user.png" />}
|
|
382
|
-
assistantAvatar={<img src="/bot.png" />}
|
|
383
|
-
emptyState={<div>Start a conversation!</div>}
|
|
384
|
-
classNames={{
|
|
385
|
-
root: 'h-full',
|
|
386
|
-
messagesArea: 'px-4',
|
|
387
|
-
inputArea: 'border-t',
|
|
388
|
-
}}
|
|
389
|
-
/>
|
|
390
|
-
);
|
|
391
|
-
}
|
|
392
|
-
```
|
|
393
|
-
|
|
394
|
-
**Key props:** `className`, `classNames`, `renderMessage`, `renderInput`, `emptyState`, `headerSlot`, `inputToolbarSlot`, `suggestedPrompts`, `toolHandlers`, `autoExecuteTools`, `placeholder`, `userAvatar`, `assistantAvatar`, `fileUpload`, `showAudioRecorder`, `messageItemProps`, `chatInputProps`.
|
|
395
|
-
|
|
396
|
-
---
|
|
397
|
-
|
|
398
384
|
### AgnoChatInput
|
|
399
385
|
|
|
400
386
|
Standalone chat input component with file uploads, audio recording, and transcription support.
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,12 @@ export { useAgnoSession } from './hooks/useAgnoSession';
|
|
|
17
17
|
export { useAgnoActions } from './hooks/useAgnoActions';
|
|
18
18
|
export { useAgnoToolExecution, getCustomRender } from './hooks/useAgnoToolExecution';
|
|
19
19
|
export type { ToolHandler, ToolExecutionEvent } from './hooks/useAgnoToolExecution';
|
|
20
|
-
export
|
|
20
|
+
export { byToolName } from './ui/composed/agno-chat/render-tool';
|
|
21
|
+
export type { RenderTool, ToolRenderArgs, ToolEntry } from './ui/composed/agno-chat/render-tool';
|
|
22
|
+
export { ToolDebugCard, ToolGenerativeUI } from './ui/composed/agno-chat/tool-building-blocks';
|
|
23
|
+
export type { ToolDebugCardProps, ToolGenerativeUIProps, } from './ui/composed/agno-chat/tool-building-blocks';
|
|
24
|
+
export { AgnoMessage, AgnoMessageReasoning, AgnoMessageMedia, AgnoMessageTools, AgnoMessageContent, AgnoMessageReferences, AgnoMessageFooter, AgnoMessageContext, useAgnoMessageContext, } from './ui/composed/agno-message';
|
|
25
|
+
export type { AgnoMessageProps, AgnoMessageToolsProps, AgnoMessageFooterProps, AgnoMessageContextValue, } from './ui/composed/agno-message';
|
|
21
26
|
export { useAgnoCustomEvents } from './hooks/useAgnoCustomEvents';
|
|
22
27
|
export { useAgnoMemory } from './hooks/useAgnoMemory';
|
|
23
28
|
export { useAgnoSessionState } from './hooks/useAgnoSessionState';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACpE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpF,YAAY,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAGtG,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,YAAY,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AACnF,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAGpE,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,EACf,cAAc,EACd,UAAU,EACV,WAAW,EACX,YAAY,EACZ,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,c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