@greatapps/greatagents-ui 0.3.22 → 0.3.23
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.js +122 -123
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/agents/agent-definition-editor.tsx +47 -42
- package/src/components/agents/agent-edit-form.tsx +14 -14
- package/src/components/agents/agent-form-dialog.tsx +15 -15
- package/src/components/agents/agent-objectives-list.tsx +16 -16
package/dist/index.js
CHANGED
|
@@ -756,11 +756,11 @@ function AgentsTable({ config, onNavigateToAgent }) {
|
|
|
756
756
|
// src/components/agents/agent-form-dialog.tsx
|
|
757
757
|
import { useEffect, useState as useState2 } from "react";
|
|
758
758
|
import {
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
759
|
+
Sheet,
|
|
760
|
+
SheetContent,
|
|
761
|
+
SheetHeader,
|
|
762
|
+
SheetTitle,
|
|
763
|
+
SheetFooter,
|
|
764
764
|
Button as Button2,
|
|
765
765
|
Input as Input2,
|
|
766
766
|
Label,
|
|
@@ -852,8 +852,8 @@ function AgentFormDialog({
|
|
|
852
852
|
toast2.error(isEditing ? "Erro ao atualizar agente" : "Erro ao criar agente");
|
|
853
853
|
}
|
|
854
854
|
}
|
|
855
|
-
return /* @__PURE__ */ jsx2(
|
|
856
|
-
/* @__PURE__ */ jsx2(
|
|
855
|
+
return /* @__PURE__ */ jsx2(Sheet, { open, onOpenChange, children: /* @__PURE__ */ jsxs2(SheetContent, { className: "sm:max-w-lg overflow-y-auto", children: [
|
|
856
|
+
/* @__PURE__ */ jsx2(SheetHeader, { children: /* @__PURE__ */ jsx2(SheetTitle, { children: isEditing ? "Editar Agente" : "Novo Agente" }) }),
|
|
857
857
|
/* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
|
|
858
858
|
/* @__PURE__ */ jsx2("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx2(
|
|
859
859
|
ImageCropUpload,
|
|
@@ -940,7 +940,7 @@ function AgentFormDialog({
|
|
|
940
940
|
/* @__PURE__ */ jsx2("p", { className: "text-xs text-muted-foreground", children: "Espera por mensagens agrupadas" })
|
|
941
941
|
] })
|
|
942
942
|
] }),
|
|
943
|
-
/* @__PURE__ */ jsxs2(
|
|
943
|
+
/* @__PURE__ */ jsxs2(SheetFooter, { children: [
|
|
944
944
|
/* @__PURE__ */ jsx2(
|
|
945
945
|
Button2,
|
|
946
946
|
{
|
|
@@ -967,11 +967,11 @@ import {
|
|
|
967
967
|
Input as Input3,
|
|
968
968
|
Label as Label2,
|
|
969
969
|
Switch as Switch2,
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
970
|
+
Sheet as Sheet2,
|
|
971
|
+
SheetContent as SheetContent2,
|
|
972
|
+
SheetHeader as SheetHeader2,
|
|
973
|
+
SheetTitle as SheetTitle2,
|
|
974
|
+
SheetFooter as SheetFooter2
|
|
975
975
|
} from "@greatapps/greatauth-ui/ui";
|
|
976
976
|
import { Loader2 as Loader22 } from "lucide-react";
|
|
977
977
|
import { toast as toast3 } from "sonner";
|
|
@@ -1116,7 +1116,7 @@ function AgentEditForm({ config, agent, idAccount, open, onOpenChange }) {
|
|
|
1116
1116
|
/* @__PURE__ */ jsx3("p", { className: "text-xs text-muted-foreground", children: "Espera por mensagens agrupadas" })
|
|
1117
1117
|
] })
|
|
1118
1118
|
] }),
|
|
1119
|
-
/* @__PURE__ */ jsxs3(
|
|
1119
|
+
/* @__PURE__ */ jsxs3(SheetFooter2, { children: [
|
|
1120
1120
|
/* @__PURE__ */ jsx3(
|
|
1121
1121
|
Button3,
|
|
1122
1122
|
{
|
|
@@ -1134,8 +1134,8 @@ function AgentEditForm({ config, agent, idAccount, open, onOpenChange }) {
|
|
|
1134
1134
|
] })
|
|
1135
1135
|
] });
|
|
1136
1136
|
if (open !== void 0 && onOpenChange) {
|
|
1137
|
-
return /* @__PURE__ */ jsx3(
|
|
1138
|
-
/* @__PURE__ */ jsx3(
|
|
1137
|
+
return /* @__PURE__ */ jsx3(Sheet2, { open, onOpenChange, children: /* @__PURE__ */ jsxs3(SheetContent2, { className: "sm:max-w-md overflow-y-auto", children: [
|
|
1138
|
+
/* @__PURE__ */ jsx3(SheetHeader2, { children: /* @__PURE__ */ jsx3(SheetTitle2, { children: "Editar Agente" }) }),
|
|
1139
1139
|
formContent
|
|
1140
1140
|
] }) });
|
|
1141
1141
|
}
|
|
@@ -1152,11 +1152,11 @@ import {
|
|
|
1152
1152
|
Textarea,
|
|
1153
1153
|
Label as Label3,
|
|
1154
1154
|
Badge as Badge2,
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1155
|
+
Sheet as Sheet3,
|
|
1156
|
+
SheetContent as SheetContent3,
|
|
1157
|
+
SheetHeader as SheetHeader3,
|
|
1158
|
+
SheetTitle as SheetTitle3,
|
|
1159
|
+
SheetFooter as SheetFooter3,
|
|
1160
1160
|
AlertDialog as AlertDialog2,
|
|
1161
1161
|
AlertDialogAction as AlertDialogAction2,
|
|
1162
1162
|
AlertDialogCancel as AlertDialogCancel2,
|
|
@@ -1989,8 +1989,8 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
1989
1989
|
]
|
|
1990
1990
|
}
|
|
1991
1991
|
),
|
|
1992
|
-
/* @__PURE__ */ jsx6(
|
|
1993
|
-
/* @__PURE__ */ jsx6(
|
|
1992
|
+
/* @__PURE__ */ jsx6(Sheet3, { open: formOpen, onOpenChange: setFormOpen, children: /* @__PURE__ */ jsxs5(SheetContent3, { className: "sm:max-w-lg overflow-y-auto", children: [
|
|
1993
|
+
/* @__PURE__ */ jsx6(SheetHeader3, { children: /* @__PURE__ */ jsx6(SheetTitle3, { children: editTarget ? "Editar Objetivo" : "Novo Objetivo" }) }),
|
|
1994
1994
|
/* @__PURE__ */ jsxs5("div", { className: "space-y-4", children: [
|
|
1995
1995
|
/* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
|
|
1996
1996
|
/* @__PURE__ */ jsx6(Label3, { htmlFor: "objective-title", children: "T\xEDtulo *" }),
|
|
@@ -2086,7 +2086,7 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
2086
2086
|
/* @__PURE__ */ jsx6("p", { className: "text-xs text-muted-foreground", children: "Restri\xE7\xF5es e limites espec\xEDficos quando este objectivo est\xE1 activo." })
|
|
2087
2087
|
] })
|
|
2088
2088
|
] }),
|
|
2089
|
-
/* @__PURE__ */ jsxs5(
|
|
2089
|
+
/* @__PURE__ */ jsxs5(SheetFooter3, { children: [
|
|
2090
2090
|
/* @__PURE__ */ jsx6(
|
|
2091
2091
|
Button5,
|
|
2092
2092
|
{
|
|
@@ -2133,8 +2133,8 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
2133
2133
|
}
|
|
2134
2134
|
|
|
2135
2135
|
// src/components/agents/agent-definition-editor.tsx
|
|
2136
|
-
import { useState as useState7, useRef as useRef2, useCallback as useCallback4, useEffect as useEffect3 } from "react";
|
|
2137
|
-
import { Button as Button6,
|
|
2136
|
+
import { useState as useState7, useRef as useRef2, useCallback as useCallback4, useEffect as useEffect3, useMemo as useMemo5 } from "react";
|
|
2137
|
+
import { Button as Button6, Label as Label4 } from "@greatapps/greatauth-ui/ui";
|
|
2138
2138
|
import { Loader2 as Loader23 } from "lucide-react";
|
|
2139
2139
|
import { toast as toast5 } from "sonner";
|
|
2140
2140
|
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
@@ -2145,7 +2145,8 @@ var SECTIONS = [
|
|
|
2145
2145
|
helper: "Descreva quem \xE9 o agente, o seu nome e personalidade",
|
|
2146
2146
|
required: true,
|
|
2147
2147
|
field: "identity",
|
|
2148
|
-
type: "textarea"
|
|
2148
|
+
type: "textarea",
|
|
2149
|
+
placeholder: "Voc\xEA \xE9 a Ana, assistente virtual da Cl\xEDnica Sa\xFAde & Bem-Estar. Voc\xEA \xE9 simp\xE1tica, profissional e sempre disposta a ajudar os pacientes..."
|
|
2149
2150
|
},
|
|
2150
2151
|
{
|
|
2151
2152
|
key: "mission",
|
|
@@ -2153,7 +2154,8 @@ var SECTIONS = [
|
|
|
2153
2154
|
helper: "Qual \xE9 a miss\xE3o principal deste agente",
|
|
2154
2155
|
required: true,
|
|
2155
2156
|
field: "mission",
|
|
2156
|
-
type: "textarea"
|
|
2157
|
+
type: "textarea",
|
|
2158
|
+
placeholder: "Sua miss\xE3o \xE9 ajudar pacientes a agendar consultas, tirar d\xFAvidas sobre hor\xE1rios e especialidades, e fornecer informa\xE7\xF5es sobre a cl\xEDnica..."
|
|
2157
2159
|
},
|
|
2158
2160
|
{
|
|
2159
2161
|
key: "tone_style_format",
|
|
@@ -2161,7 +2163,8 @@ var SECTIONS = [
|
|
|
2161
2163
|
helper: "Defina como o agente comunica e formata as respostas",
|
|
2162
2164
|
required: false,
|
|
2163
2165
|
field: "tone_style_format",
|
|
2164
|
-
type: "textarea"
|
|
2166
|
+
type: "textarea",
|
|
2167
|
+
placeholder: "Use tom emp\xE1tico e acolhedor. Responda de forma clara e objetiva, em no m\xE1ximo 3 par\xE1grafos. Use listas quando houver m\xFAltiplas op\xE7\xF5es..."
|
|
2165
2168
|
},
|
|
2166
2169
|
{
|
|
2167
2170
|
key: "rules",
|
|
@@ -2169,7 +2172,8 @@ var SECTIONS = [
|
|
|
2169
2172
|
helper: "Limites, restri\xE7\xF5es e comportamentos obrigat\xF3rios",
|
|
2170
2173
|
required: false,
|
|
2171
2174
|
field: "rules",
|
|
2172
|
-
type: "textarea"
|
|
2175
|
+
type: "textarea",
|
|
2176
|
+
placeholder: "Nunca forne\xE7a diagn\xF3sticos m\xE9dicos. Sempre recomende consulta presencial para urg\xEAncias. N\xE3o agende consultas fora do hor\xE1rio de funcionamento (08h-18h)..."
|
|
2173
2177
|
},
|
|
2174
2178
|
{
|
|
2175
2179
|
key: "conversation_flow",
|
|
@@ -2177,7 +2181,8 @@ var SECTIONS = [
|
|
|
2177
2181
|
helper: "Etapas que o agente segue no in\xEDcio de cada conversa",
|
|
2178
2182
|
required: false,
|
|
2179
2183
|
field: "conversation_flow",
|
|
2180
|
-
type: "conversation_flow"
|
|
2184
|
+
type: "conversation_flow",
|
|
2185
|
+
placeholder: ""
|
|
2181
2186
|
},
|
|
2182
2187
|
{
|
|
2183
2188
|
key: "context",
|
|
@@ -2185,7 +2190,8 @@ var SECTIONS = [
|
|
|
2185
2190
|
helper: "Informa\xE7\xF5es adicionais que o agente deve saber",
|
|
2186
2191
|
required: false,
|
|
2187
2192
|
field: "context",
|
|
2188
|
-
type: "textarea"
|
|
2193
|
+
type: "textarea",
|
|
2194
|
+
placeholder: "A cl\xEDnica funciona de segunda a sexta, das 08h \xE0s 18h. Especialidades dispon\xEDveis: Cardiologia, Dermatologia, Ortopedia, Pediatria..."
|
|
2189
2195
|
}
|
|
2190
2196
|
];
|
|
2191
2197
|
function parseConversationFlow(raw) {
|
|
@@ -2262,7 +2268,6 @@ function AgentDefinitionEditor({ agent, config }) {
|
|
|
2262
2268
|
const [conversationFlowSteps, setConversationFlowSteps] = useState7(
|
|
2263
2269
|
() => parseConversationFlow(agent.conversation_flow)
|
|
2264
2270
|
);
|
|
2265
|
-
const [changeNotes, setChangeNotes] = useState7("");
|
|
2266
2271
|
if (trackedAgentId !== agent.id) {
|
|
2267
2272
|
setTrackedAgentId(agent.id);
|
|
2268
2273
|
setFields({
|
|
@@ -2273,12 +2278,31 @@ function AgentDefinitionEditor({ agent, config }) {
|
|
|
2273
2278
|
context: agent.context ?? ""
|
|
2274
2279
|
});
|
|
2275
2280
|
setConversationFlowSteps(parseConversationFlow(agent.conversation_flow));
|
|
2276
|
-
setChangeNotes("");
|
|
2277
2281
|
}
|
|
2278
2282
|
function updateField(key, value) {
|
|
2279
2283
|
setFields((prev) => ({ ...prev, [key]: value }));
|
|
2280
2284
|
}
|
|
2281
2285
|
const { chars, tokens } = computeTotals(fields, conversationFlowSteps);
|
|
2286
|
+
const hasChanges = useMemo5(() => {
|
|
2287
|
+
if (fields.identity !== (agent.identity ?? "")) return true;
|
|
2288
|
+
if (fields.mission !== (agent.mission ?? "")) return true;
|
|
2289
|
+
if (fields.tone_style_format !== (agent.tone_style_format ?? "")) return true;
|
|
2290
|
+
if (fields.rules !== (agent.rules ?? "")) return true;
|
|
2291
|
+
if (fields.context !== (agent.context ?? "")) return true;
|
|
2292
|
+
const originalSteps = parseConversationFlow(agent.conversation_flow);
|
|
2293
|
+
if (JSON.stringify(conversationFlowSteps) !== JSON.stringify(originalSteps)) return true;
|
|
2294
|
+
return false;
|
|
2295
|
+
}, [fields, conversationFlowSteps, agent]);
|
|
2296
|
+
function discard() {
|
|
2297
|
+
setFields({
|
|
2298
|
+
identity: agent.identity ?? "",
|
|
2299
|
+
mission: agent.mission ?? "",
|
|
2300
|
+
tone_style_format: agent.tone_style_format ?? "",
|
|
2301
|
+
rules: agent.rules ?? "",
|
|
2302
|
+
context: agent.context ?? ""
|
|
2303
|
+
});
|
|
2304
|
+
setConversationFlowSteps(parseConversationFlow(agent.conversation_flow));
|
|
2305
|
+
}
|
|
2282
2306
|
async function handleSave() {
|
|
2283
2307
|
if (!fields.identity.trim() || !fields.mission.trim()) {
|
|
2284
2308
|
toast5.error("Identidade e Miss\xE3o s\xE3o campos obrigat\xF3rios");
|
|
@@ -2292,12 +2316,8 @@ function AgentDefinitionEditor({ agent, config }) {
|
|
|
2292
2316
|
conversation_flow: conversationFlowSteps.length > 0 ? JSON.stringify(conversationFlowSteps) : null,
|
|
2293
2317
|
context: fields.context.trim() || null
|
|
2294
2318
|
};
|
|
2295
|
-
if (changeNotes.trim()) {
|
|
2296
|
-
body.change_notes = changeNotes.trim();
|
|
2297
|
-
}
|
|
2298
2319
|
try {
|
|
2299
2320
|
await updateAgent.mutateAsync({ id: agent.id, body });
|
|
2300
|
-
setChangeNotes("");
|
|
2301
2321
|
toast5.success("Defini\xE7\xE3o do agente salva com sucesso");
|
|
2302
2322
|
} catch {
|
|
2303
2323
|
toast5.error("Erro ao salvar defini\xE7\xE3o do agente");
|
|
@@ -2316,7 +2336,7 @@ function AgentDefinitionEditor({ agent, config }) {
|
|
|
2316
2336
|
value: fields[section.key] ?? "",
|
|
2317
2337
|
onChange: (v) => updateField(section.key, v),
|
|
2318
2338
|
disabled: updateAgent.isPending,
|
|
2319
|
-
placeholder:
|
|
2339
|
+
placeholder: section.placeholder,
|
|
2320
2340
|
ariaLabel: section.label
|
|
2321
2341
|
}
|
|
2322
2342
|
) : /* @__PURE__ */ jsx7(
|
|
@@ -2340,50 +2360,29 @@ function AgentDefinitionEditor({ agent, config }) {
|
|
|
2340
2360
|
" tokens"
|
|
2341
2361
|
] })
|
|
2342
2362
|
] }),
|
|
2343
|
-
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-3", children: [
|
|
2344
|
-
/* @__PURE__ */ jsx7(
|
|
2345
|
-
|
|
2346
|
-
{
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
disabled: updateAgent.isPending,
|
|
2353
|
-
className: "flex-1",
|
|
2354
|
-
onKeyDown: (e) => {
|
|
2355
|
-
if (e.key === "Enter") {
|
|
2356
|
-
e.preventDefault();
|
|
2357
|
-
handleSave();
|
|
2358
|
-
}
|
|
2359
|
-
}
|
|
2360
|
-
}
|
|
2361
|
-
),
|
|
2362
|
-
/* @__PURE__ */ jsxs6(
|
|
2363
|
-
Button6,
|
|
2364
|
-
{
|
|
2365
|
-
onClick: handleSave,
|
|
2366
|
-
disabled: updateAgent.isPending || !fields.identity.trim() || !fields.mission.trim(),
|
|
2367
|
-
children: [
|
|
2368
|
-
updateAgent.isPending && /* @__PURE__ */ jsx7(Loader23, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
2369
|
-
"Salvar"
|
|
2370
|
-
]
|
|
2371
|
-
}
|
|
2372
|
-
)
|
|
2363
|
+
hasChanges && /* @__PURE__ */ jsxs6("div", { className: "sticky bottom-0 z-10 flex items-center justify-between gap-2 rounded-lg border bg-background p-3 shadow-sm", children: [
|
|
2364
|
+
/* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "Voc\xEA tem altera\xE7\xF5es n\xE3o salvas." }),
|
|
2365
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex gap-2", children: [
|
|
2366
|
+
/* @__PURE__ */ jsx7(Button6, { variant: "ghost", size: "sm", onClick: discard, disabled: updateAgent.isPending, children: "Descartar" }),
|
|
2367
|
+
/* @__PURE__ */ jsxs6(Button6, { size: "sm", onClick: handleSave, disabled: updateAgent.isPending, children: [
|
|
2368
|
+
updateAgent.isPending && /* @__PURE__ */ jsx7(Loader23, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
2369
|
+
"Salvar"
|
|
2370
|
+
] })
|
|
2371
|
+
] })
|
|
2373
2372
|
] })
|
|
2374
2373
|
] });
|
|
2375
2374
|
}
|
|
2376
2375
|
|
|
2377
2376
|
// src/components/agents/agent-revision-tab.tsx
|
|
2378
|
-
import { useState as useState8, useMemo as
|
|
2377
|
+
import { useState as useState8, useMemo as useMemo6 } from "react";
|
|
2379
2378
|
import {
|
|
2380
2379
|
Button as Button7,
|
|
2381
2380
|
Badge as Badge3,
|
|
2382
2381
|
Skeleton as Skeleton2,
|
|
2383
|
-
Dialog
|
|
2384
|
-
DialogContent
|
|
2385
|
-
DialogHeader
|
|
2386
|
-
DialogTitle
|
|
2382
|
+
Dialog,
|
|
2383
|
+
DialogContent,
|
|
2384
|
+
DialogHeader,
|
|
2385
|
+
DialogTitle
|
|
2387
2386
|
} from "@greatapps/greatauth-ui/ui";
|
|
2388
2387
|
import { FileText, RotateCcw, X, AlertTriangle } from "lucide-react";
|
|
2389
2388
|
import { toast as toast6 } from "sonner";
|
|
@@ -2477,7 +2476,7 @@ function AgentRevisionTab({ agent, config }) {
|
|
|
2477
2476
|
(a, b) => new Date(b.datetime_add).getTime() - new Date(a.datetime_add).getTime()
|
|
2478
2477
|
);
|
|
2479
2478
|
const currentVersion = sortedVersions.find((v) => v.is_current) || sortedVersions[0] || null;
|
|
2480
|
-
const assembledPrompt =
|
|
2479
|
+
const assembledPrompt = useMemo6(() => buildAssembledPrompt(agent), [
|
|
2481
2480
|
agent.identity,
|
|
2482
2481
|
agent.mission,
|
|
2483
2482
|
agent.tone_style_format,
|
|
@@ -2629,14 +2628,14 @@ function AgentRevisionTab({ agent, config }) {
|
|
|
2629
2628
|
}) })
|
|
2630
2629
|
] }),
|
|
2631
2630
|
/* @__PURE__ */ jsx8(
|
|
2632
|
-
|
|
2631
|
+
Dialog,
|
|
2633
2632
|
{
|
|
2634
2633
|
open: !!legacyModalVersion,
|
|
2635
2634
|
onOpenChange: (open) => {
|
|
2636
2635
|
if (!open) setLegacyModalVersion(null);
|
|
2637
2636
|
},
|
|
2638
|
-
children: /* @__PURE__ */ jsxs7(
|
|
2639
|
-
/* @__PURE__ */ jsx8(
|
|
2637
|
+
children: /* @__PURE__ */ jsxs7(DialogContent, { className: "max-w-2xl", children: [
|
|
2638
|
+
/* @__PURE__ */ jsx8(DialogHeader, { children: /* @__PURE__ */ jsxs7(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
2640
2639
|
/* @__PURE__ */ jsx8(AlertTriangle, { className: "h-5 w-5 text-amber-500" }),
|
|
2641
2640
|
"Vers\xE3o Legada \u2014 v",
|
|
2642
2641
|
legacyModalVersion?.version_number
|
|
@@ -2888,7 +2887,7 @@ function AgentConversationsPanel({
|
|
|
2888
2887
|
}
|
|
2889
2888
|
|
|
2890
2889
|
// src/components/capabilities/capabilities-tab.tsx
|
|
2891
|
-
import { useState as useState10, useCallback as useCallback5, useEffect as useEffect4, useMemo as
|
|
2890
|
+
import { useState as useState10, useCallback as useCallback5, useEffect as useEffect4, useMemo as useMemo7 } from "react";
|
|
2892
2891
|
import {
|
|
2893
2892
|
Accordion,
|
|
2894
2893
|
AccordionItem,
|
|
@@ -3051,7 +3050,7 @@ function CapabilitiesTab({ config, agentId }) {
|
|
|
3051
3050
|
useEffect4(() => {
|
|
3052
3051
|
setInitialized(false);
|
|
3053
3052
|
}, [agentId]);
|
|
3054
|
-
const hasChanges =
|
|
3053
|
+
const hasChanges = useMemo7(
|
|
3055
3054
|
() => initialized && (!statesEqual(localState, serverState) || !instructionsEqual(localInstructions, serverInstructions, localState)),
|
|
3056
3055
|
[localState, serverState, localInstructions, serverInstructions, initialized]
|
|
3057
3056
|
);
|
|
@@ -3323,7 +3322,7 @@ function ModuleRow({
|
|
|
3323
3322
|
}
|
|
3324
3323
|
|
|
3325
3324
|
// src/components/capabilities/integrations-tab.tsx
|
|
3326
|
-
import { useCallback as useCallback6, useState as useState11, useEffect as useEffect5, useMemo as
|
|
3325
|
+
import { useCallback as useCallback6, useState as useState11, useEffect as useEffect5, useMemo as useMemo8 } from "react";
|
|
3327
3326
|
import { Switch as Switch5, Tooltip as Tooltip2, TooltipContent as TooltipContent2, TooltipTrigger as TooltipTrigger2, Checkbox as Checkbox2, Button as Button10 } from "@greatapps/greatauth-ui/ui";
|
|
3328
3327
|
import { Plug, Loader2 as Loader25, ChevronDown as ChevronDown2, Pencil as Pencil4 } from "lucide-react";
|
|
3329
3328
|
import { toast as toast8 } from "sonner";
|
|
@@ -3413,7 +3412,7 @@ function IntegrationsTab({
|
|
|
3413
3412
|
setServerState(JSON.parse(JSON.stringify(state, (_k, v) => v instanceof Set ? [...v] : v)));
|
|
3414
3413
|
setInitialized(true);
|
|
3415
3414
|
}, [connectedCards, agentTools, initialized]);
|
|
3416
|
-
const hasChanges =
|
|
3415
|
+
const hasChanges = useMemo8(() => {
|
|
3417
3416
|
if (!initialized) return false;
|
|
3418
3417
|
const localKeys = Object.keys(localState);
|
|
3419
3418
|
for (const slug of localKeys) {
|
|
@@ -3768,13 +3767,13 @@ import {
|
|
|
3768
3767
|
Popover,
|
|
3769
3768
|
PopoverContent,
|
|
3770
3769
|
PopoverTrigger,
|
|
3771
|
-
Input as
|
|
3770
|
+
Input as Input6,
|
|
3772
3771
|
Textarea as Textarea2,
|
|
3773
|
-
Dialog as
|
|
3774
|
-
DialogContent as
|
|
3775
|
-
DialogHeader as
|
|
3776
|
-
DialogTitle as
|
|
3777
|
-
DialogFooter
|
|
3772
|
+
Dialog as Dialog2,
|
|
3773
|
+
DialogContent as DialogContent2,
|
|
3774
|
+
DialogHeader as DialogHeader2,
|
|
3775
|
+
DialogTitle as DialogTitle2,
|
|
3776
|
+
DialogFooter,
|
|
3778
3777
|
Label as Label5,
|
|
3779
3778
|
Select,
|
|
3780
3779
|
SelectContent,
|
|
@@ -3907,7 +3906,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3907
3906
|
] }) }),
|
|
3908
3907
|
/* @__PURE__ */ jsxs13(PopoverContent, { className: "w-72 p-0", align: "end", children: [
|
|
3909
3908
|
/* @__PURE__ */ jsx15("div", { className: "p-2", children: /* @__PURE__ */ jsx15(
|
|
3910
|
-
|
|
3909
|
+
Input6,
|
|
3911
3910
|
{
|
|
3912
3911
|
placeholder: "Buscar ferramenta\\u2026",
|
|
3913
3912
|
"aria-label": "Buscar ferramenta",
|
|
@@ -3990,12 +3989,12 @@ function AgentToolsList({ agent, config }) {
|
|
|
3990
3989
|
);
|
|
3991
3990
|
}) }),
|
|
3992
3991
|
/* @__PURE__ */ jsx15(
|
|
3993
|
-
|
|
3992
|
+
Dialog2,
|
|
3994
3993
|
{
|
|
3995
3994
|
open: !!configTarget,
|
|
3996
3995
|
onOpenChange: (open) => !open && setConfigTarget(null),
|
|
3997
|
-
children: /* @__PURE__ */ jsxs13(
|
|
3998
|
-
/* @__PURE__ */ jsx15(
|
|
3996
|
+
children: /* @__PURE__ */ jsxs13(DialogContent2, { className: "sm:max-w-lg", children: [
|
|
3997
|
+
/* @__PURE__ */ jsx15(DialogHeader2, { children: /* @__PURE__ */ jsx15(DialogTitle2, { children: "Instru\xE7\xF5es da Ferramenta" }) }),
|
|
3999
3998
|
/* @__PURE__ */ jsxs13("div", { className: "space-y-4", children: [
|
|
4000
3999
|
configTarget && getToolInfo(configTarget.id_tool)?.type !== "none" && /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
|
|
4001
4000
|
/* @__PURE__ */ jsx15(Label5, { htmlFor: "tool-credential", children: "Credencial" }),
|
|
@@ -4031,7 +4030,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
4031
4030
|
/* @__PURE__ */ jsx15("p", { className: "text-xs text-muted-foreground", children: "Este texto \xE9 adicionado ao prompt do agente para orientar o uso da ferramenta." })
|
|
4032
4031
|
] })
|
|
4033
4032
|
] }),
|
|
4034
|
-
/* @__PURE__ */ jsxs13(
|
|
4033
|
+
/* @__PURE__ */ jsxs13(DialogFooter, { children: [
|
|
4035
4034
|
/* @__PURE__ */ jsx15(
|
|
4036
4035
|
Button11,
|
|
4037
4036
|
{
|
|
@@ -4080,10 +4079,10 @@ function AgentToolsList({ agent, config }) {
|
|
|
4080
4079
|
}
|
|
4081
4080
|
|
|
4082
4081
|
// src/components/tools/tools-table.tsx
|
|
4083
|
-
import { useMemo as
|
|
4082
|
+
import { useMemo as useMemo9, useState as useState13 } from "react";
|
|
4084
4083
|
import { DataTable as DataTable2 } from "@greatapps/greatauth-ui";
|
|
4085
4084
|
import {
|
|
4086
|
-
Input as
|
|
4085
|
+
Input as Input7,
|
|
4087
4086
|
Badge as Badge7,
|
|
4088
4087
|
Tooltip as Tooltip3,
|
|
4089
4088
|
TooltipTrigger as TooltipTrigger3,
|
|
@@ -4177,7 +4176,7 @@ function useColumns2(onEdit, onDelete) {
|
|
|
4177
4176
|
function ToolsTable({ onEdit, config }) {
|
|
4178
4177
|
const [search, setSearch] = useState13("");
|
|
4179
4178
|
const [page, setPage] = useState13(1);
|
|
4180
|
-
const queryParams =
|
|
4179
|
+
const queryParams = useMemo9(() => {
|
|
4181
4180
|
const params = {
|
|
4182
4181
|
limit: "15",
|
|
4183
4182
|
page: String(page)
|
|
@@ -4215,7 +4214,7 @@ function ToolsTable({ onEdit, config }) {
|
|
|
4215
4214
|
/* @__PURE__ */ jsx16("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs14("div", { className: "relative flex-1 max-w-md", children: [
|
|
4216
4215
|
/* @__PURE__ */ jsx16(Search2, { "aria-hidden": "true", className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
4217
4216
|
/* @__PURE__ */ jsx16(
|
|
4218
|
-
|
|
4217
|
+
Input7,
|
|
4219
4218
|
{
|
|
4220
4219
|
placeholder: "Buscar ferramentas\\u2026",
|
|
4221
4220
|
"aria-label": "Buscar ferramentas",
|
|
@@ -4272,13 +4271,13 @@ function ToolsTable({ onEdit, config }) {
|
|
|
4272
4271
|
// src/components/tools/tool-form-dialog.tsx
|
|
4273
4272
|
import { useState as useState14 } from "react";
|
|
4274
4273
|
import {
|
|
4275
|
-
Dialog as
|
|
4276
|
-
DialogContent as
|
|
4277
|
-
DialogHeader as
|
|
4278
|
-
DialogTitle as
|
|
4279
|
-
DialogFooter as
|
|
4274
|
+
Dialog as Dialog3,
|
|
4275
|
+
DialogContent as DialogContent3,
|
|
4276
|
+
DialogHeader as DialogHeader3,
|
|
4277
|
+
DialogTitle as DialogTitle3,
|
|
4278
|
+
DialogFooter as DialogFooter2,
|
|
4280
4279
|
Button as Button13,
|
|
4281
|
-
Input as
|
|
4280
|
+
Input as Input8,
|
|
4282
4281
|
Textarea as Textarea3,
|
|
4283
4282
|
Label as Label6,
|
|
4284
4283
|
Select as Select2,
|
|
@@ -4399,13 +4398,13 @@ function ToolFormDialog({
|
|
|
4399
4398
|
);
|
|
4400
4399
|
}
|
|
4401
4400
|
}
|
|
4402
|
-
return /* @__PURE__ */ jsx17(
|
|
4403
|
-
/* @__PURE__ */ jsx17(
|
|
4401
|
+
return /* @__PURE__ */ jsx17(Dialog3, { open, onOpenChange, children: /* @__PURE__ */ jsxs15(DialogContent3, { className: "sm:max-w-lg", children: [
|
|
4402
|
+
/* @__PURE__ */ jsx17(DialogHeader3, { children: /* @__PURE__ */ jsx17(DialogTitle3, { children: isEditing ? "Editar Ferramenta" : "Nova Ferramenta" }) }),
|
|
4404
4403
|
/* @__PURE__ */ jsxs15("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
|
|
4405
4404
|
/* @__PURE__ */ jsxs15("div", { className: "space-y-2", children: [
|
|
4406
4405
|
/* @__PURE__ */ jsx17(Label6, { htmlFor: "tool-name", children: "Nome *" }),
|
|
4407
4406
|
/* @__PURE__ */ jsx17(
|
|
4408
|
-
|
|
4407
|
+
Input8,
|
|
4409
4408
|
{
|
|
4410
4409
|
id: "tool-name",
|
|
4411
4410
|
name: "name",
|
|
@@ -4428,7 +4427,7 @@ function ToolFormDialog({
|
|
|
4428
4427
|
/* @__PURE__ */ jsxs15("div", { className: "space-y-2", children: [
|
|
4429
4428
|
/* @__PURE__ */ jsx17(Label6, { htmlFor: "tool-slug", children: "Slug (identificador \xFAnico) *" }),
|
|
4430
4429
|
/* @__PURE__ */ jsx17(
|
|
4431
|
-
|
|
4430
|
+
Input8,
|
|
4432
4431
|
{
|
|
4433
4432
|
id: "tool-slug",
|
|
4434
4433
|
name: "slug",
|
|
@@ -4523,7 +4522,7 @@ function ToolFormDialog({
|
|
|
4523
4522
|
/* @__PURE__ */ jsx17("p", { className: "text-xs text-muted-foreground", children: "Array de defini\xE7\xF5es no formato OpenAI Function Calling." }),
|
|
4524
4523
|
form.jsonError && /* @__PURE__ */ jsx17("p", { className: "text-sm text-destructive", children: "JSON inv\xE1lido" })
|
|
4525
4524
|
] }),
|
|
4526
|
-
/* @__PURE__ */ jsxs15(
|
|
4525
|
+
/* @__PURE__ */ jsxs15(DialogFooter2, { children: [
|
|
4527
4526
|
/* @__PURE__ */ jsx17(
|
|
4528
4527
|
Button13,
|
|
4529
4528
|
{
|
|
@@ -4544,10 +4543,10 @@ function ToolFormDialog({
|
|
|
4544
4543
|
}
|
|
4545
4544
|
|
|
4546
4545
|
// src/components/tools/tool-credentials-form.tsx
|
|
4547
|
-
import { useMemo as
|
|
4546
|
+
import { useMemo as useMemo10, useState as useState15 } from "react";
|
|
4548
4547
|
import { DataTable as DataTable3 } from "@greatapps/greatauth-ui";
|
|
4549
4548
|
import {
|
|
4550
|
-
Input as
|
|
4549
|
+
Input as Input9,
|
|
4551
4550
|
Button as Button14,
|
|
4552
4551
|
Badge as Badge8,
|
|
4553
4552
|
Tooltip as Tooltip4,
|
|
@@ -4642,13 +4641,13 @@ function ToolCredentialsForm({
|
|
|
4642
4641
|
const tools = (toolsData?.data || []).filter((t) => !t.slug?.startsWith("gclinic_"));
|
|
4643
4642
|
const [search, setSearch] = useState15("");
|
|
4644
4643
|
const [removeTarget, setRemoveTarget] = useState15(null);
|
|
4645
|
-
const internalToolIds =
|
|
4644
|
+
const internalToolIds = useMemo10(() => {
|
|
4646
4645
|
const allRawTools = toolsData?.data || [];
|
|
4647
4646
|
return new Set(
|
|
4648
4647
|
allRawTools.filter((t) => t.slug?.startsWith("gclinic_")).map((t) => t.id)
|
|
4649
4648
|
);
|
|
4650
4649
|
}, [toolsData]);
|
|
4651
|
-
const filteredCredentials =
|
|
4650
|
+
const filteredCredentials = useMemo10(() => {
|
|
4652
4651
|
const visible = credentials.filter(
|
|
4653
4652
|
(cred) => !cred.id_tool || !internalToolIds.has(cred.id_tool)
|
|
4654
4653
|
);
|
|
@@ -4682,7 +4681,7 @@ function ToolCredentialsForm({
|
|
|
4682
4681
|
/* @__PURE__ */ jsx18("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs16("div", { className: "relative flex-1 max-w-md", children: [
|
|
4683
4682
|
/* @__PURE__ */ jsx18(Search3, { "aria-hidden": "true", className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
4684
4683
|
/* @__PURE__ */ jsx18(
|
|
4685
|
-
|
|
4684
|
+
Input9,
|
|
4686
4685
|
{
|
|
4687
4686
|
placeholder: "Buscar credenciais\\u2026",
|
|
4688
4687
|
"aria-label": "Buscar credenciais",
|
|
@@ -5006,11 +5005,11 @@ function AdvancedTab({ config, agentId, gagentsApiUrl }) {
|
|
|
5006
5005
|
// src/components/capabilities/integration-wizard.tsx
|
|
5007
5006
|
import { useCallback as useCallback7, useEffect as useEffect6, useRef as useRef3, useState as useState18 } from "react";
|
|
5008
5007
|
import {
|
|
5009
|
-
Dialog as
|
|
5010
|
-
DialogContent as
|
|
5011
|
-
DialogFooter as
|
|
5012
|
-
DialogHeader as
|
|
5013
|
-
DialogTitle as
|
|
5008
|
+
Dialog as Dialog4,
|
|
5009
|
+
DialogContent as DialogContent4,
|
|
5010
|
+
DialogFooter as DialogFooter3,
|
|
5011
|
+
DialogHeader as DialogHeader4,
|
|
5012
|
+
DialogTitle as DialogTitle4,
|
|
5014
5013
|
Button as Button17
|
|
5015
5014
|
} from "@greatapps/greatauth-ui/ui";
|
|
5016
5015
|
import { Loader2 as Loader29, ChevronLeft, ChevronRight, Check as Check2 } from "lucide-react";
|
|
@@ -5073,7 +5072,7 @@ function InfoStep({ integration, meta }) {
|
|
|
5073
5072
|
|
|
5074
5073
|
// src/components/capabilities/wizard-steps/credentials-step.tsx
|
|
5075
5074
|
import { CheckCircle2, Loader2 as Loader27, AlertCircle, Shield } from "lucide-react";
|
|
5076
|
-
import { Button as Button16, Input as
|
|
5075
|
+
import { Button as Button16, Input as Input10, Label as Label7 } from "@greatapps/greatauth-ui/ui";
|
|
5077
5076
|
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5078
5077
|
function CredentialsStep({
|
|
5079
5078
|
integration,
|
|
@@ -5196,7 +5195,7 @@ function ApiKeyCredentials({
|
|
|
5196
5195
|
/* @__PURE__ */ jsxs20("div", { className: "space-y-2", children: [
|
|
5197
5196
|
/* @__PURE__ */ jsx22(Label7, { htmlFor: "integration-api-key", children: "Chave de API" }),
|
|
5198
5197
|
/* @__PURE__ */ jsx22(
|
|
5199
|
-
|
|
5198
|
+
Input10,
|
|
5200
5199
|
{
|
|
5201
5200
|
id: "integration-api-key",
|
|
5202
5201
|
type: "password",
|
|
@@ -5598,8 +5597,8 @@ function IntegrationWizard({
|
|
|
5598
5597
|
const selectedConfigOption = configOptions.find((o) => o.id === selectedConfigValue) || null;
|
|
5599
5598
|
const isLastStep = currentStep === "confirm";
|
|
5600
5599
|
const effectiveSteps = meta.hasConfigStep ? STEPS : STEPS.filter((s) => s !== "config");
|
|
5601
|
-
return /* @__PURE__ */ jsx25(
|
|
5602
|
-
/* @__PURE__ */ jsx25(
|
|
5600
|
+
return /* @__PURE__ */ jsx25(Dialog4, { open, onOpenChange, children: /* @__PURE__ */ jsxs23(DialogContent4, { className: "sm:max-w-lg", children: [
|
|
5601
|
+
/* @__PURE__ */ jsx25(DialogHeader4, { children: /* @__PURE__ */ jsx25(DialogTitle4, { children: integration.name }) }),
|
|
5603
5602
|
/* @__PURE__ */ jsx25(StepIndicator, { steps: effectiveSteps, currentStep }),
|
|
5604
5603
|
/* @__PURE__ */ jsxs23("div", { className: "min-h-[280px] py-2", children: [
|
|
5605
5604
|
currentStep === "info" && /* @__PURE__ */ jsx25(
|
|
@@ -5643,7 +5642,7 @@ function IntegrationWizard({
|
|
|
5643
5642
|
}
|
|
5644
5643
|
)
|
|
5645
5644
|
] }),
|
|
5646
|
-
/* @__PURE__ */ jsxs23(
|
|
5645
|
+
/* @__PURE__ */ jsxs23(DialogFooter3, { className: "flex-row justify-between sm:justify-between", children: [
|
|
5647
5646
|
/* @__PURE__ */ jsx25("div", { children: currentStep === "info" ? /* @__PURE__ */ jsx25(
|
|
5648
5647
|
Button17,
|
|
5649
5648
|
{
|