@rodrigocoliveira/agno-react 2.0.0 → 2.1.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 +1 -1
- package/dist/hooks/useAgnoToolExecution.d.ts +7 -11
- package/dist/hooks/useAgnoToolExecution.d.ts.map +1 -1
- package/dist/index.d.ts +3 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +645 -986
- package/dist/index.js.map +7 -10
- package/dist/index.mjs +564 -905
- package/dist/index.mjs.map +7 -10
- package/dist/ui/components/chart.d.ts +63 -0
- package/dist/ui/components/chart.d.ts.map +1 -0
- package/dist/ui/composed/agno-chat/agno-chat.d.ts +6 -4
- package/dist/ui/composed/agno-chat/agno-chat.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/tool-building-blocks.d.ts +0 -4
- package/dist/ui/composed/agno-chat/tool-building-blocks.d.ts.map +1 -1
- package/dist/ui/composed/agno-message/tools.d.ts.map +1 -1
- package/dist/ui/composed/generative-components/card-grid.d.ts +4 -0
- package/dist/ui/composed/generative-components/card-grid.d.ts.map +1 -0
- package/dist/ui/composed/generative-components/charts.d.ts +7 -0
- package/dist/ui/composed/generative-components/charts.d.ts.map +1 -0
- package/dist/ui/composed/index.d.ts +6 -2
- package/dist/ui/composed/index.d.ts.map +1 -1
- package/dist/ui/index.d.ts +8 -2
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui.js +586 -424
- package/dist/ui.js.map +9 -11
- package/dist/ui.mjs +606 -430
- package/dist/ui.mjs.map +9 -11
- package/package.json +8 -3
- package/dist/components/GenerativeUIRenderer.d.ts +0 -21
- package/dist/components/GenerativeUIRenderer.d.ts.map +0 -1
- package/dist/utils/component-registry.d.ts +0 -63
- package/dist/utils/component-registry.d.ts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -61,509 +61,6 @@ function ToolHandlerProvider({ handlers: initialHandlers = {}, children }) {
|
|
|
61
61
|
function useToolHandlers() {
|
|
62
62
|
return useContext2(ToolHandlerContext);
|
|
63
63
|
}
|
|
64
|
-
// src/components/GenerativeUIRenderer.tsx
|
|
65
|
-
import React3 from "react";
|
|
66
|
-
|
|
67
|
-
// src/utils/component-registry.ts
|
|
68
|
-
class ComponentRegistry {
|
|
69
|
-
static instance;
|
|
70
|
-
components = new Map;
|
|
71
|
-
constructor() {}
|
|
72
|
-
static getInstance() {
|
|
73
|
-
if (!ComponentRegistry.instance) {
|
|
74
|
-
ComponentRegistry.instance = new ComponentRegistry;
|
|
75
|
-
}
|
|
76
|
-
return ComponentRegistry.instance;
|
|
77
|
-
}
|
|
78
|
-
register(type, renderer) {
|
|
79
|
-
this.components.set(type, renderer);
|
|
80
|
-
}
|
|
81
|
-
registerBatch(components) {
|
|
82
|
-
Object.entries(components).forEach(([type, renderer]) => {
|
|
83
|
-
this.register(type, renderer);
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
get(type) {
|
|
87
|
-
return this.components.get(type);
|
|
88
|
-
}
|
|
89
|
-
has(type) {
|
|
90
|
-
return this.components.has(type);
|
|
91
|
-
}
|
|
92
|
-
unregister(type) {
|
|
93
|
-
this.components.delete(type);
|
|
94
|
-
}
|
|
95
|
-
getRegisteredTypes() {
|
|
96
|
-
return Array.from(this.components.keys());
|
|
97
|
-
}
|
|
98
|
-
clear() {
|
|
99
|
-
this.components.clear();
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
function getComponentRegistry() {
|
|
103
|
-
return ComponentRegistry.getInstance();
|
|
104
|
-
}
|
|
105
|
-
function registerChartComponent(name, renderer) {
|
|
106
|
-
getComponentRegistry().register(`chart:${name}`, renderer);
|
|
107
|
-
}
|
|
108
|
-
function getChartComponent(name) {
|
|
109
|
-
return getComponentRegistry().get(`chart:${name}`);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// src/hooks/useAgnoToolExecution.ts
|
|
113
|
-
import { useState as useState2, useEffect as useEffect2, useCallback as useCallback2, useMemo as useMemo2 } from "react";
|
|
114
|
-
var customRenderRegistry = new Map;
|
|
115
|
-
function registerCustomRender(renderFn) {
|
|
116
|
-
const key = `custom-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
117
|
-
customRenderRegistry.set(key, renderFn);
|
|
118
|
-
return key;
|
|
119
|
-
}
|
|
120
|
-
function getCustomRender(key) {
|
|
121
|
-
return customRenderRegistry.get(key);
|
|
122
|
-
}
|
|
123
|
-
function isToolHandlerResult(value) {
|
|
124
|
-
return value && typeof value === "object" && (("data" in value) || ("ui" in value));
|
|
125
|
-
}
|
|
126
|
-
function isUIComponentSpec(value) {
|
|
127
|
-
return value && typeof value === "object" && "type" in value;
|
|
128
|
-
}
|
|
129
|
-
function processToolResult(result, _tool) {
|
|
130
|
-
if (isToolHandlerResult(result)) {
|
|
131
|
-
const { data, ui } = result;
|
|
132
|
-
let uiComponent = undefined;
|
|
133
|
-
if (ui) {
|
|
134
|
-
if (ui.type === "custom" && typeof ui.render === "function") {
|
|
135
|
-
const renderKey = registerCustomRender(ui.render);
|
|
136
|
-
uiComponent = {
|
|
137
|
-
...ui,
|
|
138
|
-
renderKey,
|
|
139
|
-
render: undefined
|
|
140
|
-
};
|
|
141
|
-
} else {
|
|
142
|
-
uiComponent = ui;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return {
|
|
146
|
-
resultData: typeof data === "string" ? data : JSON.stringify(data),
|
|
147
|
-
uiComponent
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
if (isUIComponentSpec(result)) {
|
|
151
|
-
let uiComponent;
|
|
152
|
-
if (result.type === "custom" && typeof result.render === "function") {
|
|
153
|
-
const renderKey = registerCustomRender(result.render);
|
|
154
|
-
uiComponent = {
|
|
155
|
-
...result,
|
|
156
|
-
renderKey,
|
|
157
|
-
render: undefined
|
|
158
|
-
};
|
|
159
|
-
} else {
|
|
160
|
-
uiComponent = result;
|
|
161
|
-
}
|
|
162
|
-
return {
|
|
163
|
-
resultData: JSON.stringify(result),
|
|
164
|
-
uiComponent
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
return {
|
|
168
|
-
resultData: typeof result === "string" ? result : JSON.stringify(result),
|
|
169
|
-
uiComponent: undefined
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
function useAgnoToolExecution(handlers = {}, autoExecute = true, options) {
|
|
173
|
-
const client = useAgnoClient();
|
|
174
|
-
const toolHandlerContext = useToolHandlers();
|
|
175
|
-
const isTeamMode = client.getConfig().mode === "team";
|
|
176
|
-
useEffect2(() => {
|
|
177
|
-
if (isTeamMode) {
|
|
178
|
-
console.warn("[useAgnoToolExecution] HITL (Human-in-the-Loop) frontend tool execution is not supported for teams. " + "Only agents support the continue endpoint. This hook will not function in team mode.");
|
|
179
|
-
}
|
|
180
|
-
}, [isTeamMode]);
|
|
181
|
-
const mergedHandlers = useMemo2(() => {
|
|
182
|
-
const globalHandlers = toolHandlerContext?.handlers || {};
|
|
183
|
-
return { ...globalHandlers, ...handlers };
|
|
184
|
-
}, [toolHandlerContext?.handlers, handlers]);
|
|
185
|
-
const [pendingTools, setPendingTools] = useState2([]);
|
|
186
|
-
const [isPaused, setIsPaused] = useState2(false);
|
|
187
|
-
const [isExecuting, setIsExecuting] = useState2(false);
|
|
188
|
-
const [executionError, setExecutionError] = useState2();
|
|
189
|
-
useEffect2(() => {
|
|
190
|
-
if (isTeamMode) {
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
const handleRunPaused = (event) => {
|
|
194
|
-
setIsPaused(true);
|
|
195
|
-
setPendingTools(event.tools);
|
|
196
|
-
setExecutionError(undefined);
|
|
197
|
-
};
|
|
198
|
-
const handleRunContinued = () => {
|
|
199
|
-
setIsPaused(false);
|
|
200
|
-
setPendingTools([]);
|
|
201
|
-
setIsExecuting(false);
|
|
202
|
-
setExecutionError(undefined);
|
|
203
|
-
};
|
|
204
|
-
client.on("run:paused", handleRunPaused);
|
|
205
|
-
client.on("run:continued", handleRunContinued);
|
|
206
|
-
return () => {
|
|
207
|
-
client.off("run:paused", handleRunPaused);
|
|
208
|
-
client.off("run:continued", handleRunContinued);
|
|
209
|
-
};
|
|
210
|
-
}, [client, isTeamMode]);
|
|
211
|
-
const executeAndContinue = useCallback2(async () => {
|
|
212
|
-
if (!isPaused || pendingTools.length === 0) {
|
|
213
|
-
console.warn("[useAgnoToolExecution] Cannot execute: no pending tools");
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
setIsExecuting(true);
|
|
217
|
-
setExecutionError(undefined);
|
|
218
|
-
try {
|
|
219
|
-
const updatedTools = await Promise.all(pendingTools.map(async (tool) => {
|
|
220
|
-
const handler = mergedHandlers[tool.tool_name];
|
|
221
|
-
if (!handler) {
|
|
222
|
-
return {
|
|
223
|
-
...tool,
|
|
224
|
-
result: JSON.stringify({
|
|
225
|
-
error: `No handler registered for ${tool.tool_name}`
|
|
226
|
-
})
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
try {
|
|
230
|
-
const result = await handler(tool.tool_args);
|
|
231
|
-
const { resultData, uiComponent } = processToolResult(result, tool);
|
|
232
|
-
return {
|
|
233
|
-
...tool,
|
|
234
|
-
result: resultData,
|
|
235
|
-
ui_component: uiComponent
|
|
236
|
-
};
|
|
237
|
-
} catch (error) {
|
|
238
|
-
return {
|
|
239
|
-
...tool,
|
|
240
|
-
result: JSON.stringify({
|
|
241
|
-
error: error instanceof Error ? error.message : String(error)
|
|
242
|
-
})
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
}));
|
|
246
|
-
const toolsWithUI = updatedTools.filter((t) => t.ui_component);
|
|
247
|
-
if (toolsWithUI.length > 0) {
|
|
248
|
-
client.emit("ui:render", {
|
|
249
|
-
tools: updatedTools,
|
|
250
|
-
runId: client.getState().pausedRunId
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
client.addToolCallsToLastMessage(updatedTools);
|
|
254
|
-
await client.continueRun(updatedTools);
|
|
255
|
-
} catch (error) {
|
|
256
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
257
|
-
setExecutionError(errorMessage);
|
|
258
|
-
setIsExecuting(false);
|
|
259
|
-
throw error;
|
|
260
|
-
}
|
|
261
|
-
}, [client, mergedHandlers, isPaused, pendingTools]);
|
|
262
|
-
useEffect2(() => {
|
|
263
|
-
const handleSessionLoaded = async (_sessionId) => {
|
|
264
|
-
const messages = client.getMessages();
|
|
265
|
-
for (const message of messages) {
|
|
266
|
-
if (!message.tool_calls)
|
|
267
|
-
continue;
|
|
268
|
-
for (const tool of message.tool_calls) {
|
|
269
|
-
if (tool.ui_component)
|
|
270
|
-
continue;
|
|
271
|
-
if (options?.skipHydration?.includes(tool.tool_name))
|
|
272
|
-
continue;
|
|
273
|
-
const handler = mergedHandlers[tool.tool_name];
|
|
274
|
-
if (!handler)
|
|
275
|
-
continue;
|
|
276
|
-
try {
|
|
277
|
-
const result = await handler(tool.tool_args);
|
|
278
|
-
const { uiComponent } = processToolResult(result, tool);
|
|
279
|
-
if (uiComponent) {
|
|
280
|
-
client.hydrateToolCallUI(tool.tool_call_id, uiComponent);
|
|
281
|
-
}
|
|
282
|
-
} catch (err) {
|
|
283
|
-
console.error(`Failed to hydrate UI for ${tool.tool_name}:`, err);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
client.on("session:loaded", handleSessionLoaded);
|
|
289
|
-
return () => {
|
|
290
|
-
client.off("session:loaded", handleSessionLoaded);
|
|
291
|
-
};
|
|
292
|
-
}, [client, mergedHandlers]);
|
|
293
|
-
const executeTools = useCallback2(async (tools) => {
|
|
294
|
-
return Promise.all(tools.map(async (tool) => {
|
|
295
|
-
const handler = mergedHandlers[tool.tool_name];
|
|
296
|
-
if (!handler)
|
|
297
|
-
return tool;
|
|
298
|
-
try {
|
|
299
|
-
const result = await handler(tool.tool_args);
|
|
300
|
-
const { resultData, uiComponent } = processToolResult(result, tool);
|
|
301
|
-
return {
|
|
302
|
-
...tool,
|
|
303
|
-
result: resultData,
|
|
304
|
-
ui_component: uiComponent
|
|
305
|
-
};
|
|
306
|
-
} catch (error) {
|
|
307
|
-
return {
|
|
308
|
-
...tool,
|
|
309
|
-
result: JSON.stringify({
|
|
310
|
-
error: error instanceof Error ? error.message : String(error)
|
|
311
|
-
})
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
}));
|
|
315
|
-
}, [mergedHandlers]);
|
|
316
|
-
const continueWithResults = useCallback2(async (tools, options2) => {
|
|
317
|
-
if (!isPaused) {
|
|
318
|
-
throw new Error("No paused run to continue");
|
|
319
|
-
}
|
|
320
|
-
setIsExecuting(true);
|
|
321
|
-
try {
|
|
322
|
-
await client.continueRun(tools, options2);
|
|
323
|
-
} catch (error) {
|
|
324
|
-
setIsExecuting(false);
|
|
325
|
-
throw error;
|
|
326
|
-
}
|
|
327
|
-
}, [client, isPaused]);
|
|
328
|
-
useEffect2(() => {
|
|
329
|
-
if (autoExecute && isPaused && !isExecuting && pendingTools.length > 0) {
|
|
330
|
-
executeAndContinue();
|
|
331
|
-
}
|
|
332
|
-
}, [autoExecute, isPaused, isExecuting, pendingTools.length, executeAndContinue]);
|
|
333
|
-
return {
|
|
334
|
-
isPaused,
|
|
335
|
-
isExecuting,
|
|
336
|
-
pendingTools,
|
|
337
|
-
executeAndContinue,
|
|
338
|
-
executeTools,
|
|
339
|
-
continueWithResults,
|
|
340
|
-
executionError
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// src/components/GenerativeUIRenderer.tsx
|
|
345
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
346
|
-
|
|
347
|
-
class UIErrorBoundary extends React3.Component {
|
|
348
|
-
constructor(props) {
|
|
349
|
-
super(props);
|
|
350
|
-
this.state = { hasError: false };
|
|
351
|
-
}
|
|
352
|
-
static getDerivedStateFromError(error) {
|
|
353
|
-
return { hasError: true, error };
|
|
354
|
-
}
|
|
355
|
-
componentDidCatch(error, errorInfo) {
|
|
356
|
-
console.error("[GenerativeUIRenderer] Error rendering component:", error, errorInfo);
|
|
357
|
-
this.props.onError?.(error);
|
|
358
|
-
}
|
|
359
|
-
render() {
|
|
360
|
-
if (this.state.hasError) {
|
|
361
|
-
return this.props.fallback || /* @__PURE__ */ jsxs("div", {
|
|
362
|
-
className: "p-4 border border-red-300 rounded-md bg-red-50 text-red-800",
|
|
363
|
-
children: [
|
|
364
|
-
/* @__PURE__ */ jsx3("p", {
|
|
365
|
-
className: "font-semibold",
|
|
366
|
-
children: "Failed to render UI component"
|
|
367
|
-
}),
|
|
368
|
-
/* @__PURE__ */ jsx3("p", {
|
|
369
|
-
className: "text-sm mt-1",
|
|
370
|
-
children: this.state.error?.message || "Unknown error"
|
|
371
|
-
})
|
|
372
|
-
]
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
return this.props.children;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
function GenerativeUIRenderer({
|
|
379
|
-
spec,
|
|
380
|
-
className,
|
|
381
|
-
onError
|
|
382
|
-
}) {
|
|
383
|
-
const registry = getComponentRegistry();
|
|
384
|
-
if (spec.type === "custom") {
|
|
385
|
-
const customSpec = spec;
|
|
386
|
-
if (customSpec.renderKey) {
|
|
387
|
-
const renderFn = getCustomRender(customSpec.renderKey);
|
|
388
|
-
if (renderFn) {
|
|
389
|
-
return /* @__PURE__ */ jsx3(UIErrorBoundary, {
|
|
390
|
-
onError,
|
|
391
|
-
children: /* @__PURE__ */ jsx3("div", {
|
|
392
|
-
className,
|
|
393
|
-
children: renderFn(customSpec.props || {})
|
|
394
|
-
})
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
399
|
-
className: `p-4 border border-yellow-300 rounded-md bg-yellow-50 text-yellow-800 ${className || ""}`,
|
|
400
|
-
children: [
|
|
401
|
-
/* @__PURE__ */ jsx3("p", {
|
|
402
|
-
className: "font-semibold",
|
|
403
|
-
children: "Custom component not available"
|
|
404
|
-
}),
|
|
405
|
-
/* @__PURE__ */ jsx3("p", {
|
|
406
|
-
className: "text-sm mt-1",
|
|
407
|
-
children: "The custom render function for this component is not available."
|
|
408
|
-
})
|
|
409
|
-
]
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
if (spec.type === "chart") {
|
|
413
|
-
const chartSpec = spec;
|
|
414
|
-
const chartType = `chart:${chartSpec.component}`;
|
|
415
|
-
if (registry.has(chartType)) {
|
|
416
|
-
const ChartRenderer = registry.get(chartType);
|
|
417
|
-
return /* @__PURE__ */ jsx3(UIErrorBoundary, {
|
|
418
|
-
onError,
|
|
419
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
420
|
-
className,
|
|
421
|
-
children: [
|
|
422
|
-
chartSpec.title && /* @__PURE__ */ jsx3("h3", {
|
|
423
|
-
className: "font-semibold mb-2",
|
|
424
|
-
children: chartSpec.title
|
|
425
|
-
}),
|
|
426
|
-
chartSpec.description && /* @__PURE__ */ jsx3("p", {
|
|
427
|
-
className: "text-sm text-gray-600 mb-4",
|
|
428
|
-
children: chartSpec.description
|
|
429
|
-
}),
|
|
430
|
-
/* @__PURE__ */ jsx3(ChartRenderer, {
|
|
431
|
-
...chartSpec.props
|
|
432
|
-
})
|
|
433
|
-
]
|
|
434
|
-
})
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
438
|
-
className: `p-4 border border-gray-300 rounded-md ${className || ""}`,
|
|
439
|
-
children: [
|
|
440
|
-
/* @__PURE__ */ jsx3("p", {
|
|
441
|
-
className: "font-semibold mb-2",
|
|
442
|
-
children: chartSpec.title || "Chart Data"
|
|
443
|
-
}),
|
|
444
|
-
chartSpec.description && /* @__PURE__ */ jsx3("p", {
|
|
445
|
-
className: "text-sm text-gray-600 mb-2",
|
|
446
|
-
children: chartSpec.description
|
|
447
|
-
}),
|
|
448
|
-
/* @__PURE__ */ jsx3("pre", {
|
|
449
|
-
className: "text-xs bg-gray-100 p-2 rounded overflow-auto",
|
|
450
|
-
children: JSON.stringify(chartSpec.props.data, null, 2)
|
|
451
|
-
})
|
|
452
|
-
]
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
if (spec.type === "card-grid") {
|
|
456
|
-
const cardGridSpec = spec;
|
|
457
|
-
if (registry.has("card-grid")) {
|
|
458
|
-
const CardGridRenderer = registry.get("card-grid");
|
|
459
|
-
return /* @__PURE__ */ jsx3(UIErrorBoundary, {
|
|
460
|
-
onError,
|
|
461
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
462
|
-
className,
|
|
463
|
-
children: [
|
|
464
|
-
cardGridSpec.title && /* @__PURE__ */ jsx3("h3", {
|
|
465
|
-
className: "font-semibold mb-2",
|
|
466
|
-
children: cardGridSpec.title
|
|
467
|
-
}),
|
|
468
|
-
cardGridSpec.description && /* @__PURE__ */ jsx3("p", {
|
|
469
|
-
className: "text-sm text-gray-600 mb-4",
|
|
470
|
-
children: cardGridSpec.description
|
|
471
|
-
}),
|
|
472
|
-
/* @__PURE__ */ jsx3(CardGridRenderer, {
|
|
473
|
-
...cardGridSpec.props
|
|
474
|
-
})
|
|
475
|
-
]
|
|
476
|
-
})
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
if (spec.type === "table") {
|
|
481
|
-
const tableSpec = spec;
|
|
482
|
-
if (registry.has("table")) {
|
|
483
|
-
const TableRenderer = registry.get("table");
|
|
484
|
-
return /* @__PURE__ */ jsx3(UIErrorBoundary, {
|
|
485
|
-
onError,
|
|
486
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
487
|
-
className,
|
|
488
|
-
children: [
|
|
489
|
-
tableSpec.title && /* @__PURE__ */ jsx3("h3", {
|
|
490
|
-
className: "font-semibold mb-2",
|
|
491
|
-
children: tableSpec.title
|
|
492
|
-
}),
|
|
493
|
-
tableSpec.description && /* @__PURE__ */ jsx3("p", {
|
|
494
|
-
className: "text-sm text-gray-600 mb-4",
|
|
495
|
-
children: tableSpec.description
|
|
496
|
-
}),
|
|
497
|
-
/* @__PURE__ */ jsx3(TableRenderer, {
|
|
498
|
-
...tableSpec.props
|
|
499
|
-
})
|
|
500
|
-
]
|
|
501
|
-
})
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
if (spec.type === "markdown") {
|
|
506
|
-
const markdownSpec = spec;
|
|
507
|
-
if (registry.has("markdown")) {
|
|
508
|
-
const MarkdownRenderer = registry.get("markdown");
|
|
509
|
-
return /* @__PURE__ */ jsx3(UIErrorBoundary, {
|
|
510
|
-
onError,
|
|
511
|
-
children: /* @__PURE__ */ jsx3("div", {
|
|
512
|
-
className,
|
|
513
|
-
children: /* @__PURE__ */ jsx3(MarkdownRenderer, {
|
|
514
|
-
...markdownSpec.props
|
|
515
|
-
})
|
|
516
|
-
})
|
|
517
|
-
});
|
|
518
|
-
}
|
|
519
|
-
return /* @__PURE__ */ jsx3("div", {
|
|
520
|
-
className,
|
|
521
|
-
children: markdownSpec.props.content
|
|
522
|
-
});
|
|
523
|
-
}
|
|
524
|
-
if (spec.type === "artifact") {
|
|
525
|
-
const artifactSpec = spec;
|
|
526
|
-
return /* @__PURE__ */ jsx3(UIErrorBoundary, {
|
|
527
|
-
onError,
|
|
528
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
529
|
-
className: `p-4 border rounded-md ${className || ""}`,
|
|
530
|
-
children: [
|
|
531
|
-
artifactSpec.title && /* @__PURE__ */ jsx3("h3", {
|
|
532
|
-
className: "font-semibold mb-4",
|
|
533
|
-
children: artifactSpec.title
|
|
534
|
-
}),
|
|
535
|
-
artifactSpec.description && /* @__PURE__ */ jsx3("p", {
|
|
536
|
-
className: "text-sm text-gray-600 mb-4",
|
|
537
|
-
children: artifactSpec.description
|
|
538
|
-
}),
|
|
539
|
-
/* @__PURE__ */ jsx3("div", {
|
|
540
|
-
className: "space-y-4",
|
|
541
|
-
children: artifactSpec.props.content?.map((childSpec, index) => /* @__PURE__ */ jsx3(GenerativeUIRenderer, {
|
|
542
|
-
spec: childSpec,
|
|
543
|
-
onError
|
|
544
|
-
}, index))
|
|
545
|
-
})
|
|
546
|
-
]
|
|
547
|
-
})
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
551
|
-
className: `p-4 border border-gray-300 rounded-md ${className || ""}`,
|
|
552
|
-
children: [
|
|
553
|
-
/* @__PURE__ */ jsx3("p", {
|
|
554
|
-
className: "font-semibold",
|
|
555
|
-
children: "Unsupported UI component"
|
|
556
|
-
}),
|
|
557
|
-
/* @__PURE__ */ jsxs("p", {
|
|
558
|
-
className: "text-sm text-gray-600 mt-1",
|
|
559
|
-
children: [
|
|
560
|
-
"Component type: ",
|
|
561
|
-
spec.type
|
|
562
|
-
]
|
|
563
|
-
})
|
|
564
|
-
]
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
64
|
// src/utils/ui-helpers.ts
|
|
568
65
|
function createBarChart(data, xKey, bars, options) {
|
|
569
66
|
return {
|
|
@@ -768,12 +265,12 @@ function resultWithTable(data, columns, options) {
|
|
|
768
265
|
return createToolResult(data, createTable(data, columns, options));
|
|
769
266
|
}
|
|
770
267
|
// src/hooks/useAgnoChat.ts
|
|
771
|
-
import { useState as
|
|
268
|
+
import { useState as useState2, useEffect as useEffect2, useCallback as useCallback2 } from "react";
|
|
772
269
|
function useAgnoChat() {
|
|
773
270
|
const client = useAgnoClient();
|
|
774
|
-
const [messages, setMessages] =
|
|
775
|
-
const [state, setState] =
|
|
776
|
-
|
|
271
|
+
const [messages, setMessages] = useState2(client.getMessages());
|
|
272
|
+
const [state, setState] = useState2(client.getState());
|
|
273
|
+
useEffect2(() => {
|
|
777
274
|
const handleMessageUpdate = (updatedMessages) => {
|
|
778
275
|
setMessages(updatedMessages);
|
|
779
276
|
};
|
|
@@ -812,18 +309,18 @@ function useAgnoChat() {
|
|
|
812
309
|
client.off("run:cancelled", handleRunCancelled);
|
|
813
310
|
};
|
|
814
311
|
}, [client]);
|
|
815
|
-
const sendMessage =
|
|
312
|
+
const sendMessage = useCallback2(async (message, options) => {
|
|
816
313
|
try {
|
|
817
314
|
await client.sendMessage(message, options);
|
|
818
315
|
} catch (err) {
|
|
819
316
|
throw err;
|
|
820
317
|
}
|
|
821
318
|
}, [client]);
|
|
822
|
-
const clearMessages =
|
|
319
|
+
const clearMessages = useCallback2(() => {
|
|
823
320
|
client.clearMessages();
|
|
824
321
|
setMessages([]);
|
|
825
322
|
}, [client]);
|
|
826
|
-
const cancelRun =
|
|
323
|
+
const cancelRun = useCallback2(async () => {
|
|
827
324
|
await client.cancelRun();
|
|
828
325
|
}, [client]);
|
|
829
326
|
return {
|
|
@@ -841,14 +338,14 @@ function useAgnoChat() {
|
|
|
841
338
|
};
|
|
842
339
|
}
|
|
843
340
|
// src/hooks/useAgnoSession.ts
|
|
844
|
-
import { useState as
|
|
341
|
+
import { useState as useState3, useEffect as useEffect3, useCallback as useCallback3 } from "react";
|
|
845
342
|
function useAgnoSession() {
|
|
846
343
|
const client = useAgnoClient();
|
|
847
|
-
const [sessions, setSessions] =
|
|
848
|
-
const [currentSessionId, setCurrentSessionId] =
|
|
849
|
-
const [isLoading, setIsLoading] =
|
|
850
|
-
const [error, setError] =
|
|
851
|
-
|
|
344
|
+
const [sessions, setSessions] = useState3([]);
|
|
345
|
+
const [currentSessionId, setCurrentSessionId] = useState3(client.getConfig().sessionId);
|
|
346
|
+
const [isLoading, setIsLoading] = useState3(false);
|
|
347
|
+
const [error, setError] = useState3();
|
|
348
|
+
useEffect3(() => {
|
|
852
349
|
const handleSessionLoaded = (sessionId) => {
|
|
853
350
|
setCurrentSessionId(sessionId);
|
|
854
351
|
};
|
|
@@ -872,7 +369,7 @@ function useAgnoSession() {
|
|
|
872
369
|
client.off("state:change", handleStateChange);
|
|
873
370
|
};
|
|
874
371
|
}, [client]);
|
|
875
|
-
const loadSession =
|
|
372
|
+
const loadSession = useCallback3(async (sessionId, options) => {
|
|
876
373
|
setIsLoading(true);
|
|
877
374
|
setError(undefined);
|
|
878
375
|
try {
|
|
@@ -887,7 +384,7 @@ function useAgnoSession() {
|
|
|
887
384
|
setIsLoading(false);
|
|
888
385
|
}
|
|
889
386
|
}, [client]);
|
|
890
|
-
const fetchSessions =
|
|
387
|
+
const fetchSessions = useCallback3(async (options) => {
|
|
891
388
|
setIsLoading(true);
|
|
892
389
|
setError(undefined);
|
|
893
390
|
try {
|
|
@@ -902,7 +399,7 @@ function useAgnoSession() {
|
|
|
902
399
|
setIsLoading(false);
|
|
903
400
|
}
|
|
904
401
|
}, [client]);
|
|
905
|
-
const getSessionById =
|
|
402
|
+
const getSessionById = useCallback3(async (sessionId, options) => {
|
|
906
403
|
setIsLoading(true);
|
|
907
404
|
setError(undefined);
|
|
908
405
|
try {
|
|
@@ -915,7 +412,7 @@ function useAgnoSession() {
|
|
|
915
412
|
setIsLoading(false);
|
|
916
413
|
}
|
|
917
414
|
}, [client]);
|
|
918
|
-
const getRunById =
|
|
415
|
+
const getRunById = useCallback3(async (sessionId, runId, options) => {
|
|
919
416
|
setIsLoading(true);
|
|
920
417
|
setError(undefined);
|
|
921
418
|
try {
|
|
@@ -928,7 +425,7 @@ function useAgnoSession() {
|
|
|
928
425
|
setIsLoading(false);
|
|
929
426
|
}
|
|
930
427
|
}, [client]);
|
|
931
|
-
const createSession =
|
|
428
|
+
const createSession = useCallback3(async (request, options) => {
|
|
932
429
|
setIsLoading(true);
|
|
933
430
|
setError(undefined);
|
|
934
431
|
try {
|
|
@@ -942,7 +439,7 @@ function useAgnoSession() {
|
|
|
942
439
|
setIsLoading(false);
|
|
943
440
|
}
|
|
944
441
|
}, [client]);
|
|
945
|
-
const updateSession =
|
|
442
|
+
const updateSession = useCallback3(async (sessionId, request, options) => {
|
|
946
443
|
setIsLoading(true);
|
|
947
444
|
setError(undefined);
|
|
948
445
|
try {
|
|
@@ -955,7 +452,7 @@ function useAgnoSession() {
|
|
|
955
452
|
setIsLoading(false);
|
|
956
453
|
}
|
|
957
454
|
}, [client]);
|
|
958
|
-
const renameSession =
|
|
455
|
+
const renameSession = useCallback3(async (sessionId, newName, options) => {
|
|
959
456
|
setIsLoading(true);
|
|
960
457
|
setError(undefined);
|
|
961
458
|
try {
|
|
@@ -968,7 +465,7 @@ function useAgnoSession() {
|
|
|
968
465
|
setIsLoading(false);
|
|
969
466
|
}
|
|
970
467
|
}, [client]);
|
|
971
|
-
const deleteSession =
|
|
468
|
+
const deleteSession = useCallback3(async (sessionId, options) => {
|
|
972
469
|
setIsLoading(true);
|
|
973
470
|
setError(undefined);
|
|
974
471
|
try {
|
|
@@ -981,7 +478,7 @@ function useAgnoSession() {
|
|
|
981
478
|
setIsLoading(false);
|
|
982
479
|
}
|
|
983
480
|
}, [client]);
|
|
984
|
-
const deleteMultipleSessions =
|
|
481
|
+
const deleteMultipleSessions = useCallback3(async (sessionIds, options) => {
|
|
985
482
|
setIsLoading(true);
|
|
986
483
|
setError(undefined);
|
|
987
484
|
try {
|
|
@@ -993,84 +490,282 @@ function useAgnoSession() {
|
|
|
993
490
|
} finally {
|
|
994
491
|
setIsLoading(false);
|
|
995
492
|
}
|
|
996
|
-
}, [client]);
|
|
997
|
-
return {
|
|
998
|
-
sessions,
|
|
999
|
-
currentSessionId,
|
|
1000
|
-
loadSession,
|
|
1001
|
-
fetchSessions,
|
|
1002
|
-
getSessionById,
|
|
1003
|
-
getRunById,
|
|
1004
|
-
createSession,
|
|
1005
|
-
updateSession,
|
|
1006
|
-
renameSession,
|
|
1007
|
-
deleteSession,
|
|
1008
|
-
deleteMultipleSessions,
|
|
1009
|
-
isLoading,
|
|
1010
|
-
error
|
|
1011
|
-
};
|
|
1012
|
-
}
|
|
1013
|
-
// src/hooks/useAgnoActions.ts
|
|
1014
|
-
import { useState as
|
|
1015
|
-
function useAgnoActions() {
|
|
1016
|
-
const client = useAgnoClient();
|
|
1017
|
-
const [isInitializing, setIsInitializing] =
|
|
1018
|
-
const [error, setError] =
|
|
1019
|
-
const initialize =
|
|
1020
|
-
setIsInitializing(true);
|
|
1021
|
-
setError(undefined);
|
|
493
|
+
}, [client]);
|
|
494
|
+
return {
|
|
495
|
+
sessions,
|
|
496
|
+
currentSessionId,
|
|
497
|
+
loadSession,
|
|
498
|
+
fetchSessions,
|
|
499
|
+
getSessionById,
|
|
500
|
+
getRunById,
|
|
501
|
+
createSession,
|
|
502
|
+
updateSession,
|
|
503
|
+
renameSession,
|
|
504
|
+
deleteSession,
|
|
505
|
+
deleteMultipleSessions,
|
|
506
|
+
isLoading,
|
|
507
|
+
error
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
// src/hooks/useAgnoActions.ts
|
|
511
|
+
import { useState as useState4, useCallback as useCallback4 } from "react";
|
|
512
|
+
function useAgnoActions() {
|
|
513
|
+
const client = useAgnoClient();
|
|
514
|
+
const [isInitializing, setIsInitializing] = useState4(false);
|
|
515
|
+
const [error, setError] = useState4();
|
|
516
|
+
const initialize = useCallback4(async (options) => {
|
|
517
|
+
setIsInitializing(true);
|
|
518
|
+
setError(undefined);
|
|
519
|
+
try {
|
|
520
|
+
const result = await client.initialize(options);
|
|
521
|
+
return result;
|
|
522
|
+
} catch (err) {
|
|
523
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
524
|
+
setError(errorMessage);
|
|
525
|
+
throw err;
|
|
526
|
+
} finally {
|
|
527
|
+
setIsInitializing(false);
|
|
528
|
+
}
|
|
529
|
+
}, [client]);
|
|
530
|
+
const checkStatus = useCallback4(async (options) => {
|
|
531
|
+
setError(undefined);
|
|
532
|
+
try {
|
|
533
|
+
return await client.checkStatus(options);
|
|
534
|
+
} catch (err) {
|
|
535
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
536
|
+
setError(errorMessage);
|
|
537
|
+
return false;
|
|
538
|
+
}
|
|
539
|
+
}, [client]);
|
|
540
|
+
const fetchAgents = useCallback4(async (options) => {
|
|
541
|
+
setError(undefined);
|
|
542
|
+
try {
|
|
543
|
+
return await client.fetchAgents(options);
|
|
544
|
+
} catch (err) {
|
|
545
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
546
|
+
setError(errorMessage);
|
|
547
|
+
throw err;
|
|
548
|
+
}
|
|
549
|
+
}, [client]);
|
|
550
|
+
const fetchTeams = useCallback4(async (options) => {
|
|
551
|
+
setError(undefined);
|
|
552
|
+
try {
|
|
553
|
+
return await client.fetchTeams(options);
|
|
554
|
+
} catch (err) {
|
|
555
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
556
|
+
setError(errorMessage);
|
|
557
|
+
throw err;
|
|
558
|
+
}
|
|
559
|
+
}, [client]);
|
|
560
|
+
const updateConfig = useCallback4((updates) => {
|
|
561
|
+
client.updateConfig(updates);
|
|
562
|
+
}, [client]);
|
|
563
|
+
return {
|
|
564
|
+
initialize,
|
|
565
|
+
checkStatus,
|
|
566
|
+
fetchAgents,
|
|
567
|
+
fetchTeams,
|
|
568
|
+
updateConfig,
|
|
569
|
+
isInitializing,
|
|
570
|
+
error
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
// src/hooks/useAgnoToolExecution.ts
|
|
574
|
+
import { useState as useState5, useEffect as useEffect4, useCallback as useCallback5, useMemo as useMemo2 } from "react";
|
|
575
|
+
function isToolHandlerResult(value) {
|
|
576
|
+
return value && typeof value === "object" && (("data" in value) || ("ui" in value));
|
|
577
|
+
}
|
|
578
|
+
function isUIComponentSpec(value) {
|
|
579
|
+
return value && typeof value === "object" && "type" in value;
|
|
580
|
+
}
|
|
581
|
+
function processToolResult(result, _tool) {
|
|
582
|
+
if (isToolHandlerResult(result)) {
|
|
583
|
+
const { data, ui } = result;
|
|
584
|
+
return {
|
|
585
|
+
resultData: typeof data === "string" ? data : JSON.stringify(data),
|
|
586
|
+
uiComponent: ui
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
if (isUIComponentSpec(result)) {
|
|
590
|
+
return {
|
|
591
|
+
resultData: JSON.stringify(result),
|
|
592
|
+
uiComponent: result
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
return {
|
|
596
|
+
resultData: typeof result === "string" ? result : JSON.stringify(result),
|
|
597
|
+
uiComponent: undefined
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
function useAgnoToolExecution(handlers = {}, autoExecute = true, options) {
|
|
601
|
+
const client = useAgnoClient();
|
|
602
|
+
const toolHandlerContext = useToolHandlers();
|
|
603
|
+
const isTeamMode = client.getConfig().mode === "team";
|
|
604
|
+
useEffect4(() => {
|
|
605
|
+
if (isTeamMode) {
|
|
606
|
+
console.warn("[useAgnoToolExecution] HITL (Human-in-the-Loop) frontend tool execution is not supported for teams. " + "Only agents support the continue endpoint. This hook will not function in team mode.");
|
|
607
|
+
}
|
|
608
|
+
}, [isTeamMode]);
|
|
609
|
+
const mergedHandlers = useMemo2(() => {
|
|
610
|
+
const globalHandlers = toolHandlerContext?.handlers || {};
|
|
611
|
+
return { ...globalHandlers, ...handlers };
|
|
612
|
+
}, [toolHandlerContext?.handlers, handlers]);
|
|
613
|
+
const [pendingTools, setPendingTools] = useState5([]);
|
|
614
|
+
const [isPaused, setIsPaused] = useState5(false);
|
|
615
|
+
const [isExecuting, setIsExecuting] = useState5(false);
|
|
616
|
+
const [executionError, setExecutionError] = useState5();
|
|
617
|
+
useEffect4(() => {
|
|
618
|
+
if (isTeamMode) {
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
const handleRunPaused = (event) => {
|
|
622
|
+
setIsPaused(true);
|
|
623
|
+
setPendingTools(event.tools);
|
|
624
|
+
setExecutionError(undefined);
|
|
625
|
+
};
|
|
626
|
+
const handleRunContinued = () => {
|
|
627
|
+
setIsPaused(false);
|
|
628
|
+
setPendingTools([]);
|
|
629
|
+
setIsExecuting(false);
|
|
630
|
+
setExecutionError(undefined);
|
|
631
|
+
};
|
|
632
|
+
client.on("run:paused", handleRunPaused);
|
|
633
|
+
client.on("run:continued", handleRunContinued);
|
|
634
|
+
return () => {
|
|
635
|
+
client.off("run:paused", handleRunPaused);
|
|
636
|
+
client.off("run:continued", handleRunContinued);
|
|
637
|
+
};
|
|
638
|
+
}, [client, isTeamMode]);
|
|
639
|
+
const executeAndContinue = useCallback5(async () => {
|
|
640
|
+
if (!isPaused || pendingTools.length === 0) {
|
|
641
|
+
console.warn("[useAgnoToolExecution] Cannot execute: no pending tools");
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
setIsExecuting(true);
|
|
645
|
+
setExecutionError(undefined);
|
|
1022
646
|
try {
|
|
1023
|
-
const
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
647
|
+
const updatedTools = await Promise.all(pendingTools.map(async (tool) => {
|
|
648
|
+
const handler = mergedHandlers[tool.tool_name];
|
|
649
|
+
if (!handler) {
|
|
650
|
+
return {
|
|
651
|
+
...tool,
|
|
652
|
+
result: JSON.stringify({
|
|
653
|
+
error: `No handler registered for ${tool.tool_name}`
|
|
654
|
+
})
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
try {
|
|
658
|
+
const result = await handler(tool.tool_args);
|
|
659
|
+
const { resultData, uiComponent } = processToolResult(result, tool);
|
|
660
|
+
return {
|
|
661
|
+
...tool,
|
|
662
|
+
result: resultData,
|
|
663
|
+
ui_component: uiComponent
|
|
664
|
+
};
|
|
665
|
+
} catch (error) {
|
|
666
|
+
return {
|
|
667
|
+
...tool,
|
|
668
|
+
result: JSON.stringify({
|
|
669
|
+
error: error instanceof Error ? error.message : String(error)
|
|
670
|
+
})
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
}));
|
|
674
|
+
const toolsWithUI = updatedTools.filter((t) => t.ui_component);
|
|
675
|
+
if (toolsWithUI.length > 0) {
|
|
676
|
+
client.emit("ui:render", {
|
|
677
|
+
tools: updatedTools,
|
|
678
|
+
runId: client.getState().pausedRunId
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
client.addToolCallsToLastMessage(updatedTools);
|
|
682
|
+
await client.continueRun(updatedTools);
|
|
683
|
+
} catch (error) {
|
|
684
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
685
|
+
setExecutionError(errorMessage);
|
|
686
|
+
setIsExecuting(false);
|
|
687
|
+
throw error;
|
|
1031
688
|
}
|
|
1032
|
-
}, [client]);
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
689
|
+
}, [client, mergedHandlers, isPaused, pendingTools]);
|
|
690
|
+
useEffect4(() => {
|
|
691
|
+
const handleSessionLoaded = async (_sessionId) => {
|
|
692
|
+
const messages = client.getMessages();
|
|
693
|
+
for (const message of messages) {
|
|
694
|
+
if (!message.tool_calls)
|
|
695
|
+
continue;
|
|
696
|
+
for (const tool of message.tool_calls) {
|
|
697
|
+
if (tool.ui_component)
|
|
698
|
+
continue;
|
|
699
|
+
if (options?.skipToolsOnSessionLoad?.includes(tool.tool_name))
|
|
700
|
+
continue;
|
|
701
|
+
const handler = mergedHandlers[tool.tool_name];
|
|
702
|
+
if (!handler)
|
|
703
|
+
continue;
|
|
704
|
+
try {
|
|
705
|
+
const result = await handler(tool.tool_args);
|
|
706
|
+
const { uiComponent } = processToolResult(result, tool);
|
|
707
|
+
if (uiComponent) {
|
|
708
|
+
client.hydrateToolCallUI(tool.tool_call_id, uiComponent);
|
|
709
|
+
}
|
|
710
|
+
} catch (err) {
|
|
711
|
+
console.error(`Failed to hydrate UI for ${tool.tool_name}:`, err);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
client.on("session:loaded", handleSessionLoaded);
|
|
717
|
+
return () => {
|
|
718
|
+
client.off("session:loaded", handleSessionLoaded);
|
|
719
|
+
};
|
|
720
|
+
}, [client, mergedHandlers]);
|
|
721
|
+
const executeTools = useCallback5(async (tools) => {
|
|
722
|
+
return Promise.all(tools.map(async (tool) => {
|
|
723
|
+
const handler = mergedHandlers[tool.tool_name];
|
|
724
|
+
if (!handler)
|
|
725
|
+
return tool;
|
|
726
|
+
try {
|
|
727
|
+
const result = await handler(tool.tool_args);
|
|
728
|
+
const { resultData, uiComponent } = processToolResult(result, tool);
|
|
729
|
+
return {
|
|
730
|
+
...tool,
|
|
731
|
+
result: resultData,
|
|
732
|
+
ui_component: uiComponent
|
|
733
|
+
};
|
|
734
|
+
} catch (error) {
|
|
735
|
+
return {
|
|
736
|
+
...tool,
|
|
737
|
+
result: JSON.stringify({
|
|
738
|
+
error: error instanceof Error ? error.message : String(error)
|
|
739
|
+
})
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
}));
|
|
743
|
+
}, [mergedHandlers]);
|
|
744
|
+
const continueWithResults = useCallback5(async (tools, options2) => {
|
|
745
|
+
if (!isPaused) {
|
|
746
|
+
throw new Error("No paused run to continue");
|
|
1041
747
|
}
|
|
1042
|
-
|
|
1043
|
-
const fetchAgents = useCallback5(async (options) => {
|
|
1044
|
-
setError(undefined);
|
|
748
|
+
setIsExecuting(true);
|
|
1045
749
|
try {
|
|
1046
|
-
|
|
1047
|
-
} catch (
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
throw err;
|
|
750
|
+
await client.continueRun(tools, options2);
|
|
751
|
+
} catch (error) {
|
|
752
|
+
setIsExecuting(false);
|
|
753
|
+
throw error;
|
|
1051
754
|
}
|
|
1052
|
-
}, [client]);
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
return await client.fetchTeams(options);
|
|
1057
|
-
} catch (err) {
|
|
1058
|
-
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
1059
|
-
setError(errorMessage);
|
|
1060
|
-
throw err;
|
|
755
|
+
}, [client, isPaused]);
|
|
756
|
+
useEffect4(() => {
|
|
757
|
+
if (autoExecute && isPaused && !isExecuting && pendingTools.length > 0) {
|
|
758
|
+
executeAndContinue();
|
|
1061
759
|
}
|
|
1062
|
-
}, [
|
|
1063
|
-
const updateConfig = useCallback5((updates) => {
|
|
1064
|
-
client.updateConfig(updates);
|
|
1065
|
-
}, [client]);
|
|
760
|
+
}, [autoExecute, isPaused, isExecuting, pendingTools.length, executeAndContinue]);
|
|
1066
761
|
return {
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
762
|
+
isPaused,
|
|
763
|
+
isExecuting,
|
|
764
|
+
pendingTools,
|
|
765
|
+
executeAndContinue,
|
|
766
|
+
executeTools,
|
|
767
|
+
continueWithResults,
|
|
768
|
+
executionError
|
|
1074
769
|
};
|
|
1075
770
|
}
|
|
1076
771
|
// src/ui/composed/agno-chat/render-tool.ts
|
|
@@ -1096,7 +791,7 @@ function cn(...inputs) {
|
|
|
1096
791
|
}
|
|
1097
792
|
|
|
1098
793
|
// src/ui/primitives/badge.tsx
|
|
1099
|
-
import { jsx as
|
|
794
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
1100
795
|
var badgeVariants = cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", {
|
|
1101
796
|
variants: {
|
|
1102
797
|
variant: {
|
|
@@ -1111,7 +806,7 @@ var badgeVariants = cva("inline-flex items-center rounded-md border px-2.5 py-0.
|
|
|
1111
806
|
}
|
|
1112
807
|
});
|
|
1113
808
|
function Badge({ className, variant, ...props }) {
|
|
1114
|
-
return /* @__PURE__ */
|
|
809
|
+
return /* @__PURE__ */ jsx3("div", {
|
|
1115
810
|
className: cn(badgeVariants({ variant }), className),
|
|
1116
811
|
...props
|
|
1117
812
|
});
|
|
@@ -1135,10 +830,10 @@ import {
|
|
|
1135
830
|
import { isValidElement } from "react";
|
|
1136
831
|
|
|
1137
832
|
// src/ui/primitives/button.tsx
|
|
1138
|
-
import * as
|
|
833
|
+
import * as React3 from "react";
|
|
1139
834
|
import { Slot } from "@radix-ui/react-slot";
|
|
1140
835
|
import { cva as cva2 } from "class-variance-authority";
|
|
1141
|
-
import { jsx as
|
|
836
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
1142
837
|
var buttonVariants = cva2("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", {
|
|
1143
838
|
variants: {
|
|
1144
839
|
variant: {
|
|
@@ -1161,9 +856,9 @@ var buttonVariants = cva2("inline-flex items-center justify-center gap-2 whitesp
|
|
|
1161
856
|
size: "default"
|
|
1162
857
|
}
|
|
1163
858
|
});
|
|
1164
|
-
var Button =
|
|
859
|
+
var Button = React3.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
1165
860
|
const Comp = asChild ? Slot : "button";
|
|
1166
|
-
return /* @__PURE__ */
|
|
861
|
+
return /* @__PURE__ */ jsx4(Comp, {
|
|
1167
862
|
className: cn(buttonVariants({ variant, size, className })),
|
|
1168
863
|
ref,
|
|
1169
864
|
...props
|
|
@@ -1180,7 +875,7 @@ import {
|
|
|
1180
875
|
useRef,
|
|
1181
876
|
useState as useState6
|
|
1182
877
|
} from "react";
|
|
1183
|
-
import { jsx as
|
|
878
|
+
import { jsx as jsx5, jsxs, Fragment } from "react/jsx-runtime";
|
|
1184
879
|
var CodeBlockContext = createContext3({
|
|
1185
880
|
code: ""
|
|
1186
881
|
});
|
|
@@ -1232,33 +927,33 @@ var CodeBlock = ({
|
|
|
1232
927
|
});
|
|
1233
928
|
}, [code, language, showLineNumbers]);
|
|
1234
929
|
const useFallback = !html && !darkHtml;
|
|
1235
|
-
return /* @__PURE__ */
|
|
930
|
+
return /* @__PURE__ */ jsx5(CodeBlockContext.Provider, {
|
|
1236
931
|
value: { code },
|
|
1237
|
-
children: /* @__PURE__ */
|
|
932
|
+
children: /* @__PURE__ */ jsx5("div", {
|
|
1238
933
|
className: cn("group relative w-full overflow-hidden rounded-md border bg-background text-foreground", className),
|
|
1239
934
|
...props,
|
|
1240
|
-
children: /* @__PURE__ */
|
|
935
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1241
936
|
className: "relative",
|
|
1242
937
|
children: [
|
|
1243
|
-
useFallback ? /* @__PURE__ */
|
|
938
|
+
useFallback ? /* @__PURE__ */ jsx5("pre", {
|
|
1244
939
|
className: "m-0 overflow-auto bg-background p-4 text-foreground text-sm",
|
|
1245
|
-
children: /* @__PURE__ */
|
|
940
|
+
children: /* @__PURE__ */ jsx5("code", {
|
|
1246
941
|
className: "font-mono text-sm",
|
|
1247
942
|
children: code
|
|
1248
943
|
})
|
|
1249
|
-
}) : /* @__PURE__ */
|
|
944
|
+
}) : /* @__PURE__ */ jsxs(Fragment, {
|
|
1250
945
|
children: [
|
|
1251
|
-
/* @__PURE__ */
|
|
946
|
+
/* @__PURE__ */ jsx5("div", {
|
|
1252
947
|
className: "overflow-hidden dark:hidden [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm",
|
|
1253
948
|
dangerouslySetInnerHTML: { __html: html }
|
|
1254
949
|
}),
|
|
1255
|
-
/* @__PURE__ */
|
|
950
|
+
/* @__PURE__ */ jsx5("div", {
|
|
1256
951
|
className: "hidden overflow-hidden dark:block [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm",
|
|
1257
952
|
dangerouslySetInnerHTML: { __html: darkHtml }
|
|
1258
953
|
})
|
|
1259
954
|
]
|
|
1260
955
|
}),
|
|
1261
|
-
children && /* @__PURE__ */
|
|
956
|
+
children && /* @__PURE__ */ jsx5("div", {
|
|
1262
957
|
className: "absolute top-2 right-2 flex items-center gap-2",
|
|
1263
958
|
children
|
|
1264
959
|
})
|
|
@@ -1269,8 +964,8 @@ var CodeBlock = ({
|
|
|
1269
964
|
};
|
|
1270
965
|
|
|
1271
966
|
// src/ui/components/tool.tsx
|
|
1272
|
-
import { jsx as
|
|
1273
|
-
var Tool = ({ className, ...props }) => /* @__PURE__ */
|
|
967
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
968
|
+
var Tool = ({ className, ...props }) => /* @__PURE__ */ jsx6(Collapsible, {
|
|
1274
969
|
className: cn("not-prose mb-4 w-full rounded-md border", className),
|
|
1275
970
|
...props
|
|
1276
971
|
});
|
|
@@ -1285,29 +980,29 @@ var getStatusBadge = (status) => {
|
|
|
1285
980
|
"output-denied": "Denied"
|
|
1286
981
|
};
|
|
1287
982
|
const icons = {
|
|
1288
|
-
"input-streaming": /* @__PURE__ */
|
|
983
|
+
"input-streaming": /* @__PURE__ */ jsx6(CircleIcon, {
|
|
1289
984
|
className: "size-4"
|
|
1290
985
|
}),
|
|
1291
|
-
"input-available": /* @__PURE__ */
|
|
986
|
+
"input-available": /* @__PURE__ */ jsx6(ClockIcon, {
|
|
1292
987
|
className: "size-4 animate-pulse"
|
|
1293
988
|
}),
|
|
1294
|
-
"approval-requested": /* @__PURE__ */
|
|
989
|
+
"approval-requested": /* @__PURE__ */ jsx6(ClockIcon, {
|
|
1295
990
|
className: "size-4 text-yellow-600"
|
|
1296
991
|
}),
|
|
1297
|
-
"approval-responded": /* @__PURE__ */
|
|
992
|
+
"approval-responded": /* @__PURE__ */ jsx6(CheckCircleIcon, {
|
|
1298
993
|
className: "size-4 text-blue-600"
|
|
1299
994
|
}),
|
|
1300
|
-
"output-available": /* @__PURE__ */
|
|
995
|
+
"output-available": /* @__PURE__ */ jsx6(CheckCircleIcon, {
|
|
1301
996
|
className: "size-4 text-green-600"
|
|
1302
997
|
}),
|
|
1303
|
-
"output-error": /* @__PURE__ */
|
|
998
|
+
"output-error": /* @__PURE__ */ jsx6(XCircleIcon, {
|
|
1304
999
|
className: "size-4 text-red-600"
|
|
1305
1000
|
}),
|
|
1306
|
-
"output-denied": /* @__PURE__ */
|
|
1001
|
+
"output-denied": /* @__PURE__ */ jsx6(XCircleIcon, {
|
|
1307
1002
|
className: "size-4 text-orange-600"
|
|
1308
1003
|
})
|
|
1309
1004
|
};
|
|
1310
|
-
return /* @__PURE__ */
|
|
1005
|
+
return /* @__PURE__ */ jsxs2(Badge, {
|
|
1311
1006
|
className: "gap-1.5 rounded-full text-xs",
|
|
1312
1007
|
variant: "secondary",
|
|
1313
1008
|
children: [
|
|
@@ -1316,43 +1011,43 @@ var getStatusBadge = (status) => {
|
|
|
1316
1011
|
]
|
|
1317
1012
|
});
|
|
1318
1013
|
};
|
|
1319
|
-
var ToolHeader = ({ className, title, type, state, ...props }) => /* @__PURE__ */
|
|
1014
|
+
var ToolHeader = ({ className, title, type, state, ...props }) => /* @__PURE__ */ jsxs2(CollapsibleTrigger2, {
|
|
1320
1015
|
className: cn("group flex w-full items-center justify-between gap-4 p-3", className),
|
|
1321
1016
|
...props,
|
|
1322
1017
|
children: [
|
|
1323
|
-
/* @__PURE__ */
|
|
1018
|
+
/* @__PURE__ */ jsxs2("div", {
|
|
1324
1019
|
className: "flex items-center gap-2",
|
|
1325
1020
|
children: [
|
|
1326
|
-
/* @__PURE__ */
|
|
1021
|
+
/* @__PURE__ */ jsx6(WrenchIcon, {
|
|
1327
1022
|
className: "size-4 text-muted-foreground"
|
|
1328
1023
|
}),
|
|
1329
|
-
/* @__PURE__ */
|
|
1024
|
+
/* @__PURE__ */ jsx6("span", {
|
|
1330
1025
|
className: "font-medium text-sm",
|
|
1331
1026
|
children: title ?? type?.split("-").slice(1).join("-") ?? "Tool"
|
|
1332
1027
|
}),
|
|
1333
1028
|
getStatusBadge(state)
|
|
1334
1029
|
]
|
|
1335
1030
|
}),
|
|
1336
|
-
/* @__PURE__ */
|
|
1031
|
+
/* @__PURE__ */ jsx6(ChevronDownIcon, {
|
|
1337
1032
|
className: "size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"
|
|
1338
1033
|
})
|
|
1339
1034
|
]
|
|
1340
1035
|
});
|
|
1341
|
-
var ToolContent = ({ className, ...props }) => /* @__PURE__ */
|
|
1036
|
+
var ToolContent = ({ className, ...props }) => /* @__PURE__ */ jsx6(CollapsibleContent2, {
|
|
1342
1037
|
className: cn("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", className),
|
|
1343
1038
|
...props
|
|
1344
1039
|
});
|
|
1345
|
-
var ToolInput = ({ className, input, ...props }) => /* @__PURE__ */
|
|
1040
|
+
var ToolInput = ({ className, input, ...props }) => /* @__PURE__ */ jsxs2("div", {
|
|
1346
1041
|
className: cn("space-y-2 overflow-hidden p-4", className),
|
|
1347
1042
|
...props,
|
|
1348
1043
|
children: [
|
|
1349
|
-
/* @__PURE__ */
|
|
1044
|
+
/* @__PURE__ */ jsx6("h4", {
|
|
1350
1045
|
className: "font-medium text-muted-foreground text-xs uppercase tracking-wide",
|
|
1351
1046
|
children: "Parameters"
|
|
1352
1047
|
}),
|
|
1353
|
-
/* @__PURE__ */
|
|
1048
|
+
/* @__PURE__ */ jsx6("div", {
|
|
1354
1049
|
className: "rounded-md bg-muted/50",
|
|
1355
|
-
children: /* @__PURE__ */
|
|
1050
|
+
children: /* @__PURE__ */ jsx6(CodeBlock, {
|
|
1356
1051
|
code: JSON.stringify(input, null, 2),
|
|
1357
1052
|
language: "json"
|
|
1358
1053
|
})
|
|
@@ -1363,32 +1058,32 @@ var ToolOutput = ({ className, output, errorText, ...props }) => {
|
|
|
1363
1058
|
if (!(output || errorText)) {
|
|
1364
1059
|
return null;
|
|
1365
1060
|
}
|
|
1366
|
-
let Output = /* @__PURE__ */
|
|
1061
|
+
let Output = /* @__PURE__ */ jsx6("div", {
|
|
1367
1062
|
children: output
|
|
1368
1063
|
});
|
|
1369
1064
|
if (typeof output === "object" && !isValidElement(output)) {
|
|
1370
|
-
Output = /* @__PURE__ */
|
|
1065
|
+
Output = /* @__PURE__ */ jsx6(CodeBlock, {
|
|
1371
1066
|
code: JSON.stringify(output, null, 2),
|
|
1372
1067
|
language: "json"
|
|
1373
1068
|
});
|
|
1374
1069
|
} else if (typeof output === "string") {
|
|
1375
|
-
Output = /* @__PURE__ */
|
|
1070
|
+
Output = /* @__PURE__ */ jsx6(CodeBlock, {
|
|
1376
1071
|
code: output,
|
|
1377
1072
|
language: "json"
|
|
1378
1073
|
});
|
|
1379
1074
|
}
|
|
1380
|
-
return /* @__PURE__ */
|
|
1075
|
+
return /* @__PURE__ */ jsxs2("div", {
|
|
1381
1076
|
className: cn("space-y-2 p-4", className),
|
|
1382
1077
|
...props,
|
|
1383
1078
|
children: [
|
|
1384
|
-
/* @__PURE__ */
|
|
1079
|
+
/* @__PURE__ */ jsx6("h4", {
|
|
1385
1080
|
className: "font-medium text-muted-foreground text-xs uppercase tracking-wide",
|
|
1386
1081
|
children: errorText ? "Error" : "Result"
|
|
1387
1082
|
}),
|
|
1388
|
-
/* @__PURE__ */
|
|
1083
|
+
/* @__PURE__ */ jsxs2("div", {
|
|
1389
1084
|
className: cn("overflow-x-auto rounded-md text-xs [&_table]:w-full", errorText ? "bg-destructive/10 text-destructive" : "bg-muted/50 text-foreground"),
|
|
1390
1085
|
children: [
|
|
1391
|
-
errorText && /* @__PURE__ */
|
|
1086
|
+
errorText && /* @__PURE__ */ jsx6("div", {
|
|
1392
1087
|
children: errorText
|
|
1393
1088
|
}),
|
|
1394
1089
|
Output
|
|
@@ -1398,50 +1093,25 @@ var ToolOutput = ({ className, output, errorText, ...props }) => {
|
|
|
1398
1093
|
});
|
|
1399
1094
|
};
|
|
1400
1095
|
|
|
1401
|
-
// src/ui/primitives/tooltip.tsx
|
|
1402
|
-
import * as React5 from "react";
|
|
1403
|
-
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
1404
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1405
|
-
var TooltipProvider = TooltipPrimitive.Provider;
|
|
1406
|
-
var Tooltip = TooltipPrimitive.Root;
|
|
1407
|
-
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
1408
|
-
var TooltipContent = React5.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx8(TooltipPrimitive.Portal, {
|
|
1409
|
-
children: /* @__PURE__ */ jsx8(TooltipPrimitive.Content, {
|
|
1410
|
-
ref,
|
|
1411
|
-
sideOffset,
|
|
1412
|
-
className: cn("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]", className),
|
|
1413
|
-
...props
|
|
1414
|
-
})
|
|
1415
|
-
}));
|
|
1416
|
-
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
1417
|
-
|
|
1418
|
-
// src/ui/components/artifact.tsx
|
|
1419
|
-
import { XIcon } from "lucide-react";
|
|
1420
|
-
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1421
|
-
var Artifact = ({ className, ...props }) => /* @__PURE__ */ jsx9("div", {
|
|
1422
|
-
className: cn("flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm", className),
|
|
1423
|
-
...props
|
|
1424
|
-
});
|
|
1425
|
-
|
|
1426
1096
|
// src/ui/composed/agno-chat/tool-building-blocks.tsx
|
|
1427
|
-
import { jsx as
|
|
1097
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1428
1098
|
var getToolState = (tool) => tool.tool_call_error ? "output-error" : "output-available";
|
|
1429
1099
|
function ToolDebugCard({ tool, defaultOpen }) {
|
|
1430
1100
|
const output = tool.result ?? tool.content;
|
|
1431
|
-
return /* @__PURE__ */
|
|
1101
|
+
return /* @__PURE__ */ jsxs3(Tool, {
|
|
1432
1102
|
defaultOpen,
|
|
1433
1103
|
children: [
|
|
1434
|
-
/* @__PURE__ */
|
|
1104
|
+
/* @__PURE__ */ jsx7(ToolHeader, {
|
|
1435
1105
|
title: tool.tool_name,
|
|
1436
1106
|
type: "tool-use",
|
|
1437
1107
|
state: getToolState(tool)
|
|
1438
1108
|
}),
|
|
1439
|
-
/* @__PURE__ */
|
|
1109
|
+
/* @__PURE__ */ jsxs3(ToolContent, {
|
|
1440
1110
|
children: [
|
|
1441
|
-
/* @__PURE__ */
|
|
1111
|
+
/* @__PURE__ */ jsx7(ToolInput, {
|
|
1442
1112
|
input: tool.tool_args
|
|
1443
1113
|
}),
|
|
1444
|
-
output ? /* @__PURE__ */
|
|
1114
|
+
output ? /* @__PURE__ */ jsx7(ToolOutput, {
|
|
1445
1115
|
output,
|
|
1446
1116
|
errorText: tool.tool_call_error ? "Tool execution failed" : undefined
|
|
1447
1117
|
}) : null
|
|
@@ -1450,24 +1120,27 @@ function ToolDebugCard({ tool, defaultOpen }) {
|
|
|
1450
1120
|
]
|
|
1451
1121
|
});
|
|
1452
1122
|
}
|
|
1453
|
-
function ToolGenerativeUI({ tool }) {
|
|
1454
|
-
const uiComponent = tool.ui_component;
|
|
1455
|
-
if (!uiComponent)
|
|
1456
|
-
return null;
|
|
1457
|
-
return uiComponent.layout === "artifact" ? /* @__PURE__ */ jsx10(Artifact, {
|
|
1458
|
-
children: /* @__PURE__ */ jsx10(GenerativeUIRenderer, {
|
|
1459
|
-
spec: uiComponent,
|
|
1460
|
-
className: "w-full p-2"
|
|
1461
|
-
})
|
|
1462
|
-
}) : /* @__PURE__ */ jsx10(GenerativeUIRenderer, {
|
|
1463
|
-
spec: uiComponent,
|
|
1464
|
-
className: "w-full"
|
|
1465
|
-
});
|
|
1466
|
-
}
|
|
1467
1123
|
// src/ui/composed/agno-message/message.tsx
|
|
1468
1124
|
import { useMemo as useMemo3, useState as useState8 } from "react";
|
|
1469
1125
|
import { AlertCircle as AlertCircle2, FileIcon as FileIcon4, Music as Music2 } from "lucide-react";
|
|
1470
1126
|
|
|
1127
|
+
// src/ui/primitives/tooltip.tsx
|
|
1128
|
+
import * as React4 from "react";
|
|
1129
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
1130
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1131
|
+
var TooltipProvider = TooltipPrimitive.Provider;
|
|
1132
|
+
var Tooltip = TooltipPrimitive.Root;
|
|
1133
|
+
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
1134
|
+
var TooltipContent = React4.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx8(TooltipPrimitive.Portal, {
|
|
1135
|
+
children: /* @__PURE__ */ jsx8(TooltipPrimitive.Content, {
|
|
1136
|
+
ref,
|
|
1137
|
+
sideOffset,
|
|
1138
|
+
className: cn("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]", className),
|
|
1139
|
+
...props
|
|
1140
|
+
})
|
|
1141
|
+
}));
|
|
1142
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
1143
|
+
|
|
1471
1144
|
// src/ui/lib/format-timestamp.ts
|
|
1472
1145
|
function formatSmartTimestamp(date) {
|
|
1473
1146
|
const now = new Date;
|
|
@@ -1504,22 +1177,22 @@ function formatFullTimestamp(date) {
|
|
|
1504
1177
|
}
|
|
1505
1178
|
|
|
1506
1179
|
// src/ui/components/smart-timestamp.tsx
|
|
1507
|
-
import { jsx as
|
|
1180
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1508
1181
|
function SmartTimestamp({ date, formatShort, className }) {
|
|
1509
1182
|
const shortText = formatShort ? formatShort(date) : formatSmartTimestamp(date);
|
|
1510
1183
|
const fullText = formatFullTimestamp(date);
|
|
1511
|
-
return /* @__PURE__ */
|
|
1512
|
-
children: /* @__PURE__ */
|
|
1184
|
+
return /* @__PURE__ */ jsx9(TooltipProvider, {
|
|
1185
|
+
children: /* @__PURE__ */ jsxs4(Tooltip, {
|
|
1513
1186
|
children: [
|
|
1514
|
-
/* @__PURE__ */
|
|
1187
|
+
/* @__PURE__ */ jsx9(TooltipTrigger, {
|
|
1515
1188
|
asChild: true,
|
|
1516
|
-
children: /* @__PURE__ */
|
|
1189
|
+
children: /* @__PURE__ */ jsx9("span", {
|
|
1517
1190
|
className,
|
|
1518
1191
|
children: shortText
|
|
1519
1192
|
})
|
|
1520
1193
|
}),
|
|
1521
|
-
/* @__PURE__ */
|
|
1522
|
-
children: /* @__PURE__ */
|
|
1194
|
+
/* @__PURE__ */ jsx9(TooltipContent, {
|
|
1195
|
+
children: /* @__PURE__ */ jsx9("p", {
|
|
1523
1196
|
children: fullText
|
|
1524
1197
|
})
|
|
1525
1198
|
})
|
|
@@ -1597,11 +1270,11 @@ function isPreviewable(mimeType) {
|
|
|
1597
1270
|
|
|
1598
1271
|
// src/ui/components/file-preview-card.tsx
|
|
1599
1272
|
import { FileIcon, Search } from "lucide-react";
|
|
1600
|
-
import { jsx as
|
|
1273
|
+
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1601
1274
|
function ExtBadge({ ext }) {
|
|
1602
1275
|
if (!ext)
|
|
1603
1276
|
return null;
|
|
1604
|
-
return /* @__PURE__ */
|
|
1277
|
+
return /* @__PURE__ */ jsx10("span", {
|
|
1605
1278
|
className: "absolute bottom-1.5 left-1.5 rounded px-1 py-0.5 text-[9px] font-semibold uppercase leading-none bg-background/80 text-muted-foreground border border-border/50 backdrop-blur-sm",
|
|
1606
1279
|
children: ext
|
|
1607
1280
|
});
|
|
@@ -1612,23 +1285,23 @@ function FilePreviewCard({ file, onClick, className }) {
|
|
|
1612
1285
|
const ext = getFileExtension(file.name, file.type);
|
|
1613
1286
|
const cardBase = cn("group relative flex flex-col overflow-hidden rounded-xl border border-border bg-muted/20 w-28 h-28", isClickable && "cursor-pointer hover:border-foreground/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 transition-colors", className);
|
|
1614
1287
|
if (previewType === "image" && file.url) {
|
|
1615
|
-
return /* @__PURE__ */
|
|
1288
|
+
return /* @__PURE__ */ jsxs5("button", {
|
|
1616
1289
|
type: "button",
|
|
1617
1290
|
onClick,
|
|
1618
1291
|
disabled: !isClickable,
|
|
1619
1292
|
className: cardBase,
|
|
1620
1293
|
children: [
|
|
1621
|
-
/* @__PURE__ */
|
|
1294
|
+
/* @__PURE__ */ jsx10("img", {
|
|
1622
1295
|
src: file.url,
|
|
1623
1296
|
alt: file.name,
|
|
1624
1297
|
className: "w-full h-full object-cover"
|
|
1625
1298
|
}),
|
|
1626
|
-
/* @__PURE__ */
|
|
1299
|
+
/* @__PURE__ */ jsx10(ExtBadge, {
|
|
1627
1300
|
ext
|
|
1628
1301
|
}),
|
|
1629
|
-
isClickable && /* @__PURE__ */
|
|
1302
|
+
isClickable && /* @__PURE__ */ jsx10("div", {
|
|
1630
1303
|
className: "absolute inset-0 flex items-center justify-center bg-black/0 group-hover:bg-black/30 transition-colors",
|
|
1631
|
-
children: /* @__PURE__ */
|
|
1304
|
+
children: /* @__PURE__ */ jsx10(Search, {
|
|
1632
1305
|
className: "h-5 w-5 text-white opacity-0 group-hover:opacity-100 transition-opacity"
|
|
1633
1306
|
})
|
|
1634
1307
|
})
|
|
@@ -1636,66 +1309,66 @@ function FilePreviewCard({ file, onClick, className }) {
|
|
|
1636
1309
|
});
|
|
1637
1310
|
}
|
|
1638
1311
|
if (previewType === "pdf" && file.url) {
|
|
1639
|
-
return /* @__PURE__ */
|
|
1312
|
+
return /* @__PURE__ */ jsxs5("button", {
|
|
1640
1313
|
type: "button",
|
|
1641
1314
|
onClick,
|
|
1642
1315
|
disabled: !isClickable,
|
|
1643
1316
|
className: cardBase,
|
|
1644
1317
|
children: [
|
|
1645
|
-
/* @__PURE__ */
|
|
1318
|
+
/* @__PURE__ */ jsx10("div", {
|
|
1646
1319
|
className: "w-full h-full overflow-hidden pointer-events-none",
|
|
1647
|
-
children: /* @__PURE__ */
|
|
1320
|
+
children: /* @__PURE__ */ jsx10("object", {
|
|
1648
1321
|
data: `${file.url}#page=1&view=FitH`,
|
|
1649
1322
|
type: "application/pdf",
|
|
1650
1323
|
className: "w-[200%] h-[200%] origin-top-left scale-50",
|
|
1651
1324
|
"aria-label": file.name,
|
|
1652
|
-
children: /* @__PURE__ */
|
|
1325
|
+
children: /* @__PURE__ */ jsx10("div", {
|
|
1653
1326
|
className: "flex items-center justify-center w-full h-full",
|
|
1654
|
-
children: /* @__PURE__ */
|
|
1327
|
+
children: /* @__PURE__ */ jsx10(FileIcon, {
|
|
1655
1328
|
className: "h-8 w-8 text-muted-foreground/40"
|
|
1656
1329
|
})
|
|
1657
1330
|
})
|
|
1658
1331
|
})
|
|
1659
1332
|
}),
|
|
1660
|
-
/* @__PURE__ */
|
|
1333
|
+
/* @__PURE__ */ jsx10(ExtBadge, {
|
|
1661
1334
|
ext
|
|
1662
1335
|
}),
|
|
1663
|
-
isClickable && /* @__PURE__ */
|
|
1336
|
+
isClickable && /* @__PURE__ */ jsx10("div", {
|
|
1664
1337
|
className: "absolute inset-0 flex items-center justify-center bg-black/0 group-hover:bg-black/10 transition-colors",
|
|
1665
|
-
children: /* @__PURE__ */
|
|
1338
|
+
children: /* @__PURE__ */ jsx10(Search, {
|
|
1666
1339
|
className: "h-5 w-5 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"
|
|
1667
1340
|
})
|
|
1668
1341
|
})
|
|
1669
1342
|
]
|
|
1670
1343
|
});
|
|
1671
1344
|
}
|
|
1672
|
-
return /* @__PURE__ */
|
|
1345
|
+
return /* @__PURE__ */ jsxs5("button", {
|
|
1673
1346
|
type: "button",
|
|
1674
1347
|
onClick,
|
|
1675
1348
|
disabled: !isClickable,
|
|
1676
1349
|
className: cardBase,
|
|
1677
1350
|
children: [
|
|
1678
|
-
/* @__PURE__ */
|
|
1351
|
+
/* @__PURE__ */ jsx10("div", {
|
|
1679
1352
|
className: "flex-1 flex items-center justify-center",
|
|
1680
|
-
children: /* @__PURE__ */
|
|
1353
|
+
children: /* @__PURE__ */ jsx10(FileIcon, {
|
|
1681
1354
|
className: "h-8 w-8 text-muted-foreground/40"
|
|
1682
1355
|
})
|
|
1683
1356
|
}),
|
|
1684
|
-
/* @__PURE__ */
|
|
1357
|
+
/* @__PURE__ */ jsxs5("div", {
|
|
1685
1358
|
className: "w-full text-center min-w-0 px-2 pb-2 space-y-0.5",
|
|
1686
1359
|
children: [
|
|
1687
|
-
/* @__PURE__ */
|
|
1360
|
+
/* @__PURE__ */ jsx10("p", {
|
|
1688
1361
|
className: "text-[10px] text-foreground truncate leading-tight",
|
|
1689
1362
|
title: file.name,
|
|
1690
1363
|
children: file.name
|
|
1691
1364
|
}),
|
|
1692
|
-
file.size != null && file.size > 0 && /* @__PURE__ */
|
|
1365
|
+
file.size != null && file.size > 0 && /* @__PURE__ */ jsx10("p", {
|
|
1693
1366
|
className: "text-[9px] text-muted-foreground leading-tight",
|
|
1694
1367
|
children: formatFileSize(file.size)
|
|
1695
1368
|
})
|
|
1696
1369
|
]
|
|
1697
1370
|
}),
|
|
1698
|
-
/* @__PURE__ */
|
|
1371
|
+
/* @__PURE__ */ jsx10(ExtBadge, {
|
|
1699
1372
|
ext
|
|
1700
1373
|
})
|
|
1701
1374
|
]
|
|
@@ -1703,14 +1376,14 @@ function FilePreviewCard({ file, onClick, className }) {
|
|
|
1703
1376
|
}
|
|
1704
1377
|
|
|
1705
1378
|
// src/ui/primitives/dialog.tsx
|
|
1706
|
-
import * as
|
|
1379
|
+
import * as React5 from "react";
|
|
1707
1380
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
1708
1381
|
import { cva as cva3 } from "class-variance-authority";
|
|
1709
1382
|
import { X } from "lucide-react";
|
|
1710
|
-
import { jsx as
|
|
1383
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1711
1384
|
var Dialog = DialogPrimitive.Root;
|
|
1712
1385
|
var DialogPortal = DialogPrimitive.Portal;
|
|
1713
|
-
var DialogOverlay =
|
|
1386
|
+
var DialogOverlay = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(DialogPrimitive.Overlay, {
|
|
1714
1387
|
ref,
|
|
1715
1388
|
className: cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className),
|
|
1716
1389
|
...props
|
|
@@ -1727,22 +1400,22 @@ var dialogContentVariants = cva3("fixed left-[50%] top-[50%] z-50 grid translate
|
|
|
1727
1400
|
variant: "default"
|
|
1728
1401
|
}
|
|
1729
1402
|
});
|
|
1730
|
-
var DialogContent =
|
|
1403
|
+
var DialogContent = React5.forwardRef(({ className, variant, children, ...props }, ref) => /* @__PURE__ */ jsxs6(DialogPortal, {
|
|
1731
1404
|
children: [
|
|
1732
|
-
/* @__PURE__ */
|
|
1733
|
-
/* @__PURE__ */
|
|
1405
|
+
/* @__PURE__ */ jsx11(DialogOverlay, {}),
|
|
1406
|
+
/* @__PURE__ */ jsxs6(DialogPrimitive.Content, {
|
|
1734
1407
|
ref,
|
|
1735
1408
|
className: cn(dialogContentVariants({ variant }), className),
|
|
1736
1409
|
...props,
|
|
1737
1410
|
children: [
|
|
1738
1411
|
children,
|
|
1739
|
-
/* @__PURE__ */
|
|
1412
|
+
/* @__PURE__ */ jsxs6(DialogPrimitive.Close, {
|
|
1740
1413
|
className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
|
|
1741
1414
|
children: [
|
|
1742
|
-
/* @__PURE__ */
|
|
1415
|
+
/* @__PURE__ */ jsx11(X, {
|
|
1743
1416
|
className: "h-4 w-4"
|
|
1744
1417
|
}),
|
|
1745
|
-
/* @__PURE__ */
|
|
1418
|
+
/* @__PURE__ */ jsx11("span", {
|
|
1746
1419
|
className: "sr-only",
|
|
1747
1420
|
children: "Close"
|
|
1748
1421
|
})
|
|
@@ -1753,23 +1426,23 @@ var DialogContent = React6.forwardRef(({ className, variant, children, ...props
|
|
|
1753
1426
|
]
|
|
1754
1427
|
}));
|
|
1755
1428
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
1756
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */
|
|
1429
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx11("div", {
|
|
1757
1430
|
className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className),
|
|
1758
1431
|
...props
|
|
1759
1432
|
});
|
|
1760
1433
|
DialogHeader.displayName = "DialogHeader";
|
|
1761
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */
|
|
1434
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx11("div", {
|
|
1762
1435
|
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
1763
1436
|
...props
|
|
1764
1437
|
});
|
|
1765
1438
|
DialogFooter.displayName = "DialogFooter";
|
|
1766
|
-
var DialogTitle =
|
|
1439
|
+
var DialogTitle = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(DialogPrimitive.Title, {
|
|
1767
1440
|
ref,
|
|
1768
1441
|
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
1769
1442
|
...props
|
|
1770
1443
|
}));
|
|
1771
1444
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
1772
|
-
var DialogDescription =
|
|
1445
|
+
var DialogDescription = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(DialogPrimitive.Description, {
|
|
1773
1446
|
ref,
|
|
1774
1447
|
className: cn("text-sm text-muted-foreground", className),
|
|
1775
1448
|
...props
|
|
@@ -1778,56 +1451,56 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
|
1778
1451
|
|
|
1779
1452
|
// src/ui/components/file-preview-modal.tsx
|
|
1780
1453
|
import { Download, FileIcon as FileIcon2 } from "lucide-react";
|
|
1781
|
-
import { jsx as
|
|
1454
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1782
1455
|
function FilePreviewModal({ open, onOpenChange, file }) {
|
|
1783
1456
|
if (!file)
|
|
1784
1457
|
return null;
|
|
1785
1458
|
const previewType = getFilePreviewType(file.type);
|
|
1786
1459
|
const canPreview = isPreviewable(file.type) && !!file.url;
|
|
1787
|
-
return /* @__PURE__ */
|
|
1460
|
+
return /* @__PURE__ */ jsx12(Dialog, {
|
|
1788
1461
|
open,
|
|
1789
1462
|
onOpenChange,
|
|
1790
|
-
children: previewType === "image" && file.url ? /* @__PURE__ */
|
|
1463
|
+
children: previewType === "image" && file.url ? /* @__PURE__ */ jsxs7(DialogContent, {
|
|
1791
1464
|
variant: "lightbox",
|
|
1792
1465
|
"aria-describedby": undefined,
|
|
1793
1466
|
children: [
|
|
1794
|
-
/* @__PURE__ */
|
|
1467
|
+
/* @__PURE__ */ jsx12(DialogTitle, {
|
|
1795
1468
|
className: "sr-only",
|
|
1796
1469
|
children: file.name
|
|
1797
1470
|
}),
|
|
1798
|
-
/* @__PURE__ */
|
|
1471
|
+
/* @__PURE__ */ jsx12("img", {
|
|
1799
1472
|
src: file.url,
|
|
1800
1473
|
alt: file.name,
|
|
1801
1474
|
className: "max-h-[85vh] max-w-full object-contain rounded-md"
|
|
1802
1475
|
})
|
|
1803
1476
|
]
|
|
1804
|
-
}) : previewType === "pdf" && file.url ? /* @__PURE__ */
|
|
1477
|
+
}) : previewType === "pdf" && file.url ? /* @__PURE__ */ jsxs7(DialogContent, {
|
|
1805
1478
|
variant: "lightbox",
|
|
1806
1479
|
className: "w-[80vw] h-[85vh]",
|
|
1807
1480
|
"aria-describedby": undefined,
|
|
1808
1481
|
children: [
|
|
1809
|
-
/* @__PURE__ */
|
|
1482
|
+
/* @__PURE__ */ jsx12(DialogTitle, {
|
|
1810
1483
|
className: "sr-only",
|
|
1811
1484
|
children: file.name
|
|
1812
1485
|
}),
|
|
1813
|
-
/* @__PURE__ */
|
|
1486
|
+
/* @__PURE__ */ jsx12("object", {
|
|
1814
1487
|
data: file.url,
|
|
1815
1488
|
type: "application/pdf",
|
|
1816
1489
|
className: "w-full h-full rounded-md",
|
|
1817
|
-
children: /* @__PURE__ */
|
|
1490
|
+
children: /* @__PURE__ */ jsxs7("div", {
|
|
1818
1491
|
className: "flex flex-col items-center justify-center h-full gap-3 text-muted-foreground",
|
|
1819
1492
|
children: [
|
|
1820
|
-
/* @__PURE__ */
|
|
1493
|
+
/* @__PURE__ */ jsx12("p", {
|
|
1821
1494
|
className: "text-sm",
|
|
1822
1495
|
children: "Unable to display PDF"
|
|
1823
1496
|
}),
|
|
1824
|
-
/* @__PURE__ */
|
|
1497
|
+
/* @__PURE__ */ jsxs7("a", {
|
|
1825
1498
|
href: file.url,
|
|
1826
1499
|
target: "_blank",
|
|
1827
1500
|
rel: "noopener noreferrer",
|
|
1828
1501
|
className: "inline-flex items-center gap-1.5 text-sm text-primary hover:underline",
|
|
1829
1502
|
children: [
|
|
1830
|
-
/* @__PURE__ */
|
|
1503
|
+
/* @__PURE__ */ jsx12(Download, {
|
|
1831
1504
|
className: "h-4 w-4"
|
|
1832
1505
|
}),
|
|
1833
1506
|
"Download ",
|
|
@@ -1838,48 +1511,48 @@ function FilePreviewModal({ open, onOpenChange, file }) {
|
|
|
1838
1511
|
})
|
|
1839
1512
|
})
|
|
1840
1513
|
]
|
|
1841
|
-
}) : /* @__PURE__ */
|
|
1514
|
+
}) : /* @__PURE__ */ jsxs7(DialogContent, {
|
|
1842
1515
|
children: [
|
|
1843
|
-
/* @__PURE__ */
|
|
1516
|
+
/* @__PURE__ */ jsxs7(DialogHeader, {
|
|
1844
1517
|
children: [
|
|
1845
|
-
/* @__PURE__ */
|
|
1518
|
+
/* @__PURE__ */ jsxs7(DialogTitle, {
|
|
1846
1519
|
className: "flex items-center gap-2",
|
|
1847
1520
|
children: [
|
|
1848
|
-
/* @__PURE__ */
|
|
1521
|
+
/* @__PURE__ */ jsx12(FileIcon2, {
|
|
1849
1522
|
className: "h-5 w-5 text-muted-foreground"
|
|
1850
1523
|
}),
|
|
1851
1524
|
file.name
|
|
1852
1525
|
]
|
|
1853
1526
|
}),
|
|
1854
|
-
/* @__PURE__ */
|
|
1527
|
+
/* @__PURE__ */ jsxs7(DialogDescription, {
|
|
1855
1528
|
children: [
|
|
1856
|
-
file.size != null && file.size > 0 && /* @__PURE__ */
|
|
1529
|
+
file.size != null && file.size > 0 && /* @__PURE__ */ jsx12("span", {
|
|
1857
1530
|
children: formatFileSize(file.size)
|
|
1858
1531
|
}),
|
|
1859
|
-
!canPreview && /* @__PURE__ */
|
|
1532
|
+
!canPreview && /* @__PURE__ */ jsx12("span", {
|
|
1860
1533
|
children: " · Preview not available for this file type"
|
|
1861
1534
|
})
|
|
1862
1535
|
]
|
|
1863
1536
|
})
|
|
1864
1537
|
]
|
|
1865
1538
|
}),
|
|
1866
|
-
/* @__PURE__ */
|
|
1539
|
+
/* @__PURE__ */ jsxs7("div", {
|
|
1867
1540
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground gap-3",
|
|
1868
1541
|
children: [
|
|
1869
|
-
/* @__PURE__ */
|
|
1542
|
+
/* @__PURE__ */ jsx12(FileIcon2, {
|
|
1870
1543
|
className: "h-12 w-12"
|
|
1871
1544
|
}),
|
|
1872
|
-
/* @__PURE__ */
|
|
1545
|
+
/* @__PURE__ */ jsx12("p", {
|
|
1873
1546
|
className: "text-sm",
|
|
1874
1547
|
children: "Preview not available"
|
|
1875
1548
|
}),
|
|
1876
|
-
file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */
|
|
1549
|
+
file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */ jsxs7("a", {
|
|
1877
1550
|
href: file.url,
|
|
1878
1551
|
target: "_blank",
|
|
1879
1552
|
rel: "noopener noreferrer",
|
|
1880
1553
|
className: "inline-flex items-center gap-1.5 text-sm text-primary hover:underline",
|
|
1881
1554
|
children: [
|
|
1882
|
-
/* @__PURE__ */
|
|
1555
|
+
/* @__PURE__ */ jsx12(Download, {
|
|
1883
1556
|
className: "h-4 w-4"
|
|
1884
1557
|
}),
|
|
1885
1558
|
"Download file"
|
|
@@ -1895,7 +1568,7 @@ function FilePreviewModal({ open, onOpenChange, file }) {
|
|
|
1895
1568
|
// src/ui/components/image-lightbox.tsx
|
|
1896
1569
|
import { useState as useState7, useEffect as useEffect6, useCallback as useCallback6 } from "react";
|
|
1897
1570
|
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
1898
|
-
import { jsx as
|
|
1571
|
+
import { jsx as jsx13, jsxs as jsxs8, Fragment as Fragment2 } from "react/jsx-runtime";
|
|
1899
1572
|
function ImageLightbox({ open, onOpenChange, images, initialIndex = 0 }) {
|
|
1900
1573
|
const [currentIndex, setCurrentIndex] = useState7(initialIndex);
|
|
1901
1574
|
const hasMultiple = images.length > 1;
|
|
@@ -1926,56 +1599,56 @@ function ImageLightbox({ open, onOpenChange, images, initialIndex = 0 }) {
|
|
|
1926
1599
|
const current = images[currentIndex];
|
|
1927
1600
|
if (!current)
|
|
1928
1601
|
return null;
|
|
1929
|
-
return /* @__PURE__ */
|
|
1602
|
+
return /* @__PURE__ */ jsx13(Dialog, {
|
|
1930
1603
|
open,
|
|
1931
1604
|
onOpenChange,
|
|
1932
|
-
children: /* @__PURE__ */
|
|
1605
|
+
children: /* @__PURE__ */ jsxs8(DialogContent, {
|
|
1933
1606
|
variant: "lightbox",
|
|
1934
1607
|
"aria-describedby": undefined,
|
|
1935
1608
|
children: [
|
|
1936
|
-
/* @__PURE__ */
|
|
1609
|
+
/* @__PURE__ */ jsx13(DialogTitle, {
|
|
1937
1610
|
className: "sr-only",
|
|
1938
1611
|
children: current.alt || `Image ${currentIndex + 1} of ${images.length}`
|
|
1939
1612
|
}),
|
|
1940
|
-
/* @__PURE__ */
|
|
1613
|
+
/* @__PURE__ */ jsxs8("div", {
|
|
1941
1614
|
className: "relative flex items-center justify-center",
|
|
1942
1615
|
children: [
|
|
1943
|
-
/* @__PURE__ */
|
|
1616
|
+
/* @__PURE__ */ jsx13("img", {
|
|
1944
1617
|
src: current.url,
|
|
1945
1618
|
alt: current.alt || "Image preview",
|
|
1946
1619
|
className: "max-h-[85vh] max-w-full object-contain rounded-md"
|
|
1947
1620
|
}),
|
|
1948
|
-
hasMultiple && /* @__PURE__ */
|
|
1621
|
+
hasMultiple && /* @__PURE__ */ jsxs8(Fragment2, {
|
|
1949
1622
|
children: [
|
|
1950
|
-
/* @__PURE__ */
|
|
1623
|
+
/* @__PURE__ */ jsxs8("button", {
|
|
1951
1624
|
type: "button",
|
|
1952
1625
|
onClick: goPrev,
|
|
1953
1626
|
className: cn("absolute left-2 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white", "hover:bg-black/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors"),
|
|
1954
1627
|
children: [
|
|
1955
|
-
/* @__PURE__ */
|
|
1628
|
+
/* @__PURE__ */ jsx13(ChevronLeft, {
|
|
1956
1629
|
className: "h-5 w-5"
|
|
1957
1630
|
}),
|
|
1958
|
-
/* @__PURE__ */
|
|
1631
|
+
/* @__PURE__ */ jsx13("span", {
|
|
1959
1632
|
className: "sr-only",
|
|
1960
1633
|
children: "Previous image"
|
|
1961
1634
|
})
|
|
1962
1635
|
]
|
|
1963
1636
|
}),
|
|
1964
|
-
/* @__PURE__ */
|
|
1637
|
+
/* @__PURE__ */ jsxs8("button", {
|
|
1965
1638
|
type: "button",
|
|
1966
1639
|
onClick: goNext,
|
|
1967
1640
|
className: cn("absolute right-2 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white", "hover:bg-black/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors"),
|
|
1968
1641
|
children: [
|
|
1969
|
-
/* @__PURE__ */
|
|
1642
|
+
/* @__PURE__ */ jsx13(ChevronRight, {
|
|
1970
1643
|
className: "h-5 w-5"
|
|
1971
1644
|
}),
|
|
1972
|
-
/* @__PURE__ */
|
|
1645
|
+
/* @__PURE__ */ jsx13("span", {
|
|
1973
1646
|
className: "sr-only",
|
|
1974
1647
|
children: "Next image"
|
|
1975
1648
|
})
|
|
1976
1649
|
]
|
|
1977
1650
|
}),
|
|
1978
|
-
/* @__PURE__ */
|
|
1651
|
+
/* @__PURE__ */ jsxs8("div", {
|
|
1979
1652
|
className: "absolute bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-black/50 px-3 py-1 text-xs text-white",
|
|
1980
1653
|
children: [
|
|
1981
1654
|
currentIndex + 1,
|
|
@@ -2007,37 +1680,37 @@ function useAgnoMessageContext() {
|
|
|
2007
1680
|
import { Lightbulb } from "lucide-react";
|
|
2008
1681
|
|
|
2009
1682
|
// src/ui/primitives/accordion.tsx
|
|
2010
|
-
import * as
|
|
1683
|
+
import * as React6 from "react";
|
|
2011
1684
|
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
2012
1685
|
import { ChevronDown } from "lucide-react";
|
|
2013
|
-
import { jsx as
|
|
1686
|
+
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2014
1687
|
var Accordion = AccordionPrimitive.Root;
|
|
2015
|
-
var AccordionItem =
|
|
1688
|
+
var AccordionItem = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx14(AccordionPrimitive.Item, {
|
|
2016
1689
|
ref,
|
|
2017
1690
|
className: cn("border-b", className),
|
|
2018
1691
|
...props
|
|
2019
1692
|
}));
|
|
2020
1693
|
AccordionItem.displayName = "AccordionItem";
|
|
2021
|
-
var AccordionTrigger =
|
|
1694
|
+
var AccordionTrigger = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx14(AccordionPrimitive.Header, {
|
|
2022
1695
|
className: "flex",
|
|
2023
|
-
children: /* @__PURE__ */
|
|
1696
|
+
children: /* @__PURE__ */ jsxs9(AccordionPrimitive.Trigger, {
|
|
2024
1697
|
ref,
|
|
2025
1698
|
className: cn("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180", className),
|
|
2026
1699
|
...props,
|
|
2027
1700
|
children: [
|
|
2028
1701
|
children,
|
|
2029
|
-
/* @__PURE__ */
|
|
1702
|
+
/* @__PURE__ */ jsx14(ChevronDown, {
|
|
2030
1703
|
className: "h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"
|
|
2031
1704
|
})
|
|
2032
1705
|
]
|
|
2033
1706
|
})
|
|
2034
1707
|
}));
|
|
2035
1708
|
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
|
|
2036
|
-
var AccordionContent =
|
|
1709
|
+
var AccordionContent = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx14(AccordionPrimitive.Content, {
|
|
2037
1710
|
ref,
|
|
2038
1711
|
className: "overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
|
|
2039
1712
|
...props,
|
|
2040
|
-
children: /* @__PURE__ */
|
|
1713
|
+
children: /* @__PURE__ */ jsx14("div", {
|
|
2041
1714
|
className: cn("pb-4 pt-0", className),
|
|
2042
1715
|
children
|
|
2043
1716
|
})
|
|
@@ -2045,19 +1718,19 @@ var AccordionContent = React7.forwardRef(({ className, children, ...props }, ref
|
|
|
2045
1718
|
AccordionContent.displayName = AccordionPrimitive.Content.displayName;
|
|
2046
1719
|
|
|
2047
1720
|
// src/ui/composed/agno-message/reasoning.tsx
|
|
2048
|
-
import { jsx as
|
|
1721
|
+
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2049
1722
|
function AgnoMessageReasoning() {
|
|
2050
1723
|
const { message, classNames } = useAgnoMessageContext();
|
|
2051
1724
|
const steps = message.extra_data?.reasoning_steps;
|
|
2052
1725
|
if (!steps || steps.length === 0)
|
|
2053
1726
|
return null;
|
|
2054
|
-
return /* @__PURE__ */
|
|
1727
|
+
return /* @__PURE__ */ jsxs10("div", {
|
|
2055
1728
|
className: cn("space-y-2 pt-1", classNames?.assistant?.reasoning),
|
|
2056
1729
|
children: [
|
|
2057
|
-
/* @__PURE__ */
|
|
1730
|
+
/* @__PURE__ */ jsxs10("div", {
|
|
2058
1731
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2059
1732
|
children: [
|
|
2060
|
-
/* @__PURE__ */
|
|
1733
|
+
/* @__PURE__ */ jsx15(Lightbulb, {
|
|
2061
1734
|
className: "h-3.5 w-3.5"
|
|
2062
1735
|
}),
|
|
2063
1736
|
"Reasoning (",
|
|
@@ -2065,23 +1738,23 @@ function AgnoMessageReasoning() {
|
|
|
2065
1738
|
" steps)"
|
|
2066
1739
|
]
|
|
2067
1740
|
}),
|
|
2068
|
-
/* @__PURE__ */
|
|
1741
|
+
/* @__PURE__ */ jsx15(Accordion, {
|
|
2069
1742
|
type: "multiple",
|
|
2070
1743
|
className: "w-full",
|
|
2071
|
-
children: steps.map((step, idx) => /* @__PURE__ */
|
|
1744
|
+
children: steps.map((step, idx) => /* @__PURE__ */ jsxs10(AccordionItem, {
|
|
2072
1745
|
value: `reasoning-${idx}`,
|
|
2073
1746
|
className: "border-muted",
|
|
2074
1747
|
children: [
|
|
2075
|
-
/* @__PURE__ */
|
|
1748
|
+
/* @__PURE__ */ jsx15(AccordionTrigger, {
|
|
2076
1749
|
className: "text-xs py-1.5 hover:no-underline",
|
|
2077
1750
|
children: step.title || `Step ${idx + 1}`
|
|
2078
1751
|
}),
|
|
2079
|
-
/* @__PURE__ */
|
|
1752
|
+
/* @__PURE__ */ jsxs10(AccordionContent, {
|
|
2080
1753
|
className: "space-y-1.5 text-xs text-muted-foreground",
|
|
2081
1754
|
children: [
|
|
2082
|
-
step.action && /* @__PURE__ */
|
|
1755
|
+
step.action && /* @__PURE__ */ jsxs10("div", {
|
|
2083
1756
|
children: [
|
|
2084
|
-
/* @__PURE__ */
|
|
1757
|
+
/* @__PURE__ */ jsx15("span", {
|
|
2085
1758
|
className: "font-medium text-foreground",
|
|
2086
1759
|
children: "Action:"
|
|
2087
1760
|
}),
|
|
@@ -2089,9 +1762,9 @@ function AgnoMessageReasoning() {
|
|
|
2089
1762
|
step.action
|
|
2090
1763
|
]
|
|
2091
1764
|
}),
|
|
2092
|
-
step.reasoning && /* @__PURE__ */
|
|
1765
|
+
step.reasoning && /* @__PURE__ */ jsxs10("div", {
|
|
2093
1766
|
children: [
|
|
2094
|
-
/* @__PURE__ */
|
|
1767
|
+
/* @__PURE__ */ jsx15("span", {
|
|
2095
1768
|
className: "font-medium text-foreground",
|
|
2096
1769
|
children: "Reasoning:"
|
|
2097
1770
|
}),
|
|
@@ -2099,9 +1772,9 @@ function AgnoMessageReasoning() {
|
|
|
2099
1772
|
step.reasoning
|
|
2100
1773
|
]
|
|
2101
1774
|
}),
|
|
2102
|
-
step.result && /* @__PURE__ */
|
|
1775
|
+
step.result && /* @__PURE__ */ jsxs10("div", {
|
|
2103
1776
|
children: [
|
|
2104
|
-
/* @__PURE__ */
|
|
1777
|
+
/* @__PURE__ */ jsx15("span", {
|
|
2105
1778
|
className: "font-medium text-foreground",
|
|
2106
1779
|
children: "Result:"
|
|
2107
1780
|
}),
|
|
@@ -2109,9 +1782,9 @@ function AgnoMessageReasoning() {
|
|
|
2109
1782
|
step.result
|
|
2110
1783
|
]
|
|
2111
1784
|
}),
|
|
2112
|
-
step.confidence !== undefined && /* @__PURE__ */
|
|
1785
|
+
step.confidence !== undefined && /* @__PURE__ */ jsxs10("div", {
|
|
2113
1786
|
children: [
|
|
2114
|
-
/* @__PURE__ */
|
|
1787
|
+
/* @__PURE__ */ jsx15("span", {
|
|
2115
1788
|
className: "font-medium text-foreground",
|
|
2116
1789
|
children: "Confidence:"
|
|
2117
1790
|
}),
|
|
@@ -2131,7 +1804,7 @@ function AgnoMessageReasoning() {
|
|
|
2131
1804
|
|
|
2132
1805
|
// src/ui/composed/agno-message/media.tsx
|
|
2133
1806
|
import { FileIcon as FileIcon3, Image as ImageIcon, Music, Paperclip, Video } from "lucide-react";
|
|
2134
|
-
import { jsx as
|
|
1807
|
+
import { jsx as jsx16, jsxs as jsxs11, Fragment as Fragment3 } from "react/jsx-runtime";
|
|
2135
1808
|
function AgnoMessageMedia() {
|
|
2136
1809
|
const {
|
|
2137
1810
|
message,
|
|
@@ -2149,15 +1822,15 @@ function AgnoMessageMedia() {
|
|
|
2149
1822
|
const hasResponseAudio = !!message.response_audio;
|
|
2150
1823
|
if (!hasImages && !hasVideos && !hasAudio && !hasFiles && !hasResponseAudio)
|
|
2151
1824
|
return null;
|
|
2152
|
-
return /* @__PURE__ */
|
|
1825
|
+
return /* @__PURE__ */ jsxs11(Fragment3, {
|
|
2153
1826
|
children: [
|
|
2154
|
-
hasImages && /* @__PURE__ */
|
|
1827
|
+
hasImages && /* @__PURE__ */ jsxs11("div", {
|
|
2155
1828
|
className: cn("space-y-2 pt-1", mediaClassName),
|
|
2156
1829
|
children: [
|
|
2157
|
-
/* @__PURE__ */
|
|
1830
|
+
/* @__PURE__ */ jsxs11("div", {
|
|
2158
1831
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2159
1832
|
children: [
|
|
2160
|
-
/* @__PURE__ */
|
|
1833
|
+
/* @__PURE__ */ jsx16(ImageIcon, {
|
|
2161
1834
|
className: "h-3.5 w-3.5"
|
|
2162
1835
|
}),
|
|
2163
1836
|
"Images (",
|
|
@@ -2165,26 +1838,26 @@ function AgnoMessageMedia() {
|
|
|
2165
1838
|
")"
|
|
2166
1839
|
]
|
|
2167
1840
|
}),
|
|
2168
|
-
/* @__PURE__ */
|
|
1841
|
+
/* @__PURE__ */ jsx16("div", {
|
|
2169
1842
|
className: "grid grid-cols-2 gap-2",
|
|
2170
|
-
children: message.images.map((img, idx) => /* @__PURE__ */
|
|
1843
|
+
children: message.images.map((img, idx) => /* @__PURE__ */ jsxs11("div", {
|
|
2171
1844
|
className: "space-y-1",
|
|
2172
1845
|
children: [
|
|
2173
|
-
showImageLightbox ? /* @__PURE__ */
|
|
1846
|
+
showImageLightbox ? /* @__PURE__ */ jsx16("button", {
|
|
2174
1847
|
type: "button",
|
|
2175
1848
|
onClick: () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx),
|
|
2176
1849
|
className: "group relative w-full overflow-hidden rounded-lg border border-border cursor-pointer hover:border-primary/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors",
|
|
2177
|
-
children: /* @__PURE__ */
|
|
1850
|
+
children: /* @__PURE__ */ jsx16("img", {
|
|
2178
1851
|
src: img.url,
|
|
2179
1852
|
alt: img.revised_prompt || "Generated image",
|
|
2180
1853
|
className: "w-full rounded-lg"
|
|
2181
1854
|
})
|
|
2182
|
-
}) : /* @__PURE__ */
|
|
1855
|
+
}) : /* @__PURE__ */ jsx16("img", {
|
|
2183
1856
|
src: img.url,
|
|
2184
1857
|
alt: img.revised_prompt || "Generated image",
|
|
2185
1858
|
className: "w-full rounded-lg border border-border"
|
|
2186
1859
|
}),
|
|
2187
|
-
img.revised_prompt && /* @__PURE__ */
|
|
1860
|
+
img.revised_prompt && /* @__PURE__ */ jsx16("p", {
|
|
2188
1861
|
className: "text-[11px] text-muted-foreground italic px-0.5",
|
|
2189
1862
|
children: img.revised_prompt
|
|
2190
1863
|
})
|
|
@@ -2193,13 +1866,13 @@ function AgnoMessageMedia() {
|
|
|
2193
1866
|
})
|
|
2194
1867
|
]
|
|
2195
1868
|
}),
|
|
2196
|
-
hasVideos && /* @__PURE__ */
|
|
1869
|
+
hasVideos && /* @__PURE__ */ jsxs11("div", {
|
|
2197
1870
|
className: cn("space-y-2 pt-1", mediaClassName),
|
|
2198
1871
|
children: [
|
|
2199
|
-
/* @__PURE__ */
|
|
1872
|
+
/* @__PURE__ */ jsxs11("div", {
|
|
2200
1873
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2201
1874
|
children: [
|
|
2202
|
-
/* @__PURE__ */
|
|
1875
|
+
/* @__PURE__ */ jsx16(Video, {
|
|
2203
1876
|
className: "h-3.5 w-3.5"
|
|
2204
1877
|
}),
|
|
2205
1878
|
"Videos (",
|
|
@@ -2207,14 +1880,14 @@ function AgnoMessageMedia() {
|
|
|
2207
1880
|
")"
|
|
2208
1881
|
]
|
|
2209
1882
|
}),
|
|
2210
|
-
/* @__PURE__ */
|
|
1883
|
+
/* @__PURE__ */ jsx16("div", {
|
|
2211
1884
|
className: "space-y-2",
|
|
2212
|
-
children: message.videos.map((video, idx) => /* @__PURE__ */
|
|
2213
|
-
children: video.url ? /* @__PURE__ */
|
|
1885
|
+
children: message.videos.map((video, idx) => /* @__PURE__ */ jsx16("div", {
|
|
1886
|
+
children: video.url ? /* @__PURE__ */ jsx16("video", {
|
|
2214
1887
|
src: video.url,
|
|
2215
1888
|
controls: true,
|
|
2216
1889
|
className: "w-full rounded-lg border border-border"
|
|
2217
|
-
}) : /* @__PURE__ */
|
|
1890
|
+
}) : /* @__PURE__ */ jsxs11("div", {
|
|
2218
1891
|
className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
|
|
2219
1892
|
children: [
|
|
2220
1893
|
"Video ID: ",
|
|
@@ -2228,13 +1901,13 @@ function AgnoMessageMedia() {
|
|
|
2228
1901
|
})
|
|
2229
1902
|
]
|
|
2230
1903
|
}),
|
|
2231
|
-
hasAudio && /* @__PURE__ */
|
|
1904
|
+
hasAudio && /* @__PURE__ */ jsxs11("div", {
|
|
2232
1905
|
className: cn("space-y-2 pt-1", mediaClassName),
|
|
2233
1906
|
children: [
|
|
2234
|
-
/* @__PURE__ */
|
|
1907
|
+
/* @__PURE__ */ jsxs11("div", {
|
|
2235
1908
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2236
1909
|
children: [
|
|
2237
|
-
/* @__PURE__ */
|
|
1910
|
+
/* @__PURE__ */ jsx16(Music, {
|
|
2238
1911
|
className: "h-3.5 w-3.5"
|
|
2239
1912
|
}),
|
|
2240
1913
|
"Audio (",
|
|
@@ -2242,18 +1915,18 @@ function AgnoMessageMedia() {
|
|
|
2242
1915
|
")"
|
|
2243
1916
|
]
|
|
2244
1917
|
}),
|
|
2245
|
-
/* @__PURE__ */
|
|
1918
|
+
/* @__PURE__ */ jsx16("div", {
|
|
2246
1919
|
className: "space-y-2",
|
|
2247
|
-
children: message.audio.map((audio, idx) => /* @__PURE__ */
|
|
2248
|
-
children: audio.url ? /* @__PURE__ */
|
|
1920
|
+
children: message.audio.map((audio, idx) => /* @__PURE__ */ jsx16("div", {
|
|
1921
|
+
children: audio.url ? /* @__PURE__ */ jsx16("audio", {
|
|
2249
1922
|
src: audio.url,
|
|
2250
1923
|
controls: true,
|
|
2251
1924
|
className: "w-full"
|
|
2252
|
-
}) : audio.base64_audio ? /* @__PURE__ */
|
|
1925
|
+
}) : audio.base64_audio ? /* @__PURE__ */ jsx16("audio", {
|
|
2253
1926
|
src: `data:${audio.mime_type || "audio/wav"};base64,${audio.base64_audio}`,
|
|
2254
1927
|
controls: true,
|
|
2255
1928
|
className: "w-full"
|
|
2256
|
-
}) : /* @__PURE__ */
|
|
1929
|
+
}) : /* @__PURE__ */ jsx16("div", {
|
|
2257
1930
|
className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
|
|
2258
1931
|
children: "Audio data unavailable"
|
|
2259
1932
|
})
|
|
@@ -2261,13 +1934,13 @@ function AgnoMessageMedia() {
|
|
|
2261
1934
|
})
|
|
2262
1935
|
]
|
|
2263
1936
|
}),
|
|
2264
|
-
hasFiles && /* @__PURE__ */
|
|
1937
|
+
hasFiles && /* @__PURE__ */ jsxs11("div", {
|
|
2265
1938
|
className: cn("space-y-2 pt-1", mediaClassName),
|
|
2266
1939
|
children: [
|
|
2267
|
-
/* @__PURE__ */
|
|
1940
|
+
/* @__PURE__ */ jsxs11("div", {
|
|
2268
1941
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2269
1942
|
children: [
|
|
2270
|
-
/* @__PURE__ */
|
|
1943
|
+
/* @__PURE__ */ jsx16(Paperclip, {
|
|
2271
1944
|
className: "h-3.5 w-3.5"
|
|
2272
1945
|
}),
|
|
2273
1946
|
"Files (",
|
|
@@ -2275,22 +1948,22 @@ function AgnoMessageMedia() {
|
|
|
2275
1948
|
")"
|
|
2276
1949
|
]
|
|
2277
1950
|
}),
|
|
2278
|
-
/* @__PURE__ */
|
|
1951
|
+
/* @__PURE__ */ jsx16("div", {
|
|
2279
1952
|
className: "flex flex-wrap gap-2",
|
|
2280
|
-
children: message.files.map((file, idx) => showFilePreview ? /* @__PURE__ */
|
|
1953
|
+
children: message.files.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx16(FilePreviewCard, {
|
|
2281
1954
|
file: { name: file.name, type: file.type, url: file.url, size: file.size },
|
|
2282
1955
|
onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
|
|
2283
|
-
}, idx) : /* @__PURE__ */
|
|
1956
|
+
}, idx) : /* @__PURE__ */ jsxs11("div", {
|
|
2284
1957
|
className: "flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-xs bg-muted/30 hover:bg-muted/50 transition-colors",
|
|
2285
1958
|
children: [
|
|
2286
|
-
/* @__PURE__ */
|
|
1959
|
+
/* @__PURE__ */ jsx16(FileIcon3, {
|
|
2287
1960
|
className: "h-3.5 w-3.5 shrink-0 text-muted-foreground"
|
|
2288
1961
|
}),
|
|
2289
|
-
/* @__PURE__ */
|
|
1962
|
+
/* @__PURE__ */ jsx16("span", {
|
|
2290
1963
|
className: "truncate max-w-[180px]",
|
|
2291
1964
|
children: file.name
|
|
2292
1965
|
}),
|
|
2293
|
-
file.size && /* @__PURE__ */
|
|
1966
|
+
file.size && /* @__PURE__ */ jsxs11("span", {
|
|
2294
1967
|
className: "text-muted-foreground/70",
|
|
2295
1968
|
children: [
|
|
2296
1969
|
"(",
|
|
@@ -2298,7 +1971,7 @@ function AgnoMessageMedia() {
|
|
|
2298
1971
|
"KB)"
|
|
2299
1972
|
]
|
|
2300
1973
|
}),
|
|
2301
|
-
file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */
|
|
1974
|
+
file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */ jsx16("a", {
|
|
2302
1975
|
href: file.url,
|
|
2303
1976
|
target: "_blank",
|
|
2304
1977
|
rel: "noopener noreferrer",
|
|
@@ -2310,19 +1983,19 @@ function AgnoMessageMedia() {
|
|
|
2310
1983
|
})
|
|
2311
1984
|
]
|
|
2312
1985
|
}),
|
|
2313
|
-
hasResponseAudio && message.response_audio && /* @__PURE__ */
|
|
1986
|
+
hasResponseAudio && message.response_audio && /* @__PURE__ */ jsxs11("div", {
|
|
2314
1987
|
className: cn("space-y-2 pt-1", mediaClassName),
|
|
2315
1988
|
children: [
|
|
2316
|
-
/* @__PURE__ */
|
|
1989
|
+
/* @__PURE__ */ jsxs11("div", {
|
|
2317
1990
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2318
1991
|
children: [
|
|
2319
|
-
/* @__PURE__ */
|
|
1992
|
+
/* @__PURE__ */ jsx16(Music, {
|
|
2320
1993
|
className: "h-3.5 w-3.5"
|
|
2321
1994
|
}),
|
|
2322
1995
|
"Response Audio"
|
|
2323
1996
|
]
|
|
2324
1997
|
}),
|
|
2325
|
-
message.response_audio.transcript && /* @__PURE__ */
|
|
1998
|
+
message.response_audio.transcript && /* @__PURE__ */ jsxs11("div", {
|
|
2326
1999
|
className: "text-xs italic bg-muted/50 border border-border p-2.5 rounded-lg text-muted-foreground",
|
|
2327
2000
|
children: [
|
|
2328
2001
|
'"',
|
|
@@ -2330,7 +2003,7 @@ function AgnoMessageMedia() {
|
|
|
2330
2003
|
'"'
|
|
2331
2004
|
]
|
|
2332
2005
|
}),
|
|
2333
|
-
message.response_audio.content && /* @__PURE__ */
|
|
2006
|
+
message.response_audio.content && /* @__PURE__ */ jsx16("audio", {
|
|
2334
2007
|
src: `data:audio/wav;base64,${message.response_audio.content}`,
|
|
2335
2008
|
controls: true,
|
|
2336
2009
|
className: "w-full"
|
|
@@ -2353,31 +2026,24 @@ function useAgnoChatContext() {
|
|
|
2353
2026
|
}
|
|
2354
2027
|
|
|
2355
2028
|
// src/ui/composed/agno-message/tools.tsx
|
|
2356
|
-
import { jsx as
|
|
2029
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2357
2030
|
function AgnoMessageTools({ renderTool: renderToolProp } = {}) {
|
|
2358
2031
|
const { message, classNames, renderTool: ctxMsgRenderTool } = useAgnoMessageContext();
|
|
2359
2032
|
const { renderTool: ctxChatRenderTool, isDebug } = useAgnoChatContext();
|
|
2360
2033
|
const renderTool = renderToolProp ?? ctxMsgRenderTool ?? ctxChatRenderTool;
|
|
2361
2034
|
if (!message.tool_calls || message.tool_calls.length === 0)
|
|
2362
2035
|
return null;
|
|
2363
|
-
return /* @__PURE__ */
|
|
2036
|
+
return /* @__PURE__ */ jsx17("div", {
|
|
2364
2037
|
className: cn("space-y-2 pt-1", classNames?.assistant?.toolCalls),
|
|
2365
2038
|
children: message.tool_calls.map((tool, idx) => {
|
|
2366
|
-
const defaultRender = () => /* @__PURE__ */
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
}),
|
|
2371
|
-
isDebug ? /* @__PURE__ */ jsx19(ToolDebugCard, {
|
|
2372
|
-
tool,
|
|
2373
|
-
defaultOpen: idx === 0
|
|
2374
|
-
}) : null
|
|
2375
|
-
]
|
|
2376
|
-
});
|
|
2039
|
+
const defaultRender = () => isDebug ? /* @__PURE__ */ jsx17(ToolDebugCard, {
|
|
2040
|
+
tool,
|
|
2041
|
+
defaultOpen: idx === 0
|
|
2042
|
+
}) : null;
|
|
2377
2043
|
const node = renderTool ? renderTool(tool, { index: idx, isDebug, defaultRender }) : defaultRender();
|
|
2378
2044
|
if (node === null || node === undefined)
|
|
2379
2045
|
return null;
|
|
2380
|
-
return /* @__PURE__ */
|
|
2046
|
+
return /* @__PURE__ */ jsx17("div", {
|
|
2381
2047
|
children: node
|
|
2382
2048
|
}, tool.tool_call_id || idx);
|
|
2383
2049
|
})
|
|
@@ -2387,22 +2053,22 @@ function AgnoMessageTools({ renderTool: renderToolProp } = {}) {
|
|
|
2387
2053
|
// src/ui/components/response.tsx
|
|
2388
2054
|
import { memo } from "react";
|
|
2389
2055
|
import { Streamdown } from "streamdown";
|
|
2390
|
-
import { jsx as
|
|
2391
|
-
var Response = memo(({ className, ...props }) => /* @__PURE__ */
|
|
2056
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
2057
|
+
var Response = memo(({ className, ...props }) => /* @__PURE__ */ jsx18(Streamdown, {
|
|
2392
2058
|
className: cn("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", className),
|
|
2393
2059
|
...props
|
|
2394
2060
|
}), (prevProps, nextProps) => prevProps.children === nextProps.children);
|
|
2395
2061
|
Response.displayName = "Response";
|
|
2396
2062
|
|
|
2397
2063
|
// src/ui/composed/agno-message/content.tsx
|
|
2398
|
-
import { jsx as
|
|
2064
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
2399
2065
|
function AgnoMessageContent() {
|
|
2400
2066
|
const { message } = useAgnoMessageContext();
|
|
2401
2067
|
if (!message.content)
|
|
2402
2068
|
return null;
|
|
2403
|
-
return /* @__PURE__ */
|
|
2069
|
+
return /* @__PURE__ */ jsx19("div", {
|
|
2404
2070
|
className: "prose prose-sm dark:prose-invert max-w-none prose-p:leading-relaxed prose-pre:bg-muted prose-pre:border prose-pre:border-border",
|
|
2405
|
-
children: /* @__PURE__ */
|
|
2071
|
+
children: /* @__PURE__ */ jsx19(Response, {
|
|
2406
2072
|
children: message.content
|
|
2407
2073
|
})
|
|
2408
2074
|
});
|
|
@@ -2410,19 +2076,19 @@ function AgnoMessageContent() {
|
|
|
2410
2076
|
|
|
2411
2077
|
// src/ui/composed/agno-message/references.tsx
|
|
2412
2078
|
import { FileText } from "lucide-react";
|
|
2413
|
-
import { jsx as
|
|
2079
|
+
import { jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2414
2080
|
function AgnoMessageReferences() {
|
|
2415
2081
|
const { message, classNames } = useAgnoMessageContext();
|
|
2416
2082
|
const references = message.extra_data?.references;
|
|
2417
2083
|
if (!references || references.length === 0)
|
|
2418
2084
|
return null;
|
|
2419
|
-
return /* @__PURE__ */
|
|
2085
|
+
return /* @__PURE__ */ jsxs12("div", {
|
|
2420
2086
|
className: cn("space-y-2 pt-1", classNames?.assistant?.references),
|
|
2421
2087
|
children: [
|
|
2422
|
-
/* @__PURE__ */
|
|
2088
|
+
/* @__PURE__ */ jsxs12("div", {
|
|
2423
2089
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2424
2090
|
children: [
|
|
2425
|
-
/* @__PURE__ */
|
|
2091
|
+
/* @__PURE__ */ jsx20(FileText, {
|
|
2426
2092
|
className: "h-3.5 w-3.5"
|
|
2427
2093
|
}),
|
|
2428
2094
|
"References (",
|
|
@@ -2430,22 +2096,22 @@ function AgnoMessageReferences() {
|
|
|
2430
2096
|
")"
|
|
2431
2097
|
]
|
|
2432
2098
|
}),
|
|
2433
|
-
/* @__PURE__ */
|
|
2099
|
+
/* @__PURE__ */ jsx20("div", {
|
|
2434
2100
|
className: "space-y-2",
|
|
2435
|
-
children: references.map((refData, idx) => /* @__PURE__ */
|
|
2101
|
+
children: references.map((refData, idx) => /* @__PURE__ */ jsxs12("div", {
|
|
2436
2102
|
className: "text-xs space-y-1.5",
|
|
2437
2103
|
children: [
|
|
2438
|
-
refData.query && /* @__PURE__ */
|
|
2104
|
+
refData.query && /* @__PURE__ */ jsxs12("div", {
|
|
2439
2105
|
className: "font-medium text-foreground",
|
|
2440
2106
|
children: [
|
|
2441
2107
|
"Query: ",
|
|
2442
2108
|
refData.query
|
|
2443
2109
|
]
|
|
2444
2110
|
}),
|
|
2445
|
-
refData.references.map((ref, refIdx) => /* @__PURE__ */
|
|
2111
|
+
refData.references.map((ref, refIdx) => /* @__PURE__ */ jsxs12("div", {
|
|
2446
2112
|
className: "bg-muted/50 border border-border p-2.5 rounded-lg",
|
|
2447
2113
|
children: [
|
|
2448
|
-
/* @__PURE__ */
|
|
2114
|
+
/* @__PURE__ */ jsxs12("div", {
|
|
2449
2115
|
className: "italic text-muted-foreground mb-1",
|
|
2450
2116
|
children: [
|
|
2451
2117
|
'"',
|
|
@@ -2453,7 +2119,7 @@ function AgnoMessageReferences() {
|
|
|
2453
2119
|
'"'
|
|
2454
2120
|
]
|
|
2455
2121
|
}),
|
|
2456
|
-
/* @__PURE__ */
|
|
2122
|
+
/* @__PURE__ */ jsxs12("div", {
|
|
2457
2123
|
className: "text-muted-foreground/70",
|
|
2458
2124
|
children: [
|
|
2459
2125
|
"Source: ",
|
|
@@ -2476,7 +2142,7 @@ function AgnoMessageReferences() {
|
|
|
2476
2142
|
|
|
2477
2143
|
// src/ui/composed/agno-message/footer.tsx
|
|
2478
2144
|
import { AlertCircle } from "lucide-react";
|
|
2479
|
-
import { jsx as
|
|
2145
|
+
import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2480
2146
|
function AgnoMessageFooter({ showTimestamp = true } = {}) {
|
|
2481
2147
|
const { message, classNames, actions, isLastAssistantMessage, formatTimestamp } = useAgnoMessageContext();
|
|
2482
2148
|
const hasError = message.streamingError;
|
|
@@ -2484,7 +2150,7 @@ function AgnoMessageFooter({ showTimestamp = true } = {}) {
|
|
|
2484
2150
|
const resolvedFormatTimestamp = formatTimestamp ?? formatSmartTimestamp;
|
|
2485
2151
|
if (!actions?.assistant && !showTimestamp && !hasError)
|
|
2486
2152
|
return null;
|
|
2487
|
-
return /* @__PURE__ */
|
|
2153
|
+
return /* @__PURE__ */ jsxs13("div", {
|
|
2488
2154
|
className: "flex items-center gap-2 pt-1",
|
|
2489
2155
|
children: [
|
|
2490
2156
|
actions?.assistant && (() => {
|
|
@@ -2492,21 +2158,21 @@ function AgnoMessageFooter({ showTimestamp = true } = {}) {
|
|
|
2492
2158
|
if (visibility === "last-assistant" && !isLastAssistantMessage)
|
|
2493
2159
|
return null;
|
|
2494
2160
|
const useHover = visibility === "hover" || visibility === "hover-last-visible" && !isLastAssistantMessage;
|
|
2495
|
-
return /* @__PURE__ */
|
|
2161
|
+
return /* @__PURE__ */ jsx21("div", {
|
|
2496
2162
|
className: cn("flex items-center gap-1 transition-opacity", useHover && "opacity-0 group-hover/message:opacity-100", classNames?.assistant?.actions),
|
|
2497
2163
|
children: actions.assistant(message)
|
|
2498
2164
|
});
|
|
2499
2165
|
})(),
|
|
2500
|
-
hasError && /* @__PURE__ */
|
|
2166
|
+
hasError && /* @__PURE__ */ jsxs13("span", {
|
|
2501
2167
|
className: "flex items-center gap-1 text-[11px] text-destructive",
|
|
2502
2168
|
children: [
|
|
2503
|
-
/* @__PURE__ */
|
|
2169
|
+
/* @__PURE__ */ jsx21(AlertCircle, {
|
|
2504
2170
|
className: "h-3 w-3"
|
|
2505
2171
|
}),
|
|
2506
2172
|
"Error"
|
|
2507
2173
|
]
|
|
2508
2174
|
}),
|
|
2509
|
-
showTimestamp && /* @__PURE__ */
|
|
2175
|
+
showTimestamp && /* @__PURE__ */ jsx21(SmartTimestamp, {
|
|
2510
2176
|
date: new Date(message.created_at * 1000),
|
|
2511
2177
|
formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
|
|
2512
2178
|
className: "text-[11px] text-muted-foreground"
|
|
@@ -2516,16 +2182,16 @@ function AgnoMessageFooter({ showTimestamp = true } = {}) {
|
|
|
2516
2182
|
}
|
|
2517
2183
|
|
|
2518
2184
|
// src/ui/composed/agno-message/message.tsx
|
|
2519
|
-
import { jsx as
|
|
2185
|
+
import { jsx as jsx22, jsxs as jsxs14, Fragment as Fragment4 } from "react/jsx-runtime";
|
|
2520
2186
|
function DefaultAssistantComposition({ showTimestamp }) {
|
|
2521
|
-
return /* @__PURE__ */
|
|
2187
|
+
return /* @__PURE__ */ jsxs14(Fragment4, {
|
|
2522
2188
|
children: [
|
|
2523
|
-
/* @__PURE__ */
|
|
2524
|
-
/* @__PURE__ */
|
|
2525
|
-
/* @__PURE__ */
|
|
2526
|
-
/* @__PURE__ */
|
|
2527
|
-
/* @__PURE__ */
|
|
2528
|
-
/* @__PURE__ */
|
|
2189
|
+
/* @__PURE__ */ jsx22(AgnoMessageReasoning, {}),
|
|
2190
|
+
/* @__PURE__ */ jsx22(AgnoMessageMedia, {}),
|
|
2191
|
+
/* @__PURE__ */ jsx22(AgnoMessageTools, {}),
|
|
2192
|
+
/* @__PURE__ */ jsx22(AgnoMessageContent, {}),
|
|
2193
|
+
/* @__PURE__ */ jsx22(AgnoMessageReferences, {}),
|
|
2194
|
+
/* @__PURE__ */ jsx22(AgnoMessageFooter, {
|
|
2529
2195
|
showTimestamp
|
|
2530
2196
|
})
|
|
2531
2197
|
]
|
|
@@ -2582,12 +2248,12 @@ function AgnoMessage({
|
|
|
2582
2248
|
renderTool
|
|
2583
2249
|
]);
|
|
2584
2250
|
const closePreview = () => setPreview(null);
|
|
2585
|
-
return /* @__PURE__ */
|
|
2251
|
+
return /* @__PURE__ */ jsx22(AgnoMessageContext.Provider, {
|
|
2586
2252
|
value: ctx,
|
|
2587
|
-
children: /* @__PURE__ */
|
|
2253
|
+
children: /* @__PURE__ */ jsxs14("div", {
|
|
2588
2254
|
className: cn("py-5 first:pt-2", isUser ? "flex justify-end" : "", classNames?.root, className),
|
|
2589
2255
|
children: [
|
|
2590
|
-
isUser ? /* @__PURE__ */
|
|
2256
|
+
isUser ? /* @__PURE__ */ jsx22(UserMessageLayout, {
|
|
2591
2257
|
message,
|
|
2592
2258
|
classNames,
|
|
2593
2259
|
avatars,
|
|
@@ -2600,19 +2266,19 @@ function AgnoMessage({
|
|
|
2600
2266
|
openImageLightbox: ctx.openImageLightbox,
|
|
2601
2267
|
openFilePreview: ctx.openFilePreview,
|
|
2602
2268
|
hasError
|
|
2603
|
-
}) : /* @__PURE__ */
|
|
2269
|
+
}) : /* @__PURE__ */ jsxs14("div", {
|
|
2604
2270
|
className: "flex items-start gap-3 group/message",
|
|
2605
2271
|
children: [
|
|
2606
2272
|
avatars?.assistant,
|
|
2607
|
-
/* @__PURE__ */
|
|
2273
|
+
/* @__PURE__ */ jsx22("div", {
|
|
2608
2274
|
className: cn("flex-1 min-w-0 space-y-3", classNames?.assistant?.container),
|
|
2609
|
-
children: children ?? /* @__PURE__ */
|
|
2275
|
+
children: children ?? /* @__PURE__ */ jsx22(DefaultAssistantComposition, {
|
|
2610
2276
|
showTimestamp
|
|
2611
2277
|
})
|
|
2612
2278
|
})
|
|
2613
2279
|
]
|
|
2614
2280
|
}),
|
|
2615
|
-
preview?.type === "image" && /* @__PURE__ */
|
|
2281
|
+
preview?.type === "image" && /* @__PURE__ */ jsx22(ImageLightbox, {
|
|
2616
2282
|
open: true,
|
|
2617
2283
|
onOpenChange: (open) => {
|
|
2618
2284
|
if (!open)
|
|
@@ -2621,7 +2287,7 @@ function AgnoMessage({
|
|
|
2621
2287
|
images: preview.images,
|
|
2622
2288
|
initialIndex: preview.initialIndex
|
|
2623
2289
|
}),
|
|
2624
|
-
preview?.type === "file" && /* @__PURE__ */
|
|
2290
|
+
preview?.type === "file" && /* @__PURE__ */ jsx22(FilePreviewModal, {
|
|
2625
2291
|
open: true,
|
|
2626
2292
|
onOpenChange: (open) => {
|
|
2627
2293
|
if (!open)
|
|
@@ -2653,42 +2319,42 @@ function UserMessageLayout({
|
|
|
2653
2319
|
openFilePreview,
|
|
2654
2320
|
hasError
|
|
2655
2321
|
}) {
|
|
2656
|
-
return /* @__PURE__ */
|
|
2322
|
+
return /* @__PURE__ */ jsxs14("div", {
|
|
2657
2323
|
className: "flex items-start gap-2.5 max-w-[80%] flex-row-reverse",
|
|
2658
2324
|
children: [
|
|
2659
2325
|
avatars?.user,
|
|
2660
|
-
/* @__PURE__ */
|
|
2326
|
+
/* @__PURE__ */ jsxs14("div", {
|
|
2661
2327
|
className: "space-y-1.5 flex flex-col items-end min-w-0",
|
|
2662
2328
|
children: [
|
|
2663
|
-
(message.images && message.images.length > 0 || message.audio && message.audio.length > 0 || message.files && message.files.length > 0) && /* @__PURE__ */
|
|
2329
|
+
(message.images && message.images.length > 0 || message.audio && message.audio.length > 0 || message.files && message.files.length > 0) && /* @__PURE__ */ jsxs14("div", {
|
|
2664
2330
|
className: "flex flex-wrap gap-2 justify-end",
|
|
2665
2331
|
children: [
|
|
2666
|
-
message.images?.map((img, idx) => /* @__PURE__ */
|
|
2332
|
+
message.images?.map((img, idx) => /* @__PURE__ */ jsx22(FilePreviewCard, {
|
|
2667
2333
|
file: { name: img.revised_prompt || `Image ${idx + 1}`, type: "image/png", url: img.url },
|
|
2668
2334
|
onClick: showImageLightbox ? () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx) : undefined
|
|
2669
2335
|
}, `img-${idx}`)),
|
|
2670
|
-
message.audio?.map((audio, idx) => /* @__PURE__ */
|
|
2336
|
+
message.audio?.map((audio, idx) => /* @__PURE__ */ jsxs14("div", {
|
|
2671
2337
|
className: "flex items-center gap-1.5 rounded-lg border border-border bg-muted/50 px-2.5 py-1.5 text-xs text-foreground self-end",
|
|
2672
2338
|
children: [
|
|
2673
|
-
/* @__PURE__ */
|
|
2339
|
+
/* @__PURE__ */ jsx22(Music2, {
|
|
2674
2340
|
className: "h-3.5 w-3.5 text-muted-foreground"
|
|
2675
2341
|
}),
|
|
2676
|
-
/* @__PURE__ */
|
|
2342
|
+
/* @__PURE__ */ jsx22("span", {
|
|
2677
2343
|
className: "truncate max-w-[150px]",
|
|
2678
2344
|
children: audio.id || `Audio ${idx + 1}`
|
|
2679
2345
|
})
|
|
2680
2346
|
]
|
|
2681
2347
|
}, `audio-${idx}`)),
|
|
2682
|
-
message.files?.map((file, idx) => showFilePreview ? /* @__PURE__ */
|
|
2348
|
+
message.files?.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx22(FilePreviewCard, {
|
|
2683
2349
|
file: { name: file.name, type: file.type, url: file.url, size: file.size },
|
|
2684
2350
|
onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
|
|
2685
|
-
}, `file-${idx}`) : /* @__PURE__ */
|
|
2351
|
+
}, `file-${idx}`) : /* @__PURE__ */ jsxs14("div", {
|
|
2686
2352
|
className: "flex items-center gap-1.5 rounded-lg border border-border bg-muted/50 px-2.5 py-1.5 text-xs text-foreground self-end",
|
|
2687
2353
|
children: [
|
|
2688
|
-
/* @__PURE__ */
|
|
2354
|
+
/* @__PURE__ */ jsx22(FileIcon4, {
|
|
2689
2355
|
className: "h-3.5 w-3.5 text-muted-foreground"
|
|
2690
2356
|
}),
|
|
2691
|
-
/* @__PURE__ */
|
|
2357
|
+
/* @__PURE__ */ jsx22("span", {
|
|
2692
2358
|
className: "truncate max-w-[150px]",
|
|
2693
2359
|
children: file.name
|
|
2694
2360
|
})
|
|
@@ -2696,26 +2362,26 @@ function UserMessageLayout({
|
|
|
2696
2362
|
}, `file-${idx}`))
|
|
2697
2363
|
]
|
|
2698
2364
|
}),
|
|
2699
|
-
message.content && /* @__PURE__ */
|
|
2365
|
+
message.content && /* @__PURE__ */ jsx22("div", {
|
|
2700
2366
|
className: cn("rounded-2xl rounded-br-md px-4 py-2.5", classNames?.user?.bubble ?? "bg-primary text-primary-foreground", hasError && "opacity-70"),
|
|
2701
|
-
children: /* @__PURE__ */
|
|
2367
|
+
children: /* @__PURE__ */ jsx22("p", {
|
|
2702
2368
|
className: "text-sm whitespace-pre-wrap",
|
|
2703
2369
|
children: message.content
|
|
2704
2370
|
})
|
|
2705
2371
|
}),
|
|
2706
|
-
(showTimestamp || actions?.user) && /* @__PURE__ */
|
|
2372
|
+
(showTimestamp || actions?.user) && /* @__PURE__ */ jsxs14("div", {
|
|
2707
2373
|
className: "flex items-center justify-end gap-1.5 px-1",
|
|
2708
2374
|
children: [
|
|
2709
|
-
actions?.user && /* @__PURE__ */
|
|
2375
|
+
actions?.user && /* @__PURE__ */ jsx22("div", {
|
|
2710
2376
|
className: "flex items-center gap-1",
|
|
2711
2377
|
children: actions.user(message)
|
|
2712
2378
|
}),
|
|
2713
|
-
/* @__PURE__ */
|
|
2379
|
+
/* @__PURE__ */ jsx22(SmartTimestamp, {
|
|
2714
2380
|
date: new Date(message.created_at * 1000),
|
|
2715
2381
|
formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
|
|
2716
2382
|
className: "text-[11px] text-muted-foreground"
|
|
2717
2383
|
}),
|
|
2718
|
-
hasError && /* @__PURE__ */
|
|
2384
|
+
hasError && /* @__PURE__ */ jsx22(AlertCircle2, {
|
|
2719
2385
|
className: "h-3 w-3 text-destructive"
|
|
2720
2386
|
})
|
|
2721
2387
|
]
|
|
@@ -3561,10 +3227,6 @@ export {
|
|
|
3561
3227
|
resultWithSmartChart,
|
|
3562
3228
|
resultWithCardGrid,
|
|
3563
3229
|
resultWithBarChart,
|
|
3564
|
-
registerChartComponent,
|
|
3565
|
-
getCustomRender,
|
|
3566
|
-
getComponentRegistry,
|
|
3567
|
-
getChartComponent,
|
|
3568
3230
|
createToolResult,
|
|
3569
3231
|
createTable,
|
|
3570
3232
|
createSmartChart,
|
|
@@ -3579,10 +3241,7 @@ export {
|
|
|
3579
3241
|
createAreaChart,
|
|
3580
3242
|
byToolName,
|
|
3581
3243
|
ToolHandlerProvider,
|
|
3582
|
-
ToolGenerativeUI,
|
|
3583
3244
|
ToolDebugCard,
|
|
3584
|
-
GenerativeUIRenderer,
|
|
3585
|
-
ComponentRegistry,
|
|
3586
3245
|
AgnoProvider,
|
|
3587
3246
|
AgnoMessageTools,
|
|
3588
3247
|
AgnoMessageReferences,
|
|
@@ -3594,4 +3253,4 @@ export {
|
|
|
3594
3253
|
AgnoMessage
|
|
3595
3254
|
};
|
|
3596
3255
|
|
|
3597
|
-
//# debugId=
|
|
3256
|
+
//# debugId=D4A0A1768653051B64756E2164756E21
|