@greatapps/greatagents-ui 0.2.0 → 0.2.1
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/dist/index.d.ts +31 -5
- package/dist/index.js +483 -259
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/agents/agent-tabs.tsx +14 -13
- package/src/components/conversations/agent-conversations-panel.tsx +44 -0
- package/src/components/conversations/agent-conversations-table.tsx +160 -0
- package/src/components/conversations/conversation-view.tsx +124 -0
- package/src/index.ts +3 -0
- package/src/pages/agent-detail-page.tsx +3 -4
package/dist/index.js
CHANGED
|
@@ -2395,6 +2395,220 @@ function AgentPromptEditor({ config, agent }) {
|
|
|
2395
2395
|
] });
|
|
2396
2396
|
}
|
|
2397
2397
|
|
|
2398
|
+
// src/components/conversations/agent-conversations-table.tsx
|
|
2399
|
+
import { useState as useState8 } from "react";
|
|
2400
|
+
import {
|
|
2401
|
+
Table,
|
|
2402
|
+
TableBody,
|
|
2403
|
+
TableCell,
|
|
2404
|
+
TableHead,
|
|
2405
|
+
TableHeader,
|
|
2406
|
+
TableRow,
|
|
2407
|
+
Skeleton as Skeleton5,
|
|
2408
|
+
Badge as Badge5
|
|
2409
|
+
} from "@greatapps/greatauth-ui/ui";
|
|
2410
|
+
import { MessageCircle, ExternalLink } from "lucide-react";
|
|
2411
|
+
|
|
2412
|
+
// src/components/conversations/conversation-view.tsx
|
|
2413
|
+
import { Skeleton as Skeleton4, Button as Button7 } from "@greatapps/greatauth-ui/ui";
|
|
2414
|
+
import { X, MessageSquare } from "lucide-react";
|
|
2415
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2416
|
+
function formatDateTime(dateStr) {
|
|
2417
|
+
if (!dateStr) return "\u2014";
|
|
2418
|
+
return new Date(dateStr).toLocaleString("pt-BR");
|
|
2419
|
+
}
|
|
2420
|
+
function ConversationView({
|
|
2421
|
+
conversationId,
|
|
2422
|
+
onClose,
|
|
2423
|
+
contactsMap,
|
|
2424
|
+
config,
|
|
2425
|
+
renderChatLink
|
|
2426
|
+
}) {
|
|
2427
|
+
const { data: conversation, isLoading } = useConversation(config, conversationId);
|
|
2428
|
+
if (isLoading) {
|
|
2429
|
+
return /* @__PURE__ */ jsxs7("div", { className: "rounded-lg border bg-card p-4 space-y-3", children: [
|
|
2430
|
+
/* @__PURE__ */ jsx8(Skeleton4, { className: "h-6 w-48" }),
|
|
2431
|
+
/* @__PURE__ */ jsx8("div", { className: "grid grid-cols-2 gap-3", children: Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsx8(Skeleton4, { className: "h-10 w-full" }, i)) })
|
|
2432
|
+
] });
|
|
2433
|
+
}
|
|
2434
|
+
if (!conversation) {
|
|
2435
|
+
return /* @__PURE__ */ jsx8("div", { className: "rounded-lg border bg-card p-4", children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between", children: [
|
|
2436
|
+
/* @__PURE__ */ jsx8("p", { className: "text-sm text-muted-foreground", children: "Conversa n\xE3o encontrada." }),
|
|
2437
|
+
/* @__PURE__ */ jsx8(Button7, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ jsx8(X, { className: "h-4 w-4" }) })
|
|
2438
|
+
] }) });
|
|
2439
|
+
}
|
|
2440
|
+
return /* @__PURE__ */ jsxs7("div", { className: "rounded-lg border bg-card p-4 space-y-4", children: [
|
|
2441
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between", children: [
|
|
2442
|
+
/* @__PURE__ */ jsxs7("h3", { className: "font-semibold", children: [
|
|
2443
|
+
"Detalhes da conversa #",
|
|
2444
|
+
conversation.id
|
|
2445
|
+
] }),
|
|
2446
|
+
/* @__PURE__ */ jsx8("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsx8(Button7, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ jsx8(X, { className: "h-4 w-4" }) }) })
|
|
2447
|
+
] }),
|
|
2448
|
+
conversation.id_external ? renderChatLink ? renderChatLink(conversation.id_external) : /* @__PURE__ */ jsx8(Button7, { variant: "outline", size: "sm", asChild: true, children: /* @__PURE__ */ jsxs7("a", { href: `/gchat/inbox/${conversation.id_external}`, children: [
|
|
2449
|
+
/* @__PURE__ */ jsx8(MessageSquare, { className: "mr-2 h-4 w-4" }),
|
|
2450
|
+
"Ver no Chat"
|
|
2451
|
+
] }) }) : null,
|
|
2452
|
+
/* @__PURE__ */ jsxs7("div", { className: "grid grid-cols-2 gap-x-6 gap-y-3 text-sm", children: [
|
|
2453
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2454
|
+
/* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Thread ID" }),
|
|
2455
|
+
/* @__PURE__ */ jsx8("p", { className: "font-mono text-xs mt-0.5", children: conversation.openai_thread_id || "\u2014" })
|
|
2456
|
+
] }),
|
|
2457
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2458
|
+
/* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Contato" }),
|
|
2459
|
+
/* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: contactsMap?.get(conversation.id_contact) ?? conversation.id_contact })
|
|
2460
|
+
] }),
|
|
2461
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2462
|
+
/* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Agente" }),
|
|
2463
|
+
/* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: conversation.id_agent ?? "\u2014" })
|
|
2464
|
+
] }),
|
|
2465
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2466
|
+
/* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Mensagens" }),
|
|
2467
|
+
/* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: conversation.message_count ?? "\u2014" })
|
|
2468
|
+
] }),
|
|
2469
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2470
|
+
/* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Tokens" }),
|
|
2471
|
+
/* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: conversation.usage_tokens ?? "\u2014" })
|
|
2472
|
+
] }),
|
|
2473
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2474
|
+
/* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Rota\xE7\xF5es de Thread" }),
|
|
2475
|
+
/* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: conversation.rotation_count ?? "\u2014" })
|
|
2476
|
+
] }),
|
|
2477
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2478
|
+
/* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Criado em" }),
|
|
2479
|
+
/* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: formatDateTime(conversation.datetime_add) })
|
|
2480
|
+
] }),
|
|
2481
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2482
|
+
/* @__PURE__ */ jsx8("span", { className: "text-muted-foreground", children: "Atualizado em" }),
|
|
2483
|
+
/* @__PURE__ */ jsx8("p", { className: "mt-0.5", children: formatDateTime(conversation.datetime_alt) })
|
|
2484
|
+
] })
|
|
2485
|
+
] })
|
|
2486
|
+
] });
|
|
2487
|
+
}
|
|
2488
|
+
|
|
2489
|
+
// src/components/conversations/agent-conversations-table.tsx
|
|
2490
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2491
|
+
function formatRelativeDate(dateStr) {
|
|
2492
|
+
if (!dateStr) return "\u2014";
|
|
2493
|
+
const date = new Date(dateStr);
|
|
2494
|
+
const now = /* @__PURE__ */ new Date();
|
|
2495
|
+
const diffMs = now.getTime() - date.getTime();
|
|
2496
|
+
const diffMin = Math.floor(diffMs / 6e4);
|
|
2497
|
+
if (diffMin < 1) return "agora";
|
|
2498
|
+
if (diffMin < 60) return `${diffMin}m atr\xE1s`;
|
|
2499
|
+
const diffHours = Math.floor(diffMin / 60);
|
|
2500
|
+
if (diffHours < 24) return `${diffHours}h atr\xE1s`;
|
|
2501
|
+
const diffDays = Math.floor(diffHours / 24);
|
|
2502
|
+
if (diffDays < 30) return `${diffDays}d atr\xE1s`;
|
|
2503
|
+
return date.toLocaleDateString("pt-BR");
|
|
2504
|
+
}
|
|
2505
|
+
function AgentConversationsTable({
|
|
2506
|
+
conversations,
|
|
2507
|
+
isLoading,
|
|
2508
|
+
contactsMap,
|
|
2509
|
+
objectivesMap,
|
|
2510
|
+
config,
|
|
2511
|
+
renderChatLink
|
|
2512
|
+
}) {
|
|
2513
|
+
const [selectedId, setSelectedId] = useState8(null);
|
|
2514
|
+
if (isLoading) {
|
|
2515
|
+
return /* @__PURE__ */ jsx9("div", { className: "space-y-3", children: Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsx9(Skeleton5, { className: "h-12 w-full" }, i)) });
|
|
2516
|
+
}
|
|
2517
|
+
if (conversations.length === 0) {
|
|
2518
|
+
return /* @__PURE__ */ jsxs8("div", { className: "flex flex-col items-center justify-center rounded-lg border border-dashed p-8 text-center", children: [
|
|
2519
|
+
/* @__PURE__ */ jsx9(MessageCircle, { className: "mb-2 h-8 w-8 text-muted-foreground" }),
|
|
2520
|
+
/* @__PURE__ */ jsx9("p", { className: "text-sm text-muted-foreground", children: "Nenhuma conversa encontrada." })
|
|
2521
|
+
] });
|
|
2522
|
+
}
|
|
2523
|
+
return /* @__PURE__ */ jsxs8("div", { className: "space-y-4", children: [
|
|
2524
|
+
/* @__PURE__ */ jsxs8(Table, { children: [
|
|
2525
|
+
/* @__PURE__ */ jsx9(TableHeader, { children: /* @__PURE__ */ jsxs8(TableRow, { children: [
|
|
2526
|
+
/* @__PURE__ */ jsx9(TableHead, { children: "ID" }),
|
|
2527
|
+
/* @__PURE__ */ jsx9(TableHead, { children: "Contato" }),
|
|
2528
|
+
/* @__PURE__ */ jsx9(TableHead, { children: "Objetivo" }),
|
|
2529
|
+
/* @__PURE__ */ jsx9(TableHead, { className: "text-right", children: "Mensagens" }),
|
|
2530
|
+
/* @__PURE__ */ jsx9(TableHead, { className: "text-right", children: "Tokens" }),
|
|
2531
|
+
/* @__PURE__ */ jsx9(TableHead, { children: "Criado em" }),
|
|
2532
|
+
/* @__PURE__ */ jsx9(TableHead, { children: "Atualizado em" }),
|
|
2533
|
+
/* @__PURE__ */ jsx9(TableHead, { className: "w-10" })
|
|
2534
|
+
] }) }),
|
|
2535
|
+
/* @__PURE__ */ jsx9(TableBody, { children: conversations.map((conversation) => /* @__PURE__ */ jsxs8(
|
|
2536
|
+
TableRow,
|
|
2537
|
+
{
|
|
2538
|
+
className: "cursor-pointer",
|
|
2539
|
+
onClick: () => setSelectedId(
|
|
2540
|
+
selectedId === conversation.id ? null : conversation.id
|
|
2541
|
+
),
|
|
2542
|
+
"data-state": selectedId === conversation.id ? "selected" : void 0,
|
|
2543
|
+
children: [
|
|
2544
|
+
/* @__PURE__ */ jsx9(TableCell, { className: "font-mono text-xs", children: conversation.id }),
|
|
2545
|
+
/* @__PURE__ */ jsx9(TableCell, { children: contactsMap?.get(conversation.id_contact) ?? conversation.id_contact }),
|
|
2546
|
+
/* @__PURE__ */ jsx9(TableCell, { children: conversation.id_objective && objectivesMap?.get(conversation.id_objective) ? /* @__PURE__ */ jsx9(Badge5, { variant: "secondary", className: "text-xs", children: objectivesMap.get(conversation.id_objective) }) : /* @__PURE__ */ jsx9("span", { className: "text-xs text-muted-foreground", children: "\u2014" }) }),
|
|
2547
|
+
/* @__PURE__ */ jsx9(TableCell, { className: "text-right", children: conversation.message_count ?? "\u2014" }),
|
|
2548
|
+
/* @__PURE__ */ jsx9(TableCell, { className: "text-right", children: conversation.usage_tokens ?? "\u2014" }),
|
|
2549
|
+
/* @__PURE__ */ jsx9(TableCell, { children: new Date(conversation.datetime_add).toLocaleDateString("pt-BR") }),
|
|
2550
|
+
/* @__PURE__ */ jsx9(TableCell, { children: formatRelativeDate(conversation.datetime_alt) }),
|
|
2551
|
+
/* @__PURE__ */ jsx9(TableCell, { children: conversation.id_external ? renderChatLink ? /* @__PURE__ */ jsx9("span", { onClick: (e) => e.stopPropagation(), children: renderChatLink(conversation.id_external) }) : /* @__PURE__ */ jsx9(
|
|
2552
|
+
"a",
|
|
2553
|
+
{
|
|
2554
|
+
href: `/gchat/inbox/${conversation.id_external}`,
|
|
2555
|
+
title: "Ver no Chat",
|
|
2556
|
+
onClick: (e) => e.stopPropagation(),
|
|
2557
|
+
className: "inline-flex items-center justify-center rounded-md p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",
|
|
2558
|
+
children: /* @__PURE__ */ jsx9(ExternalLink, { className: "h-4 w-4" })
|
|
2559
|
+
}
|
|
2560
|
+
) : null })
|
|
2561
|
+
]
|
|
2562
|
+
},
|
|
2563
|
+
conversation.id
|
|
2564
|
+
)) })
|
|
2565
|
+
] }),
|
|
2566
|
+
selectedId && /* @__PURE__ */ jsx9(
|
|
2567
|
+
ConversationView,
|
|
2568
|
+
{
|
|
2569
|
+
conversationId: selectedId,
|
|
2570
|
+
onClose: () => setSelectedId(null),
|
|
2571
|
+
contactsMap,
|
|
2572
|
+
config,
|
|
2573
|
+
renderChatLink
|
|
2574
|
+
}
|
|
2575
|
+
)
|
|
2576
|
+
] });
|
|
2577
|
+
}
|
|
2578
|
+
|
|
2579
|
+
// src/components/conversations/agent-conversations-panel.tsx
|
|
2580
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
2581
|
+
function AgentConversationsPanel({
|
|
2582
|
+
agent,
|
|
2583
|
+
config,
|
|
2584
|
+
renderChatLink
|
|
2585
|
+
}) {
|
|
2586
|
+
const { data: conversationsData, isLoading } = useAgentConversations(
|
|
2587
|
+
config,
|
|
2588
|
+
agent.id
|
|
2589
|
+
);
|
|
2590
|
+
const { data: contactsData } = useGagentsContacts(config);
|
|
2591
|
+
const { data: objectivesData } = useObjectives(config, agent.id);
|
|
2592
|
+
const conversations = conversationsData?.data || [];
|
|
2593
|
+
const contactsMap = new Map(
|
|
2594
|
+
(contactsData?.data || []).map((c) => [c.id, c.name])
|
|
2595
|
+
);
|
|
2596
|
+
const objectivesMap = new Map(
|
|
2597
|
+
(objectivesData?.data || []).map((o) => [o.id, o.title])
|
|
2598
|
+
);
|
|
2599
|
+
return /* @__PURE__ */ jsx10("div", { className: "p-4", children: /* @__PURE__ */ jsx10(
|
|
2600
|
+
AgentConversationsTable,
|
|
2601
|
+
{
|
|
2602
|
+
conversations,
|
|
2603
|
+
isLoading,
|
|
2604
|
+
contactsMap,
|
|
2605
|
+
objectivesMap,
|
|
2606
|
+
config,
|
|
2607
|
+
renderChatLink
|
|
2608
|
+
}
|
|
2609
|
+
) });
|
|
2610
|
+
}
|
|
2611
|
+
|
|
2398
2612
|
// src/components/agents/agent-tabs.tsx
|
|
2399
2613
|
import {
|
|
2400
2614
|
Tabs,
|
|
@@ -2402,41 +2616,48 @@ import {
|
|
|
2402
2616
|
TabsTrigger,
|
|
2403
2617
|
TabsContent
|
|
2404
2618
|
} from "@greatapps/greatauth-ui/ui";
|
|
2405
|
-
import { Wrench as Wrench2, Target as Target2, FileText as FileText2, MessageCircle } from "lucide-react";
|
|
2406
|
-
import { jsx as
|
|
2407
|
-
function AgentTabs({ agent, config,
|
|
2408
|
-
return /* @__PURE__ */
|
|
2409
|
-
/* @__PURE__ */
|
|
2410
|
-
/* @__PURE__ */
|
|
2411
|
-
/* @__PURE__ */
|
|
2619
|
+
import { Wrench as Wrench2, Target as Target2, FileText as FileText2, MessageCircle as MessageCircle2 } from "lucide-react";
|
|
2620
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2621
|
+
function AgentTabs({ agent, config, renderChatLink }) {
|
|
2622
|
+
return /* @__PURE__ */ jsxs9(Tabs, { defaultValue: "prompt", children: [
|
|
2623
|
+
/* @__PURE__ */ jsxs9(TabsList, { children: [
|
|
2624
|
+
/* @__PURE__ */ jsxs9(TabsTrigger, { value: "prompt", className: "flex items-center gap-1.5", children: [
|
|
2625
|
+
/* @__PURE__ */ jsx11(FileText2, { className: "h-3.5 w-3.5" }),
|
|
2412
2626
|
"Prompt"
|
|
2413
2627
|
] }),
|
|
2414
|
-
/* @__PURE__ */
|
|
2415
|
-
/* @__PURE__ */
|
|
2628
|
+
/* @__PURE__ */ jsxs9(TabsTrigger, { value: "objetivos", className: "flex items-center gap-1.5", children: [
|
|
2629
|
+
/* @__PURE__ */ jsx11(Target2, { className: "h-3.5 w-3.5" }),
|
|
2416
2630
|
"Objetivos"
|
|
2417
2631
|
] }),
|
|
2418
|
-
/* @__PURE__ */
|
|
2419
|
-
/* @__PURE__ */
|
|
2632
|
+
/* @__PURE__ */ jsxs9(TabsTrigger, { value: "ferramentas", className: "flex items-center gap-1.5", children: [
|
|
2633
|
+
/* @__PURE__ */ jsx11(Wrench2, { className: "h-3.5 w-3.5" }),
|
|
2420
2634
|
"Ferramentas"
|
|
2421
2635
|
] }),
|
|
2422
|
-
|
|
2423
|
-
/* @__PURE__ */
|
|
2636
|
+
/* @__PURE__ */ jsxs9(TabsTrigger, { value: "conversas", className: "flex items-center gap-1.5", children: [
|
|
2637
|
+
/* @__PURE__ */ jsx11(MessageCircle2, { className: "h-3.5 w-3.5" }),
|
|
2424
2638
|
"Conversas"
|
|
2425
2639
|
] })
|
|
2426
2640
|
] }),
|
|
2427
|
-
/* @__PURE__ */
|
|
2428
|
-
/* @__PURE__ */
|
|
2429
|
-
/* @__PURE__ */
|
|
2430
|
-
|
|
2641
|
+
/* @__PURE__ */ jsx11(TabsContent, { value: "prompt", className: "mt-4", children: /* @__PURE__ */ jsx11(AgentPromptEditor, { agent, config }) }),
|
|
2642
|
+
/* @__PURE__ */ jsx11(TabsContent, { value: "objetivos", className: "mt-4", children: /* @__PURE__ */ jsx11(AgentObjectivesList, { agent, config }) }),
|
|
2643
|
+
/* @__PURE__ */ jsx11(TabsContent, { value: "ferramentas", className: "mt-4", children: /* @__PURE__ */ jsx11(AgentToolsList, { agent, config }) }),
|
|
2644
|
+
/* @__PURE__ */ jsx11(TabsContent, { value: "conversas", className: "mt-4", children: /* @__PURE__ */ jsx11(
|
|
2645
|
+
AgentConversationsPanel,
|
|
2646
|
+
{
|
|
2647
|
+
agent,
|
|
2648
|
+
config,
|
|
2649
|
+
renderChatLink
|
|
2650
|
+
}
|
|
2651
|
+
) })
|
|
2431
2652
|
] });
|
|
2432
2653
|
}
|
|
2433
2654
|
|
|
2434
2655
|
// src/components/tools/tools-table.tsx
|
|
2435
|
-
import { useMemo as useMemo4, useState as
|
|
2656
|
+
import { useMemo as useMemo4, useState as useState9 } from "react";
|
|
2436
2657
|
import { DataTable as DataTable2 } from "@greatapps/greatauth-ui";
|
|
2437
2658
|
import {
|
|
2438
2659
|
Input as Input7,
|
|
2439
|
-
Badge as
|
|
2660
|
+
Badge as Badge6,
|
|
2440
2661
|
Tooltip as Tooltip2,
|
|
2441
2662
|
TooltipTrigger as TooltipTrigger2,
|
|
2442
2663
|
TooltipContent as TooltipContent2,
|
|
@@ -2448,44 +2669,44 @@ import {
|
|
|
2448
2669
|
AlertDialogFooter as AlertDialogFooter4,
|
|
2449
2670
|
AlertDialogHeader as AlertDialogHeader4,
|
|
2450
2671
|
AlertDialogTitle as AlertDialogTitle4,
|
|
2451
|
-
Button as
|
|
2672
|
+
Button as Button8
|
|
2452
2673
|
} from "@greatapps/greatauth-ui/ui";
|
|
2453
2674
|
import { Pencil as Pencil3, Trash2 as Trash24, Search as Search2 } from "lucide-react";
|
|
2454
2675
|
import { format as format2 } from "date-fns";
|
|
2455
2676
|
import { ptBR as ptBR2 } from "date-fns/locale";
|
|
2456
2677
|
import { toast as toast7 } from "sonner";
|
|
2457
|
-
import { Fragment as Fragment2, jsx as
|
|
2678
|
+
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2458
2679
|
function useColumns2(onEdit, onDelete) {
|
|
2459
2680
|
return [
|
|
2460
2681
|
{
|
|
2461
2682
|
accessorKey: "name",
|
|
2462
2683
|
header: "Nome",
|
|
2463
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
2684
|
+
cell: ({ row }) => /* @__PURE__ */ jsx12("span", { className: "font-medium", children: row.original.name }),
|
|
2464
2685
|
sortingFn: (rowA, rowB) => rowA.original.name.toLowerCase().localeCompare(rowB.original.name.toLowerCase())
|
|
2465
2686
|
},
|
|
2466
2687
|
{
|
|
2467
2688
|
accessorKey: "slug",
|
|
2468
2689
|
header: "Slug",
|
|
2469
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
2690
|
+
cell: ({ row }) => /* @__PURE__ */ jsx12("span", { className: "text-muted-foreground text-sm font-mono", children: row.original.slug || "\u2014" })
|
|
2470
2691
|
},
|
|
2471
2692
|
{
|
|
2472
2693
|
accessorKey: "type",
|
|
2473
2694
|
header: "Tipo",
|
|
2474
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
2695
|
+
cell: ({ row }) => /* @__PURE__ */ jsx12(Badge6, { variant: "secondary", children: row.original.type })
|
|
2475
2696
|
},
|
|
2476
2697
|
{
|
|
2477
2698
|
accessorKey: "description",
|
|
2478
2699
|
header: "Descri\xE7\xE3o",
|
|
2479
2700
|
cell: ({ row }) => {
|
|
2480
2701
|
const desc = row.original.description;
|
|
2481
|
-
if (!desc) return /* @__PURE__ */
|
|
2482
|
-
return /* @__PURE__ */
|
|
2702
|
+
if (!desc) return /* @__PURE__ */ jsx12("span", { className: "text-muted-foreground text-sm", children: "\u2014" });
|
|
2703
|
+
return /* @__PURE__ */ jsx12("span", { className: "text-muted-foreground text-sm", children: desc.length > 50 ? `${desc.slice(0, 50)}...` : desc });
|
|
2483
2704
|
}
|
|
2484
2705
|
},
|
|
2485
2706
|
{
|
|
2486
2707
|
accessorKey: "datetime_add",
|
|
2487
2708
|
header: "Criado em",
|
|
2488
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
2709
|
+
cell: ({ row }) => /* @__PURE__ */ jsx12("span", { className: "text-muted-foreground text-sm", children: format2(new Date(row.original.datetime_add), "dd/MM/yyyy", {
|
|
2489
2710
|
locale: ptBR2
|
|
2490
2711
|
}) })
|
|
2491
2712
|
},
|
|
@@ -2493,40 +2714,40 @@ function useColumns2(onEdit, onDelete) {
|
|
|
2493
2714
|
id: "actions",
|
|
2494
2715
|
size: 80,
|
|
2495
2716
|
enableSorting: false,
|
|
2496
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
2497
|
-
/* @__PURE__ */
|
|
2498
|
-
/* @__PURE__ */
|
|
2499
|
-
|
|
2717
|
+
cell: ({ row }) => /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
2718
|
+
/* @__PURE__ */ jsxs10(Tooltip2, { children: [
|
|
2719
|
+
/* @__PURE__ */ jsx12(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx12(
|
|
2720
|
+
Button8,
|
|
2500
2721
|
{
|
|
2501
2722
|
variant: "ghost",
|
|
2502
2723
|
size: "icon",
|
|
2503
2724
|
className: "h-8 w-8",
|
|
2504
2725
|
onClick: () => onEdit(row.original),
|
|
2505
|
-
children: /* @__PURE__ */
|
|
2726
|
+
children: /* @__PURE__ */ jsx12(Pencil3, { className: "h-4 w-4" })
|
|
2506
2727
|
}
|
|
2507
2728
|
) }),
|
|
2508
|
-
/* @__PURE__ */
|
|
2729
|
+
/* @__PURE__ */ jsx12(TooltipContent2, { children: "Editar" })
|
|
2509
2730
|
] }),
|
|
2510
|
-
/* @__PURE__ */
|
|
2511
|
-
/* @__PURE__ */
|
|
2512
|
-
|
|
2731
|
+
/* @__PURE__ */ jsxs10(Tooltip2, { children: [
|
|
2732
|
+
/* @__PURE__ */ jsx12(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx12(
|
|
2733
|
+
Button8,
|
|
2513
2734
|
{
|
|
2514
2735
|
variant: "ghost",
|
|
2515
2736
|
size: "icon",
|
|
2516
2737
|
className: "h-8 w-8 text-destructive hover:text-destructive",
|
|
2517
2738
|
onClick: () => onDelete(row.original.id),
|
|
2518
|
-
children: /* @__PURE__ */
|
|
2739
|
+
children: /* @__PURE__ */ jsx12(Trash24, { className: "h-4 w-4" })
|
|
2519
2740
|
}
|
|
2520
2741
|
) }),
|
|
2521
|
-
/* @__PURE__ */
|
|
2742
|
+
/* @__PURE__ */ jsx12(TooltipContent2, { children: "Excluir" })
|
|
2522
2743
|
] })
|
|
2523
2744
|
] })
|
|
2524
2745
|
}
|
|
2525
2746
|
];
|
|
2526
2747
|
}
|
|
2527
2748
|
function ToolsTable({ onEdit, config }) {
|
|
2528
|
-
const [search, setSearch] =
|
|
2529
|
-
const [page, setPage] =
|
|
2749
|
+
const [search, setSearch] = useState9("");
|
|
2750
|
+
const [page, setPage] = useState9(1);
|
|
2530
2751
|
const queryParams = useMemo4(() => {
|
|
2531
2752
|
const params = {
|
|
2532
2753
|
limit: "15",
|
|
@@ -2539,7 +2760,7 @@ function ToolsTable({ onEdit, config }) {
|
|
|
2539
2760
|
}, [search, page]);
|
|
2540
2761
|
const { data, isLoading } = useTools(config, queryParams);
|
|
2541
2762
|
const deleteTool = useDeleteTool(config);
|
|
2542
|
-
const [deleteId, setDeleteId] =
|
|
2763
|
+
const [deleteId, setDeleteId] = useState9(null);
|
|
2543
2764
|
const tools = data?.data || [];
|
|
2544
2765
|
const total = data?.total || 0;
|
|
2545
2766
|
const columns = useColumns2(
|
|
@@ -2560,10 +2781,10 @@ function ToolsTable({ onEdit, config }) {
|
|
|
2560
2781
|
setSearch(value);
|
|
2561
2782
|
setPage(1);
|
|
2562
2783
|
}
|
|
2563
|
-
return /* @__PURE__ */
|
|
2564
|
-
/* @__PURE__ */
|
|
2565
|
-
/* @__PURE__ */
|
|
2566
|
-
/* @__PURE__ */
|
|
2784
|
+
return /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
2785
|
+
/* @__PURE__ */ jsx12("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs10("div", { className: "relative flex-1 max-w-md", children: [
|
|
2786
|
+
/* @__PURE__ */ jsx12(Search2, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
2787
|
+
/* @__PURE__ */ jsx12(
|
|
2567
2788
|
Input7,
|
|
2568
2789
|
{
|
|
2569
2790
|
placeholder: "Buscar ferramentas...",
|
|
@@ -2573,7 +2794,7 @@ function ToolsTable({ onEdit, config }) {
|
|
|
2573
2794
|
}
|
|
2574
2795
|
)
|
|
2575
2796
|
] }) }),
|
|
2576
|
-
/* @__PURE__ */
|
|
2797
|
+
/* @__PURE__ */ jsx12(
|
|
2577
2798
|
DataTable2,
|
|
2578
2799
|
{
|
|
2579
2800
|
columns,
|
|
@@ -2586,19 +2807,19 @@ function ToolsTable({ onEdit, config }) {
|
|
|
2586
2807
|
pageSize: 15
|
|
2587
2808
|
}
|
|
2588
2809
|
),
|
|
2589
|
-
/* @__PURE__ */
|
|
2810
|
+
/* @__PURE__ */ jsx12(
|
|
2590
2811
|
AlertDialog4,
|
|
2591
2812
|
{
|
|
2592
2813
|
open: !!deleteId,
|
|
2593
2814
|
onOpenChange: (open) => !open && setDeleteId(null),
|
|
2594
|
-
children: /* @__PURE__ */
|
|
2595
|
-
/* @__PURE__ */
|
|
2596
|
-
/* @__PURE__ */
|
|
2597
|
-
/* @__PURE__ */
|
|
2815
|
+
children: /* @__PURE__ */ jsxs10(AlertDialogContent4, { children: [
|
|
2816
|
+
/* @__PURE__ */ jsxs10(AlertDialogHeader4, { children: [
|
|
2817
|
+
/* @__PURE__ */ jsx12(AlertDialogTitle4, { children: "Excluir ferramenta?" }),
|
|
2818
|
+
/* @__PURE__ */ jsx12(AlertDialogDescription4, { children: "Esta a\xE7\xE3o n\xE3o pode ser desfeita. A ferramenta ser\xE1 removida permanentemente." })
|
|
2598
2819
|
] }),
|
|
2599
|
-
/* @__PURE__ */
|
|
2600
|
-
/* @__PURE__ */
|
|
2601
|
-
/* @__PURE__ */
|
|
2820
|
+
/* @__PURE__ */ jsxs10(AlertDialogFooter4, { children: [
|
|
2821
|
+
/* @__PURE__ */ jsx12(AlertDialogCancel4, { variant: "outline", size: "default", children: "Cancelar" }),
|
|
2822
|
+
/* @__PURE__ */ jsx12(
|
|
2602
2823
|
AlertDialogAction4,
|
|
2603
2824
|
{
|
|
2604
2825
|
variant: "default",
|
|
@@ -2616,14 +2837,14 @@ function ToolsTable({ onEdit, config }) {
|
|
|
2616
2837
|
}
|
|
2617
2838
|
|
|
2618
2839
|
// src/components/tools/tool-form-dialog.tsx
|
|
2619
|
-
import { useState as
|
|
2840
|
+
import { useState as useState10 } from "react";
|
|
2620
2841
|
import {
|
|
2621
2842
|
Dialog as Dialog5,
|
|
2622
2843
|
DialogContent as DialogContent5,
|
|
2623
2844
|
DialogHeader as DialogHeader5,
|
|
2624
2845
|
DialogTitle as DialogTitle5,
|
|
2625
2846
|
DialogFooter as DialogFooter5,
|
|
2626
|
-
Button as
|
|
2847
|
+
Button as Button9,
|
|
2627
2848
|
Input as Input8,
|
|
2628
2849
|
Textarea as Textarea4,
|
|
2629
2850
|
Label as Label5,
|
|
@@ -2635,7 +2856,7 @@ import {
|
|
|
2635
2856
|
} from "@greatapps/greatauth-ui/ui";
|
|
2636
2857
|
import { Loader2 as Loader24 } from "lucide-react";
|
|
2637
2858
|
import { toast as toast8 } from "sonner";
|
|
2638
|
-
import { jsx as
|
|
2859
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2639
2860
|
var TOOL_AUTH_TYPES = [
|
|
2640
2861
|
{ value: "none", label: "Nenhuma" },
|
|
2641
2862
|
{ value: "api_key", label: "API Key" },
|
|
@@ -2682,9 +2903,9 @@ function ToolFormDialog({
|
|
|
2682
2903
|
const isEditing = !!tool;
|
|
2683
2904
|
const createTool = useCreateTool(config);
|
|
2684
2905
|
const updateTool = useUpdateTool(config);
|
|
2685
|
-
const [form, setForm] =
|
|
2686
|
-
const [slugManuallyEdited, setSlugManuallyEdited] =
|
|
2687
|
-
const [lastResetKey, setLastResetKey] =
|
|
2906
|
+
const [form, setForm] = useState10(() => toolToFormState(tool));
|
|
2907
|
+
const [slugManuallyEdited, setSlugManuallyEdited] = useState10(false);
|
|
2908
|
+
const [lastResetKey, setLastResetKey] = useState10(
|
|
2688
2909
|
() => `${tool?.id}-${open}`
|
|
2689
2910
|
);
|
|
2690
2911
|
const resetKey = `${tool?.id}-${open}`;
|
|
@@ -2745,12 +2966,12 @@ function ToolFormDialog({
|
|
|
2745
2966
|
);
|
|
2746
2967
|
}
|
|
2747
2968
|
}
|
|
2748
|
-
return /* @__PURE__ */
|
|
2749
|
-
/* @__PURE__ */
|
|
2750
|
-
/* @__PURE__ */
|
|
2751
|
-
/* @__PURE__ */
|
|
2752
|
-
/* @__PURE__ */
|
|
2753
|
-
/* @__PURE__ */
|
|
2969
|
+
return /* @__PURE__ */ jsx13(Dialog5, { open, onOpenChange, children: /* @__PURE__ */ jsxs11(DialogContent5, { className: "sm:max-w-lg", children: [
|
|
2970
|
+
/* @__PURE__ */ jsx13(DialogHeader5, { children: /* @__PURE__ */ jsx13(DialogTitle5, { children: isEditing ? "Editar Ferramenta" : "Nova Ferramenta" }) }),
|
|
2971
|
+
/* @__PURE__ */ jsxs11("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
|
|
2972
|
+
/* @__PURE__ */ jsxs11("div", { className: "space-y-2", children: [
|
|
2973
|
+
/* @__PURE__ */ jsx13(Label5, { htmlFor: "tool-name", children: "Nome *" }),
|
|
2974
|
+
/* @__PURE__ */ jsx13(
|
|
2754
2975
|
Input8,
|
|
2755
2976
|
{
|
|
2756
2977
|
id: "tool-name",
|
|
@@ -2768,11 +2989,11 @@ function ToolFormDialog({
|
|
|
2768
2989
|
disabled: isPending
|
|
2769
2990
|
}
|
|
2770
2991
|
),
|
|
2771
|
-
form.nameError && /* @__PURE__ */
|
|
2992
|
+
form.nameError && /* @__PURE__ */ jsx13("p", { className: "text-sm text-destructive", children: "Nome \xE9 obrigat\xF3rio" })
|
|
2772
2993
|
] }),
|
|
2773
|
-
/* @__PURE__ */
|
|
2774
|
-
/* @__PURE__ */
|
|
2775
|
-
/* @__PURE__ */
|
|
2994
|
+
/* @__PURE__ */ jsxs11("div", { className: "space-y-2", children: [
|
|
2995
|
+
/* @__PURE__ */ jsx13(Label5, { htmlFor: "tool-slug", children: "Slug (identificador \xFAnico) *" }),
|
|
2996
|
+
/* @__PURE__ */ jsx13(
|
|
2776
2997
|
Input8,
|
|
2777
2998
|
{
|
|
2778
2999
|
id: "tool-slug",
|
|
@@ -2789,12 +3010,12 @@ function ToolFormDialog({
|
|
|
2789
3010
|
disabled: isPending
|
|
2790
3011
|
}
|
|
2791
3012
|
),
|
|
2792
|
-
/* @__PURE__ */
|
|
2793
|
-
form.slugError && /* @__PURE__ */
|
|
3013
|
+
/* @__PURE__ */ jsx13("p", { className: "text-xs text-muted-foreground", children: "Gerado automaticamente a partir do nome. Usado internamente para identificar a ferramenta." }),
|
|
3014
|
+
form.slugError && /* @__PURE__ */ jsx13("p", { className: "text-sm text-destructive", children: "Slug \xE9 obrigat\xF3rio" })
|
|
2794
3015
|
] }),
|
|
2795
|
-
/* @__PURE__ */
|
|
2796
|
-
/* @__PURE__ */
|
|
2797
|
-
/* @__PURE__ */
|
|
3016
|
+
/* @__PURE__ */ jsxs11("div", { className: "space-y-2", children: [
|
|
3017
|
+
/* @__PURE__ */ jsx13(Label5, { htmlFor: "tool-type", children: "Tipo de Autentica\xE7\xE3o *" }),
|
|
3018
|
+
/* @__PURE__ */ jsxs11(
|
|
2798
3019
|
Select2,
|
|
2799
3020
|
{
|
|
2800
3021
|
value: form.type,
|
|
@@ -2807,17 +3028,17 @@ function ToolFormDialog({
|
|
|
2807
3028
|
},
|
|
2808
3029
|
disabled: isPending,
|
|
2809
3030
|
children: [
|
|
2810
|
-
/* @__PURE__ */
|
|
2811
|
-
/* @__PURE__ */
|
|
3031
|
+
/* @__PURE__ */ jsx13(SelectTrigger2, { id: "tool-type", children: /* @__PURE__ */ jsx13(SelectValue2, { placeholder: "Selecione o tipo" }) }),
|
|
3032
|
+
/* @__PURE__ */ jsx13(SelectContent2, { children: TOOL_AUTH_TYPES.map((t) => /* @__PURE__ */ jsx13(SelectItem2, { value: t.value, children: t.label }, t.value)) })
|
|
2812
3033
|
]
|
|
2813
3034
|
}
|
|
2814
3035
|
),
|
|
2815
|
-
/* @__PURE__ */
|
|
2816
|
-
form.typeError && /* @__PURE__ */
|
|
3036
|
+
/* @__PURE__ */ jsx13("p", { className: "text-xs text-muted-foreground", children: "Define se a ferramenta requer credenciais para funcionar." }),
|
|
3037
|
+
form.typeError && /* @__PURE__ */ jsx13("p", { className: "text-sm text-destructive", children: "Tipo \xE9 obrigat\xF3rio" })
|
|
2817
3038
|
] }),
|
|
2818
|
-
/* @__PURE__ */
|
|
2819
|
-
/* @__PURE__ */
|
|
2820
|
-
/* @__PURE__ */
|
|
3039
|
+
/* @__PURE__ */ jsxs11("div", { className: "space-y-2", children: [
|
|
3040
|
+
/* @__PURE__ */ jsx13(Label5, { htmlFor: "tool-description", children: "Descri\xE7\xE3o" }),
|
|
3041
|
+
/* @__PURE__ */ jsx13(
|
|
2821
3042
|
Textarea4,
|
|
2822
3043
|
{
|
|
2823
3044
|
id: "tool-description",
|
|
@@ -2829,9 +3050,9 @@ function ToolFormDialog({
|
|
|
2829
3050
|
}
|
|
2830
3051
|
)
|
|
2831
3052
|
] }),
|
|
2832
|
-
/* @__PURE__ */
|
|
2833
|
-
/* @__PURE__ */
|
|
2834
|
-
/* @__PURE__ */
|
|
3053
|
+
/* @__PURE__ */ jsxs11("div", { className: "space-y-2", children: [
|
|
3054
|
+
/* @__PURE__ */ jsx13(Label5, { htmlFor: "tool-function-defs", children: "Defini\xE7\xF5es de Fun\xE7\xE3o (JSON)" }),
|
|
3055
|
+
/* @__PURE__ */ jsx13(
|
|
2835
3056
|
Textarea4,
|
|
2836
3057
|
{
|
|
2837
3058
|
id: "tool-function-defs",
|
|
@@ -2862,12 +3083,12 @@ function ToolFormDialog({
|
|
|
2862
3083
|
disabled: isPending
|
|
2863
3084
|
}
|
|
2864
3085
|
),
|
|
2865
|
-
/* @__PURE__ */
|
|
2866
|
-
form.jsonError && /* @__PURE__ */
|
|
3086
|
+
/* @__PURE__ */ jsx13("p", { className: "text-xs text-muted-foreground", children: "Array de defini\xE7\xF5es no formato OpenAI Function Calling." }),
|
|
3087
|
+
form.jsonError && /* @__PURE__ */ jsx13("p", { className: "text-sm text-destructive", children: "JSON inv\xE1lido" })
|
|
2867
3088
|
] }),
|
|
2868
|
-
/* @__PURE__ */
|
|
2869
|
-
/* @__PURE__ */
|
|
2870
|
-
|
|
3089
|
+
/* @__PURE__ */ jsxs11(DialogFooter5, { children: [
|
|
3090
|
+
/* @__PURE__ */ jsx13(
|
|
3091
|
+
Button9,
|
|
2871
3092
|
{
|
|
2872
3093
|
type: "button",
|
|
2873
3094
|
variant: "outline",
|
|
@@ -2876,8 +3097,8 @@ function ToolFormDialog({
|
|
|
2876
3097
|
children: "Cancelar"
|
|
2877
3098
|
}
|
|
2878
3099
|
),
|
|
2879
|
-
/* @__PURE__ */
|
|
2880
|
-
isPending ? /* @__PURE__ */
|
|
3100
|
+
/* @__PURE__ */ jsxs11(Button9, { type: "submit", disabled: isPending, children: [
|
|
3101
|
+
isPending ? /* @__PURE__ */ jsx13(Loader24, { className: "mr-2 h-4 w-4 animate-spin" }) : null,
|
|
2881
3102
|
isEditing ? "Salvar" : "Criar"
|
|
2882
3103
|
] })
|
|
2883
3104
|
] })
|
|
@@ -2886,12 +3107,12 @@ function ToolFormDialog({
|
|
|
2886
3107
|
}
|
|
2887
3108
|
|
|
2888
3109
|
// src/components/tools/tool-credentials-form.tsx
|
|
2889
|
-
import { useMemo as useMemo5, useState as
|
|
3110
|
+
import { useMemo as useMemo5, useState as useState11 } from "react";
|
|
2890
3111
|
import { DataTable as DataTable3 } from "@greatapps/greatauth-ui";
|
|
2891
3112
|
import {
|
|
2892
3113
|
Input as Input9,
|
|
2893
|
-
Button as
|
|
2894
|
-
Badge as
|
|
3114
|
+
Button as Button10,
|
|
3115
|
+
Badge as Badge7,
|
|
2895
3116
|
Tooltip as Tooltip3,
|
|
2896
3117
|
TooltipTrigger as TooltipTrigger3,
|
|
2897
3118
|
TooltipContent as TooltipContent3,
|
|
@@ -2918,7 +3139,7 @@ import { Trash2 as Trash25, Pencil as Pencil4, Link, Search as Search3 } from "l
|
|
|
2918
3139
|
import { format as format3 } from "date-fns";
|
|
2919
3140
|
import { ptBR as ptBR3 } from "date-fns/locale";
|
|
2920
3141
|
import { toast as toast9 } from "sonner";
|
|
2921
|
-
import { jsx as
|
|
3142
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2922
3143
|
function formatDate2(dateStr) {
|
|
2923
3144
|
if (!dateStr) return "Sem expira\xE7\xE3o";
|
|
2924
3145
|
return format3(new Date(dateStr), "dd/MM/yyyy", { locale: ptBR3 });
|
|
@@ -2938,18 +3159,18 @@ function useColumns3(tools, onEdit, onConnect, onRemove) {
|
|
|
2938
3159
|
{
|
|
2939
3160
|
accessorKey: "label",
|
|
2940
3161
|
header: "Label",
|
|
2941
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
3162
|
+
cell: ({ row }) => /* @__PURE__ */ jsx14("span", { className: "font-medium", children: row.original.label || "\u2014" })
|
|
2942
3163
|
},
|
|
2943
3164
|
{
|
|
2944
3165
|
accessorKey: "id_tool",
|
|
2945
3166
|
header: "Ferramenta",
|
|
2946
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
3167
|
+
cell: ({ row }) => /* @__PURE__ */ jsx14("span", { className: "text-sm", children: getToolName(row.original.id_tool) })
|
|
2947
3168
|
},
|
|
2948
3169
|
{
|
|
2949
3170
|
accessorKey: "status",
|
|
2950
3171
|
header: "Status",
|
|
2951
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
2952
|
-
|
|
3172
|
+
cell: ({ row }) => /* @__PURE__ */ jsx14(
|
|
3173
|
+
Badge7,
|
|
2953
3174
|
{
|
|
2954
3175
|
variant: row.original.status === "active" ? "default" : "destructive",
|
|
2955
3176
|
children: row.original.status === "active" ? "Ativo" : "Expirado"
|
|
@@ -2959,57 +3180,57 @@ function useColumns3(tools, onEdit, onConnect, onRemove) {
|
|
|
2959
3180
|
{
|
|
2960
3181
|
accessorKey: "expires_at",
|
|
2961
3182
|
header: "Expira em",
|
|
2962
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
3183
|
+
cell: ({ row }) => /* @__PURE__ */ jsx14("span", { className: "text-muted-foreground text-sm", children: formatDate2(row.original.expires_at) })
|
|
2963
3184
|
},
|
|
2964
3185
|
{
|
|
2965
3186
|
accessorKey: "datetime_add",
|
|
2966
3187
|
header: "Criado em",
|
|
2967
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
3188
|
+
cell: ({ row }) => /* @__PURE__ */ jsx14("span", { className: "text-muted-foreground text-sm", children: formatDate2(row.original.datetime_add) })
|
|
2968
3189
|
},
|
|
2969
3190
|
{
|
|
2970
3191
|
id: "actions",
|
|
2971
3192
|
header: "A\xE7\xF5es",
|
|
2972
3193
|
size: 100,
|
|
2973
3194
|
enableSorting: false,
|
|
2974
|
-
cell: ({ row }) => /* @__PURE__ */
|
|
2975
|
-
getToolType(row.original.id_tool) === "oauth2" && /* @__PURE__ */
|
|
2976
|
-
/* @__PURE__ */
|
|
2977
|
-
|
|
3195
|
+
cell: ({ row }) => /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
|
|
3196
|
+
getToolType(row.original.id_tool) === "oauth2" && /* @__PURE__ */ jsxs12(Tooltip3, { children: [
|
|
3197
|
+
/* @__PURE__ */ jsx14(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx14(
|
|
3198
|
+
Button10,
|
|
2978
3199
|
{
|
|
2979
3200
|
variant: "ghost",
|
|
2980
3201
|
size: "icon",
|
|
2981
3202
|
className: "h-8 w-8",
|
|
2982
3203
|
disabled: true,
|
|
2983
|
-
children: /* @__PURE__ */
|
|
3204
|
+
children: /* @__PURE__ */ jsx14(Link, { className: "h-4 w-4" })
|
|
2984
3205
|
}
|
|
2985
3206
|
) }),
|
|
2986
|
-
/* @__PURE__ */
|
|
3207
|
+
/* @__PURE__ */ jsx14(TooltipContent3, { children: "Em breve" })
|
|
2987
3208
|
] }),
|
|
2988
|
-
/* @__PURE__ */
|
|
2989
|
-
/* @__PURE__ */
|
|
2990
|
-
|
|
3209
|
+
/* @__PURE__ */ jsxs12(Tooltip3, { children: [
|
|
3210
|
+
/* @__PURE__ */ jsx14(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx14(
|
|
3211
|
+
Button10,
|
|
2991
3212
|
{
|
|
2992
3213
|
variant: "ghost",
|
|
2993
3214
|
size: "icon",
|
|
2994
3215
|
className: "h-8 w-8",
|
|
2995
3216
|
onClick: () => onEdit(row.original),
|
|
2996
|
-
children: /* @__PURE__ */
|
|
3217
|
+
children: /* @__PURE__ */ jsx14(Pencil4, { className: "h-4 w-4" })
|
|
2997
3218
|
}
|
|
2998
3219
|
) }),
|
|
2999
|
-
/* @__PURE__ */
|
|
3220
|
+
/* @__PURE__ */ jsx14(TooltipContent3, { children: "Editar" })
|
|
3000
3221
|
] }),
|
|
3001
|
-
/* @__PURE__ */
|
|
3002
|
-
/* @__PURE__ */
|
|
3003
|
-
|
|
3222
|
+
/* @__PURE__ */ jsxs12(Tooltip3, { children: [
|
|
3223
|
+
/* @__PURE__ */ jsx14(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx14(
|
|
3224
|
+
Button10,
|
|
3004
3225
|
{
|
|
3005
3226
|
variant: "ghost",
|
|
3006
3227
|
size: "icon",
|
|
3007
3228
|
className: "h-8 w-8 text-destructive hover:text-destructive",
|
|
3008
3229
|
onClick: () => onRemove(row.original),
|
|
3009
|
-
children: /* @__PURE__ */
|
|
3230
|
+
children: /* @__PURE__ */ jsx14(Trash25, { className: "h-4 w-4" })
|
|
3010
3231
|
}
|
|
3011
3232
|
) }),
|
|
3012
|
-
/* @__PURE__ */
|
|
3233
|
+
/* @__PURE__ */ jsx14(TooltipContent3, { children: "Remover" })
|
|
3013
3234
|
] })
|
|
3014
3235
|
] })
|
|
3015
3236
|
}
|
|
@@ -3028,25 +3249,25 @@ function ToolCredentialsForm({
|
|
|
3028
3249
|
const deleteMutation = useDeleteToolCredential(config);
|
|
3029
3250
|
const { data: toolsData } = useTools(config);
|
|
3030
3251
|
const tools = toolsData?.data || [];
|
|
3031
|
-
const [search, setSearch] =
|
|
3032
|
-
const [internalCreateOpen, setInternalCreateOpen] =
|
|
3252
|
+
const [search, setSearch] = useState11("");
|
|
3253
|
+
const [internalCreateOpen, setInternalCreateOpen] = useState11(false);
|
|
3033
3254
|
const showCreateDialog = externalCreateOpen ?? internalCreateOpen;
|
|
3034
3255
|
const setShowCreateDialog = onCreateOpenChange ?? setInternalCreateOpen;
|
|
3035
|
-
const [createForm, setCreateForm] =
|
|
3256
|
+
const [createForm, setCreateForm] = useState11({
|
|
3036
3257
|
id_tool: "",
|
|
3037
3258
|
label: "",
|
|
3038
3259
|
credentials_encrypted: "",
|
|
3039
3260
|
expires_at: ""
|
|
3040
3261
|
});
|
|
3041
|
-
const [editTarget, setEditTarget] =
|
|
3042
|
-
const [editForm, setEditForm] =
|
|
3262
|
+
const [editTarget, setEditTarget] = useState11(null);
|
|
3263
|
+
const [editForm, setEditForm] = useState11({
|
|
3043
3264
|
id_tool: "",
|
|
3044
3265
|
label: "",
|
|
3045
3266
|
credentials_encrypted: "",
|
|
3046
3267
|
expires_at: "",
|
|
3047
3268
|
status: ""
|
|
3048
3269
|
});
|
|
3049
|
-
const [removeTarget, setRemoveTarget] =
|
|
3270
|
+
const [removeTarget, setRemoveTarget] = useState11(null);
|
|
3050
3271
|
const filteredCredentials = useMemo5(() => {
|
|
3051
3272
|
if (!search) return credentials;
|
|
3052
3273
|
const term = search.toLowerCase();
|
|
@@ -3152,10 +3373,10 @@ function ToolCredentialsForm({
|
|
|
3152
3373
|
const url = `${gagentsApiUrl}/v1/${language}/${idWl}/accounts/${config.accountId}/oauth/connect?id_tool=${cred.id_tool}`;
|
|
3153
3374
|
window.open(url, "_blank");
|
|
3154
3375
|
}
|
|
3155
|
-
return /* @__PURE__ */
|
|
3156
|
-
/* @__PURE__ */
|
|
3157
|
-
/* @__PURE__ */
|
|
3158
|
-
/* @__PURE__ */
|
|
3376
|
+
return /* @__PURE__ */ jsxs12("div", { className: "space-y-4", children: [
|
|
3377
|
+
/* @__PURE__ */ jsx14("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs12("div", { className: "relative flex-1 max-w-md", children: [
|
|
3378
|
+
/* @__PURE__ */ jsx14(Search3, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
3379
|
+
/* @__PURE__ */ jsx14(
|
|
3159
3380
|
Input9,
|
|
3160
3381
|
{
|
|
3161
3382
|
placeholder: "Buscar credenciais...",
|
|
@@ -3165,7 +3386,7 @@ function ToolCredentialsForm({
|
|
|
3165
3386
|
}
|
|
3166
3387
|
)
|
|
3167
3388
|
] }) }),
|
|
3168
|
-
/* @__PURE__ */
|
|
3389
|
+
/* @__PURE__ */ jsx14(
|
|
3169
3390
|
DataTable3,
|
|
3170
3391
|
{
|
|
3171
3392
|
columns,
|
|
@@ -3174,26 +3395,26 @@ function ToolCredentialsForm({
|
|
|
3174
3395
|
emptyMessage: "Nenhuma credencial encontrada"
|
|
3175
3396
|
}
|
|
3176
3397
|
),
|
|
3177
|
-
/* @__PURE__ */
|
|
3178
|
-
/* @__PURE__ */
|
|
3179
|
-
/* @__PURE__ */
|
|
3180
|
-
/* @__PURE__ */
|
|
3181
|
-
/* @__PURE__ */
|
|
3182
|
-
/* @__PURE__ */
|
|
3398
|
+
/* @__PURE__ */ jsx14(Dialog6, { open: showCreateDialog, onOpenChange: setShowCreateDialog, children: /* @__PURE__ */ jsxs12(DialogContent6, { children: [
|
|
3399
|
+
/* @__PURE__ */ jsx14(DialogHeader6, { children: /* @__PURE__ */ jsx14(DialogTitle6, { children: "Nova Credencial" }) }),
|
|
3400
|
+
/* @__PURE__ */ jsxs12("div", { className: "space-y-4", children: [
|
|
3401
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
|
3402
|
+
/* @__PURE__ */ jsx14("label", { className: "mb-1 block text-sm font-medium", children: "Ferramenta *" }),
|
|
3403
|
+
/* @__PURE__ */ jsxs12(
|
|
3183
3404
|
Select3,
|
|
3184
3405
|
{
|
|
3185
3406
|
value: createForm.id_tool,
|
|
3186
3407
|
onValueChange: (val) => setCreateForm((f) => ({ ...f, id_tool: val })),
|
|
3187
3408
|
children: [
|
|
3188
|
-
/* @__PURE__ */
|
|
3189
|
-
/* @__PURE__ */
|
|
3409
|
+
/* @__PURE__ */ jsx14(SelectTrigger3, { children: /* @__PURE__ */ jsx14(SelectValue3, { placeholder: "Selecione a ferramenta" }) }),
|
|
3410
|
+
/* @__PURE__ */ jsx14(SelectContent3, { children: tools.map((tool) => /* @__PURE__ */ jsx14(SelectItem3, { value: String(tool.id), children: tool.name }, tool.id)) })
|
|
3190
3411
|
]
|
|
3191
3412
|
}
|
|
3192
3413
|
)
|
|
3193
3414
|
] }),
|
|
3194
|
-
/* @__PURE__ */
|
|
3195
|
-
/* @__PURE__ */
|
|
3196
|
-
/* @__PURE__ */
|
|
3415
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
|
3416
|
+
/* @__PURE__ */ jsx14("label", { className: "mb-1 block text-sm font-medium", children: "Label *" }),
|
|
3417
|
+
/* @__PURE__ */ jsx14(
|
|
3197
3418
|
Input9,
|
|
3198
3419
|
{
|
|
3199
3420
|
value: createForm.label,
|
|
@@ -3202,9 +3423,9 @@ function ToolCredentialsForm({
|
|
|
3202
3423
|
}
|
|
3203
3424
|
)
|
|
3204
3425
|
] }),
|
|
3205
|
-
/* @__PURE__ */
|
|
3206
|
-
/* @__PURE__ */
|
|
3207
|
-
/* @__PURE__ */
|
|
3426
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
|
3427
|
+
/* @__PURE__ */ jsx14("label", { className: "mb-1 block text-sm font-medium", children: "Credencial *" }),
|
|
3428
|
+
/* @__PURE__ */ jsx14(
|
|
3208
3429
|
Input9,
|
|
3209
3430
|
{
|
|
3210
3431
|
type: "password",
|
|
@@ -3217,9 +3438,9 @@ function ToolCredentialsForm({
|
|
|
3217
3438
|
}
|
|
3218
3439
|
)
|
|
3219
3440
|
] }),
|
|
3220
|
-
/* @__PURE__ */
|
|
3221
|
-
/* @__PURE__ */
|
|
3222
|
-
/* @__PURE__ */
|
|
3441
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
|
3442
|
+
/* @__PURE__ */ jsx14("label", { className: "mb-1 block text-sm font-medium", children: "Data de Expira\xE7\xE3o (opcional)" }),
|
|
3443
|
+
/* @__PURE__ */ jsx14(
|
|
3223
3444
|
Input9,
|
|
3224
3445
|
{
|
|
3225
3446
|
type: "date",
|
|
@@ -3229,17 +3450,17 @@ function ToolCredentialsForm({
|
|
|
3229
3450
|
)
|
|
3230
3451
|
] })
|
|
3231
3452
|
] }),
|
|
3232
|
-
/* @__PURE__ */
|
|
3233
|
-
/* @__PURE__ */
|
|
3234
|
-
|
|
3453
|
+
/* @__PURE__ */ jsxs12(DialogFooter6, { children: [
|
|
3454
|
+
/* @__PURE__ */ jsx14(
|
|
3455
|
+
Button10,
|
|
3235
3456
|
{
|
|
3236
3457
|
variant: "outline",
|
|
3237
3458
|
onClick: () => setShowCreateDialog(false),
|
|
3238
3459
|
children: "Cancelar"
|
|
3239
3460
|
}
|
|
3240
3461
|
),
|
|
3241
|
-
/* @__PURE__ */
|
|
3242
|
-
|
|
3462
|
+
/* @__PURE__ */ jsx14(
|
|
3463
|
+
Button10,
|
|
3243
3464
|
{
|
|
3244
3465
|
onClick: handleCreate,
|
|
3245
3466
|
disabled: !createForm.id_tool || !createForm.label.trim() || !createForm.credentials_encrypted.trim() || createMutation.isPending,
|
|
@@ -3248,31 +3469,31 @@ function ToolCredentialsForm({
|
|
|
3248
3469
|
)
|
|
3249
3470
|
] })
|
|
3250
3471
|
] }) }),
|
|
3251
|
-
/* @__PURE__ */
|
|
3472
|
+
/* @__PURE__ */ jsx14(
|
|
3252
3473
|
Dialog6,
|
|
3253
3474
|
{
|
|
3254
3475
|
open: !!editTarget,
|
|
3255
3476
|
onOpenChange: (open) => !open && setEditTarget(null),
|
|
3256
|
-
children: /* @__PURE__ */
|
|
3257
|
-
/* @__PURE__ */
|
|
3258
|
-
/* @__PURE__ */
|
|
3259
|
-
/* @__PURE__ */
|
|
3260
|
-
/* @__PURE__ */
|
|
3261
|
-
/* @__PURE__ */
|
|
3477
|
+
children: /* @__PURE__ */ jsxs12(DialogContent6, { children: [
|
|
3478
|
+
/* @__PURE__ */ jsx14(DialogHeader6, { children: /* @__PURE__ */ jsx14(DialogTitle6, { children: "Editar Credencial" }) }),
|
|
3479
|
+
/* @__PURE__ */ jsxs12("div", { className: "space-y-4", children: [
|
|
3480
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
|
3481
|
+
/* @__PURE__ */ jsx14("label", { className: "mb-1 block text-sm font-medium", children: "Ferramenta *" }),
|
|
3482
|
+
/* @__PURE__ */ jsxs12(
|
|
3262
3483
|
Select3,
|
|
3263
3484
|
{
|
|
3264
3485
|
value: editForm.id_tool,
|
|
3265
3486
|
onValueChange: (val) => setEditForm((f) => ({ ...f, id_tool: val })),
|
|
3266
3487
|
children: [
|
|
3267
|
-
/* @__PURE__ */
|
|
3268
|
-
/* @__PURE__ */
|
|
3488
|
+
/* @__PURE__ */ jsx14(SelectTrigger3, { children: /* @__PURE__ */ jsx14(SelectValue3, { placeholder: "Selecione a ferramenta" }) }),
|
|
3489
|
+
/* @__PURE__ */ jsx14(SelectContent3, { children: tools.map((tool) => /* @__PURE__ */ jsx14(SelectItem3, { value: String(tool.id), children: tool.name }, tool.id)) })
|
|
3269
3490
|
]
|
|
3270
3491
|
}
|
|
3271
3492
|
)
|
|
3272
3493
|
] }),
|
|
3273
|
-
/* @__PURE__ */
|
|
3274
|
-
/* @__PURE__ */
|
|
3275
|
-
/* @__PURE__ */
|
|
3494
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
|
3495
|
+
/* @__PURE__ */ jsx14("label", { className: "mb-1 block text-sm font-medium", children: "Label" }),
|
|
3496
|
+
/* @__PURE__ */ jsx14(
|
|
3276
3497
|
Input9,
|
|
3277
3498
|
{
|
|
3278
3499
|
value: editForm.label,
|
|
@@ -3281,9 +3502,9 @@ function ToolCredentialsForm({
|
|
|
3281
3502
|
}
|
|
3282
3503
|
)
|
|
3283
3504
|
] }),
|
|
3284
|
-
/* @__PURE__ */
|
|
3285
|
-
/* @__PURE__ */
|
|
3286
|
-
/* @__PURE__ */
|
|
3505
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
|
3506
|
+
/* @__PURE__ */ jsx14("label", { className: "mb-1 block text-sm font-medium", children: "Nova Credencial (vazio = manter atual)" }),
|
|
3507
|
+
/* @__PURE__ */ jsx14(
|
|
3287
3508
|
Input9,
|
|
3288
3509
|
{
|
|
3289
3510
|
type: "password",
|
|
@@ -3296,9 +3517,9 @@ function ToolCredentialsForm({
|
|
|
3296
3517
|
}
|
|
3297
3518
|
)
|
|
3298
3519
|
] }),
|
|
3299
|
-
/* @__PURE__ */
|
|
3300
|
-
/* @__PURE__ */
|
|
3301
|
-
/* @__PURE__ */
|
|
3520
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
|
3521
|
+
/* @__PURE__ */ jsx14("label", { className: "mb-1 block text-sm font-medium", children: "Data de Expira\xE7\xE3o" }),
|
|
3522
|
+
/* @__PURE__ */ jsx14(
|
|
3302
3523
|
Input9,
|
|
3303
3524
|
{
|
|
3304
3525
|
type: "date",
|
|
@@ -3307,9 +3528,9 @@ function ToolCredentialsForm({
|
|
|
3307
3528
|
}
|
|
3308
3529
|
)
|
|
3309
3530
|
] }),
|
|
3310
|
-
/* @__PURE__ */
|
|
3311
|
-
/* @__PURE__ */
|
|
3312
|
-
/* @__PURE__ */
|
|
3531
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
|
3532
|
+
/* @__PURE__ */ jsx14("label", { className: "mb-1 block text-sm font-medium", children: "Status" }),
|
|
3533
|
+
/* @__PURE__ */ jsxs12(
|
|
3313
3534
|
Select3,
|
|
3314
3535
|
{
|
|
3315
3536
|
value: editForm.status || void 0,
|
|
@@ -3318,20 +3539,20 @@ function ToolCredentialsForm({
|
|
|
3318
3539
|
status: val
|
|
3319
3540
|
})),
|
|
3320
3541
|
children: [
|
|
3321
|
-
/* @__PURE__ */
|
|
3322
|
-
/* @__PURE__ */
|
|
3323
|
-
/* @__PURE__ */
|
|
3324
|
-
/* @__PURE__ */
|
|
3542
|
+
/* @__PURE__ */ jsx14(SelectTrigger3, { children: /* @__PURE__ */ jsx14(SelectValue3, {}) }),
|
|
3543
|
+
/* @__PURE__ */ jsxs12(SelectContent3, { children: [
|
|
3544
|
+
/* @__PURE__ */ jsx14(SelectItem3, { value: "active", children: "Ativo" }),
|
|
3545
|
+
/* @__PURE__ */ jsx14(SelectItem3, { value: "expired", children: "Expirado" })
|
|
3325
3546
|
] })
|
|
3326
3547
|
]
|
|
3327
3548
|
}
|
|
3328
3549
|
)
|
|
3329
3550
|
] })
|
|
3330
3551
|
] }),
|
|
3331
|
-
/* @__PURE__ */
|
|
3332
|
-
/* @__PURE__ */
|
|
3333
|
-
/* @__PURE__ */
|
|
3334
|
-
|
|
3552
|
+
/* @__PURE__ */ jsxs12(DialogFooter6, { children: [
|
|
3553
|
+
/* @__PURE__ */ jsx14(Button10, { variant: "outline", onClick: () => setEditTarget(null), children: "Cancelar" }),
|
|
3554
|
+
/* @__PURE__ */ jsx14(
|
|
3555
|
+
Button10,
|
|
3335
3556
|
{
|
|
3336
3557
|
onClick: handleSaveEdit,
|
|
3337
3558
|
disabled: updateMutation.isPending,
|
|
@@ -3342,19 +3563,19 @@ function ToolCredentialsForm({
|
|
|
3342
3563
|
] })
|
|
3343
3564
|
}
|
|
3344
3565
|
),
|
|
3345
|
-
/* @__PURE__ */
|
|
3566
|
+
/* @__PURE__ */ jsx14(
|
|
3346
3567
|
AlertDialog5,
|
|
3347
3568
|
{
|
|
3348
3569
|
open: !!removeTarget,
|
|
3349
3570
|
onOpenChange: (open) => !open && setRemoveTarget(null),
|
|
3350
|
-
children: /* @__PURE__ */
|
|
3351
|
-
/* @__PURE__ */
|
|
3352
|
-
/* @__PURE__ */
|
|
3353
|
-
/* @__PURE__ */
|
|
3571
|
+
children: /* @__PURE__ */ jsxs12(AlertDialogContent5, { children: [
|
|
3572
|
+
/* @__PURE__ */ jsxs12(AlertDialogHeader5, { children: [
|
|
3573
|
+
/* @__PURE__ */ jsx14(AlertDialogTitle5, { children: "Remover credencial?" }),
|
|
3574
|
+
/* @__PURE__ */ jsx14(AlertDialogDescription5, { children: "A credencial ser\xE1 removida permanentemente." })
|
|
3354
3575
|
] }),
|
|
3355
|
-
/* @__PURE__ */
|
|
3356
|
-
/* @__PURE__ */
|
|
3357
|
-
/* @__PURE__ */
|
|
3576
|
+
/* @__PURE__ */ jsxs12(AlertDialogFooter5, { children: [
|
|
3577
|
+
/* @__PURE__ */ jsx14(AlertDialogCancel5, { children: "Cancelar" }),
|
|
3578
|
+
/* @__PURE__ */ jsx14(
|
|
3358
3579
|
AlertDialogAction5,
|
|
3359
3580
|
{
|
|
3360
3581
|
onClick: handleRemove,
|
|
@@ -3370,30 +3591,30 @@ function ToolCredentialsForm({
|
|
|
3370
3591
|
}
|
|
3371
3592
|
|
|
3372
3593
|
// src/pages/agents-page.tsx
|
|
3373
|
-
import { useState as
|
|
3374
|
-
import { Button as
|
|
3594
|
+
import { useState as useState12 } from "react";
|
|
3595
|
+
import { Button as Button11 } from "@greatapps/greatauth-ui/ui";
|
|
3375
3596
|
import { Plus as Plus3 } from "lucide-react";
|
|
3376
|
-
import { jsx as
|
|
3597
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3377
3598
|
function AgentsPage({
|
|
3378
3599
|
config,
|
|
3379
3600
|
onNavigateToAgent,
|
|
3380
3601
|
title = "Agentes AI",
|
|
3381
3602
|
subtitle = "Gerencie seus agentes de atendimento inteligente"
|
|
3382
3603
|
}) {
|
|
3383
|
-
const [createOpen, setCreateOpen] =
|
|
3384
|
-
return /* @__PURE__ */
|
|
3385
|
-
/* @__PURE__ */
|
|
3386
|
-
/* @__PURE__ */
|
|
3387
|
-
/* @__PURE__ */
|
|
3388
|
-
/* @__PURE__ */
|
|
3604
|
+
const [createOpen, setCreateOpen] = useState12(false);
|
|
3605
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-4 p-4", children: [
|
|
3606
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between", children: [
|
|
3607
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
3608
|
+
/* @__PURE__ */ jsx15("h1", { className: "text-xl font-semibold", children: title }),
|
|
3609
|
+
/* @__PURE__ */ jsx15("p", { className: "text-sm text-muted-foreground", children: subtitle })
|
|
3389
3610
|
] }),
|
|
3390
|
-
/* @__PURE__ */
|
|
3391
|
-
/* @__PURE__ */
|
|
3611
|
+
/* @__PURE__ */ jsxs13(Button11, { onClick: () => setCreateOpen(true), size: "sm", children: [
|
|
3612
|
+
/* @__PURE__ */ jsx15(Plus3, { className: "mr-2 h-4 w-4" }),
|
|
3392
3613
|
"Novo Agente"
|
|
3393
3614
|
] })
|
|
3394
3615
|
] }),
|
|
3395
|
-
/* @__PURE__ */
|
|
3396
|
-
/* @__PURE__ */
|
|
3616
|
+
/* @__PURE__ */ jsx15(AgentsTable, { config, onNavigateToAgent }),
|
|
3617
|
+
/* @__PURE__ */ jsx15(
|
|
3397
3618
|
AgentFormDialog,
|
|
3398
3619
|
{
|
|
3399
3620
|
config,
|
|
@@ -3405,54 +3626,54 @@ function AgentsPage({
|
|
|
3405
3626
|
}
|
|
3406
3627
|
|
|
3407
3628
|
// src/pages/agent-detail-page.tsx
|
|
3408
|
-
import { useState as
|
|
3409
|
-
import { Badge as
|
|
3629
|
+
import { useState as useState13 } from "react";
|
|
3630
|
+
import { Badge as Badge8, Button as Button12, Skeleton as Skeleton6 } from "@greatapps/greatauth-ui/ui";
|
|
3410
3631
|
import { EntityAvatar as EntityAvatar2 } from "@greatapps/greatauth-ui";
|
|
3411
3632
|
import { ArrowLeft, Pencil as Pencil5 } from "lucide-react";
|
|
3412
|
-
import { jsx as
|
|
3633
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3413
3634
|
function AgentDetailPage({
|
|
3414
3635
|
config,
|
|
3415
3636
|
agentId,
|
|
3416
3637
|
onBack,
|
|
3417
|
-
|
|
3638
|
+
renderChatLink
|
|
3418
3639
|
}) {
|
|
3419
3640
|
const { data: agent, isLoading } = useAgent(config, agentId);
|
|
3420
|
-
const [editOpen, setEditOpen] =
|
|
3641
|
+
const [editOpen, setEditOpen] = useState13(false);
|
|
3421
3642
|
if (isLoading) {
|
|
3422
|
-
return /* @__PURE__ */
|
|
3423
|
-
/* @__PURE__ */
|
|
3424
|
-
/* @__PURE__ */
|
|
3425
|
-
/* @__PURE__ */
|
|
3426
|
-
/* @__PURE__ */
|
|
3643
|
+
return /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-4 p-4", children: [
|
|
3644
|
+
/* @__PURE__ */ jsx16(Skeleton6, { className: "h-4 w-32" }),
|
|
3645
|
+
/* @__PURE__ */ jsx16(Skeleton6, { className: "h-8 w-48" }),
|
|
3646
|
+
/* @__PURE__ */ jsx16(Skeleton6, { className: "h-10 w-full" }),
|
|
3647
|
+
/* @__PURE__ */ jsx16(Skeleton6, { className: "h-64 w-full" })
|
|
3427
3648
|
] });
|
|
3428
3649
|
}
|
|
3429
3650
|
if (!agent) {
|
|
3430
|
-
return /* @__PURE__ */
|
|
3431
|
-
/* @__PURE__ */
|
|
3432
|
-
onBack && /* @__PURE__ */
|
|
3433
|
-
/* @__PURE__ */
|
|
3651
|
+
return /* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center justify-center gap-2 p-8", children: [
|
|
3652
|
+
/* @__PURE__ */ jsx16("p", { className: "text-muted-foreground", children: "Agente n\xE3o encontrado" }),
|
|
3653
|
+
onBack && /* @__PURE__ */ jsxs14(Button12, { variant: "ghost", size: "sm", onClick: onBack, children: [
|
|
3654
|
+
/* @__PURE__ */ jsx16(ArrowLeft, { className: "mr-2 h-4 w-4" }),
|
|
3434
3655
|
"Voltar para agentes"
|
|
3435
3656
|
] })
|
|
3436
3657
|
] });
|
|
3437
3658
|
}
|
|
3438
|
-
return /* @__PURE__ */
|
|
3439
|
-
/* @__PURE__ */
|
|
3440
|
-
/* @__PURE__ */
|
|
3441
|
-
onBack && /* @__PURE__ */
|
|
3442
|
-
|
|
3659
|
+
return /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-6 p-4", children: [
|
|
3660
|
+
/* @__PURE__ */ jsx16("div", { className: "rounded-lg border p-4 md:p-6", children: /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-4 md:flex-row md:items-start md:gap-6", children: [
|
|
3661
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-start gap-3 flex-1", children: [
|
|
3662
|
+
onBack && /* @__PURE__ */ jsx16(
|
|
3663
|
+
Button12,
|
|
3443
3664
|
{
|
|
3444
3665
|
variant: "ghost",
|
|
3445
3666
|
size: "icon",
|
|
3446
3667
|
className: "shrink-0 mt-1",
|
|
3447
3668
|
onClick: onBack,
|
|
3448
|
-
children: /* @__PURE__ */
|
|
3669
|
+
children: /* @__PURE__ */ jsx16(ArrowLeft, { className: "h-4 w-4" })
|
|
3449
3670
|
}
|
|
3450
3671
|
),
|
|
3451
|
-
/* @__PURE__ */
|
|
3452
|
-
/* @__PURE__ */
|
|
3453
|
-
/* @__PURE__ */
|
|
3454
|
-
/* @__PURE__ */
|
|
3455
|
-
|
|
3672
|
+
/* @__PURE__ */ jsx16(EntityAvatar2, { photo: agent.photo, name: agent.title, size: "xl" }),
|
|
3673
|
+
/* @__PURE__ */ jsx16("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
3674
|
+
/* @__PURE__ */ jsx16("h1", { className: "text-xl font-semibold", children: agent.title }),
|
|
3675
|
+
/* @__PURE__ */ jsx16(
|
|
3676
|
+
Badge8,
|
|
3456
3677
|
{
|
|
3457
3678
|
variant: agent.active ? "default" : "destructive",
|
|
3458
3679
|
className: "text-xs",
|
|
@@ -3461,29 +3682,29 @@ function AgentDetailPage({
|
|
|
3461
3682
|
)
|
|
3462
3683
|
] }) })
|
|
3463
3684
|
] }),
|
|
3464
|
-
/* @__PURE__ */
|
|
3465
|
-
|
|
3685
|
+
/* @__PURE__ */ jsxs14(
|
|
3686
|
+
Button12,
|
|
3466
3687
|
{
|
|
3467
3688
|
variant: "outline",
|
|
3468
3689
|
size: "sm",
|
|
3469
3690
|
className: "shrink-0 self-start",
|
|
3470
3691
|
onClick: () => setEditOpen(true),
|
|
3471
3692
|
children: [
|
|
3472
|
-
/* @__PURE__ */
|
|
3693
|
+
/* @__PURE__ */ jsx16(Pencil5, { className: "mr-2 h-4 w-4" }),
|
|
3473
3694
|
"Editar"
|
|
3474
3695
|
]
|
|
3475
3696
|
}
|
|
3476
3697
|
)
|
|
3477
3698
|
] }) }),
|
|
3478
|
-
/* @__PURE__ */
|
|
3699
|
+
/* @__PURE__ */ jsx16(
|
|
3479
3700
|
AgentTabs,
|
|
3480
3701
|
{
|
|
3481
3702
|
agent,
|
|
3482
3703
|
config,
|
|
3483
|
-
|
|
3704
|
+
renderChatLink
|
|
3484
3705
|
}
|
|
3485
3706
|
),
|
|
3486
|
-
editOpen && /* @__PURE__ */
|
|
3707
|
+
editOpen && /* @__PURE__ */ jsx16(
|
|
3487
3708
|
AgentEditForm,
|
|
3488
3709
|
{
|
|
3489
3710
|
agent,
|
|
@@ -3497,30 +3718,30 @@ function AgentDetailPage({
|
|
|
3497
3718
|
}
|
|
3498
3719
|
|
|
3499
3720
|
// src/pages/tools-page.tsx
|
|
3500
|
-
import { useState as
|
|
3501
|
-
import { Button as
|
|
3721
|
+
import { useState as useState14 } from "react";
|
|
3722
|
+
import { Button as Button13 } from "@greatapps/greatauth-ui/ui";
|
|
3502
3723
|
import { Plus as Plus4 } from "lucide-react";
|
|
3503
|
-
import { jsx as
|
|
3724
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3504
3725
|
function ToolsPage({
|
|
3505
3726
|
config,
|
|
3506
3727
|
title = "Ferramentas",
|
|
3507
3728
|
subtitle = "Gerencie as ferramentas dispon\xEDveis para seus agentes"
|
|
3508
3729
|
}) {
|
|
3509
|
-
const [createOpen, setCreateOpen] =
|
|
3510
|
-
const [editTool, setEditTool] =
|
|
3511
|
-
return /* @__PURE__ */
|
|
3512
|
-
/* @__PURE__ */
|
|
3513
|
-
/* @__PURE__ */
|
|
3514
|
-
/* @__PURE__ */
|
|
3515
|
-
/* @__PURE__ */
|
|
3730
|
+
const [createOpen, setCreateOpen] = useState14(false);
|
|
3731
|
+
const [editTool, setEditTool] = useState14(void 0);
|
|
3732
|
+
return /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-4 p-4", children: [
|
|
3733
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between", children: [
|
|
3734
|
+
/* @__PURE__ */ jsxs15("div", { children: [
|
|
3735
|
+
/* @__PURE__ */ jsx17("h1", { className: "text-xl font-semibold", children: title }),
|
|
3736
|
+
/* @__PURE__ */ jsx17("p", { className: "text-sm text-muted-foreground", children: subtitle })
|
|
3516
3737
|
] }),
|
|
3517
|
-
/* @__PURE__ */
|
|
3518
|
-
/* @__PURE__ */
|
|
3738
|
+
/* @__PURE__ */ jsxs15(Button13, { onClick: () => setCreateOpen(true), size: "sm", children: [
|
|
3739
|
+
/* @__PURE__ */ jsx17(Plus4, { className: "mr-2 h-4 w-4" }),
|
|
3519
3740
|
"Nova Ferramenta"
|
|
3520
3741
|
] })
|
|
3521
3742
|
] }),
|
|
3522
|
-
/* @__PURE__ */
|
|
3523
|
-
/* @__PURE__ */
|
|
3743
|
+
/* @__PURE__ */ jsx17(ToolsTable, { config, onEdit: (tool) => setEditTool(tool) }),
|
|
3744
|
+
/* @__PURE__ */ jsx17(
|
|
3524
3745
|
ToolFormDialog,
|
|
3525
3746
|
{
|
|
3526
3747
|
config,
|
|
@@ -3528,7 +3749,7 @@ function ToolsPage({
|
|
|
3528
3749
|
onOpenChange: setCreateOpen
|
|
3529
3750
|
}
|
|
3530
3751
|
),
|
|
3531
|
-
/* @__PURE__ */
|
|
3752
|
+
/* @__PURE__ */ jsx17(
|
|
3532
3753
|
ToolFormDialog,
|
|
3533
3754
|
{
|
|
3534
3755
|
config,
|
|
@@ -3541,10 +3762,10 @@ function ToolsPage({
|
|
|
3541
3762
|
}
|
|
3542
3763
|
|
|
3543
3764
|
// src/pages/credentials-page.tsx
|
|
3544
|
-
import { useState as
|
|
3545
|
-
import { Button as
|
|
3765
|
+
import { useState as useState15 } from "react";
|
|
3766
|
+
import { Button as Button14 } from "@greatapps/greatauth-ui/ui";
|
|
3546
3767
|
import { Plus as Plus5 } from "lucide-react";
|
|
3547
|
-
import { jsx as
|
|
3768
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3548
3769
|
function CredentialsPage({
|
|
3549
3770
|
config,
|
|
3550
3771
|
gagentsApiUrl,
|
|
@@ -3552,20 +3773,20 @@ function CredentialsPage({
|
|
|
3552
3773
|
subtitle = "Gerencie as credenciais de autentica\xE7\xE3o das ferramentas"
|
|
3553
3774
|
}) {
|
|
3554
3775
|
const { data: credentialsData, isLoading: credentialsLoading } = useToolCredentials(config);
|
|
3555
|
-
const [createOpen, setCreateOpen] =
|
|
3776
|
+
const [createOpen, setCreateOpen] = useState15(false);
|
|
3556
3777
|
const credentials = credentialsData?.data || [];
|
|
3557
|
-
return /* @__PURE__ */
|
|
3558
|
-
/* @__PURE__ */
|
|
3559
|
-
/* @__PURE__ */
|
|
3560
|
-
/* @__PURE__ */
|
|
3561
|
-
/* @__PURE__ */
|
|
3778
|
+
return /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-4 p-4", children: [
|
|
3779
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center justify-between", children: [
|
|
3780
|
+
/* @__PURE__ */ jsxs16("div", { children: [
|
|
3781
|
+
/* @__PURE__ */ jsx18("h1", { className: "text-xl font-semibold", children: title }),
|
|
3782
|
+
/* @__PURE__ */ jsx18("p", { className: "text-sm text-muted-foreground", children: subtitle })
|
|
3562
3783
|
] }),
|
|
3563
|
-
/* @__PURE__ */
|
|
3564
|
-
/* @__PURE__ */
|
|
3784
|
+
/* @__PURE__ */ jsxs16(Button14, { onClick: () => setCreateOpen(true), size: "sm", children: [
|
|
3785
|
+
/* @__PURE__ */ jsx18(Plus5, { className: "mr-2 h-4 w-4" }),
|
|
3565
3786
|
"Nova Credencial"
|
|
3566
3787
|
] })
|
|
3567
3788
|
] }),
|
|
3568
|
-
/* @__PURE__ */
|
|
3789
|
+
/* @__PURE__ */ jsx18(
|
|
3569
3790
|
ToolCredentialsForm,
|
|
3570
3791
|
{
|
|
3571
3792
|
config,
|
|
@@ -3579,6 +3800,8 @@ function CredentialsPage({
|
|
|
3579
3800
|
] });
|
|
3580
3801
|
}
|
|
3581
3802
|
export {
|
|
3803
|
+
AgentConversationsPanel,
|
|
3804
|
+
AgentConversationsTable,
|
|
3582
3805
|
AgentDetailPage,
|
|
3583
3806
|
AgentEditForm,
|
|
3584
3807
|
AgentFormDialog,
|
|
@@ -3588,6 +3811,7 @@ export {
|
|
|
3588
3811
|
AgentToolsList,
|
|
3589
3812
|
AgentsPage,
|
|
3590
3813
|
AgentsTable,
|
|
3814
|
+
ConversationView,
|
|
3591
3815
|
CredentialsPage,
|
|
3592
3816
|
Sortable,
|
|
3593
3817
|
SortableContent,
|