@greatapps/greatagents-ui 0.3.22 → 0.3.24
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 +248 -243
- 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 +59 -34
- package/src/components/agents/agent-form-dialog.tsx +18 -16
- package/src/components/agents/agent-objectives-list.tsx +17 -17
- package/src/components/agents/conversation-flow-editor.tsx +41 -42
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,95 +852,97 @@ 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(
|
|
857
|
-
/* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className: "
|
|
858
|
-
/* @__PURE__ */
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
value: form.photo || null,
|
|
862
|
-
onChange: (url) => updateField("photo", url),
|
|
863
|
-
onRemove: () => updateField("photo", ""),
|
|
864
|
-
entityType: "agents",
|
|
865
|
-
entityId: agent?.id,
|
|
866
|
-
idAccount: typeof idAccount === "string" ? Number(idAccount) : idAccount ?? Number(config.accountId) ?? 0,
|
|
867
|
-
name: form.title || null,
|
|
868
|
-
disabled: isPending
|
|
869
|
-
}
|
|
870
|
-
) }),
|
|
871
|
-
/* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
|
|
872
|
-
/* @__PURE__ */ jsx2(Label, { htmlFor: "agent-title", children: "Nome do Agente *" }),
|
|
873
|
-
/* @__PURE__ */ jsx2(
|
|
874
|
-
Input2,
|
|
875
|
-
{
|
|
876
|
-
id: "agent-title",
|
|
877
|
-
name: "title",
|
|
878
|
-
value: form.title,
|
|
879
|
-
onChange: (e) => {
|
|
880
|
-
setForm((prev) => ({
|
|
881
|
-
...prev,
|
|
882
|
-
title: e.target.value,
|
|
883
|
-
titleError: e.target.value.trim() ? false : prev.titleError
|
|
884
|
-
}));
|
|
885
|
-
},
|
|
886
|
-
placeholder: "Ex: Assistente de Agendamento",
|
|
887
|
-
required: true,
|
|
888
|
-
disabled: isPending
|
|
889
|
-
}
|
|
890
|
-
),
|
|
891
|
-
form.titleError && /* @__PURE__ */ jsx2("p", { className: "text-sm text-destructive", children: "Nome \xE9 obrigat\xF3rio" })
|
|
892
|
-
] }),
|
|
893
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-3", children: [
|
|
894
|
-
/* @__PURE__ */ jsx2(
|
|
895
|
-
Switch,
|
|
855
|
+
return /* @__PURE__ */ jsx2(Sheet, { open, onOpenChange, children: /* @__PURE__ */ jsxs2(SheetContent, { className: "sm:max-w-md", children: [
|
|
856
|
+
/* @__PURE__ */ jsx2(SheetHeader, { children: /* @__PURE__ */ jsx2(SheetTitle, { children: isEditing ? "Editar Agente" : "Novo Agente" }) }),
|
|
857
|
+
/* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
858
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex-1 overflow-y-auto px-4 space-y-4", children: [
|
|
859
|
+
/* @__PURE__ */ jsx2("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx2(
|
|
860
|
+
ImageCropUpload,
|
|
896
861
|
{
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
862
|
+
value: form.photo || null,
|
|
863
|
+
onChange: (url) => updateField("photo", url),
|
|
864
|
+
onRemove: () => updateField("photo", ""),
|
|
865
|
+
entityType: "agents",
|
|
866
|
+
entityId: agent?.id,
|
|
867
|
+
idAccount: typeof idAccount === "string" ? Number(idAccount) : idAccount ?? Number(config.accountId) ?? 0,
|
|
868
|
+
name: form.title || null,
|
|
900
869
|
disabled: isPending
|
|
901
870
|
}
|
|
902
|
-
),
|
|
903
|
-
/* @__PURE__ */ jsx2(Label, { htmlFor: "agent-active", className: "cursor-pointer", children: form.active ? "Ativo" : "Inativo" })
|
|
904
|
-
] }),
|
|
905
|
-
/* @__PURE__ */ jsxs2("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
871
|
+
) }),
|
|
906
872
|
/* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
|
|
907
|
-
/* @__PURE__ */ jsx2(Label, { htmlFor: "agent-
|
|
873
|
+
/* @__PURE__ */ jsx2(Label, { htmlFor: "agent-title", children: "Nome do Agente *" }),
|
|
908
874
|
/* @__PURE__ */ jsx2(
|
|
909
875
|
Input2,
|
|
910
876
|
{
|
|
911
|
-
id: "agent-
|
|
912
|
-
name: "
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
877
|
+
id: "agent-title",
|
|
878
|
+
name: "title",
|
|
879
|
+
value: form.title,
|
|
880
|
+
onChange: (e) => {
|
|
881
|
+
setForm((prev) => ({
|
|
882
|
+
...prev,
|
|
883
|
+
title: e.target.value,
|
|
884
|
+
titleError: e.target.value.trim() ? false : prev.titleError
|
|
885
|
+
}));
|
|
886
|
+
},
|
|
887
|
+
placeholder: "Ex: Assistente de Agendamento",
|
|
888
|
+
required: true,
|
|
919
889
|
disabled: isPending
|
|
920
890
|
}
|
|
921
891
|
),
|
|
922
|
-
/* @__PURE__ */ jsx2("p", { className: "text-
|
|
892
|
+
form.titleError && /* @__PURE__ */ jsx2("p", { className: "text-sm text-destructive", children: "Nome \xE9 obrigat\xF3rio" })
|
|
923
893
|
] }),
|
|
924
|
-
/* @__PURE__ */ jsxs2("div", { className: "
|
|
925
|
-
/* @__PURE__ */ jsx2(Label, { htmlFor: "agent-waiting", children: "Tempo de Espera (s)" }),
|
|
894
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-3", children: [
|
|
926
895
|
/* @__PURE__ */ jsx2(
|
|
927
|
-
|
|
896
|
+
Switch,
|
|
928
897
|
{
|
|
929
|
-
id: "agent-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
value: form.waitingTime,
|
|
933
|
-
onChange: (e) => updateField("waitingTime", e.target.value),
|
|
934
|
-
placeholder: "0",
|
|
935
|
-
min: "0",
|
|
936
|
-
step: "0.5",
|
|
898
|
+
id: "agent-active",
|
|
899
|
+
checked: form.active,
|
|
900
|
+
onCheckedChange: (checked) => updateField("active", checked),
|
|
937
901
|
disabled: isPending
|
|
938
902
|
}
|
|
939
903
|
),
|
|
940
|
-
/* @__PURE__ */ jsx2(
|
|
904
|
+
/* @__PURE__ */ jsx2(Label, { htmlFor: "agent-active", className: "cursor-pointer", children: form.active ? "Ativo" : "Inativo" })
|
|
905
|
+
] }),
|
|
906
|
+
/* @__PURE__ */ jsxs2("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
907
|
+
/* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
|
|
908
|
+
/* @__PURE__ */ jsx2(Label, { htmlFor: "agent-delay", children: "Delay de Digita\xE7\xE3o (s)" }),
|
|
909
|
+
/* @__PURE__ */ jsx2(
|
|
910
|
+
Input2,
|
|
911
|
+
{
|
|
912
|
+
id: "agent-delay",
|
|
913
|
+
name: "delay",
|
|
914
|
+
type: "number",
|
|
915
|
+
value: form.delayTyping,
|
|
916
|
+
onChange: (e) => updateField("delayTyping", e.target.value),
|
|
917
|
+
placeholder: "0",
|
|
918
|
+
min: "0",
|
|
919
|
+
step: "0.5",
|
|
920
|
+
disabled: isPending
|
|
921
|
+
}
|
|
922
|
+
),
|
|
923
|
+
/* @__PURE__ */ jsx2("p", { className: "text-xs text-muted-foreground", children: "Tempo de simula\xE7\xE3o de digita\xE7\xE3o" })
|
|
924
|
+
] }),
|
|
925
|
+
/* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
|
|
926
|
+
/* @__PURE__ */ jsx2(Label, { htmlFor: "agent-waiting", children: "Tempo de Espera (s)" }),
|
|
927
|
+
/* @__PURE__ */ jsx2(
|
|
928
|
+
Input2,
|
|
929
|
+
{
|
|
930
|
+
id: "agent-waiting",
|
|
931
|
+
name: "waiting",
|
|
932
|
+
type: "number",
|
|
933
|
+
value: form.waitingTime,
|
|
934
|
+
onChange: (e) => updateField("waitingTime", e.target.value),
|
|
935
|
+
placeholder: "0",
|
|
936
|
+
min: "0",
|
|
937
|
+
step: "0.5",
|
|
938
|
+
disabled: isPending
|
|
939
|
+
}
|
|
940
|
+
),
|
|
941
|
+
/* @__PURE__ */ jsx2("p", { className: "text-xs text-muted-foreground", children: "Espera por mensagens agrupadas" })
|
|
942
|
+
] })
|
|
941
943
|
] })
|
|
942
944
|
] }),
|
|
943
|
-
/* @__PURE__ */ jsxs2(
|
|
945
|
+
/* @__PURE__ */ jsxs2(SheetFooter, { className: "flex-row justify-end border-t", children: [
|
|
944
946
|
/* @__PURE__ */ jsx2(
|
|
945
947
|
Button2,
|
|
946
948
|
{
|
|
@@ -967,11 +969,11 @@ import {
|
|
|
967
969
|
Input as Input3,
|
|
968
970
|
Label as Label2,
|
|
969
971
|
Switch as Switch2,
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
972
|
+
Sheet as Sheet2,
|
|
973
|
+
SheetContent as SheetContent2,
|
|
974
|
+
SheetHeader as SheetHeader2,
|
|
975
|
+
SheetTitle as SheetTitle2,
|
|
976
|
+
SheetFooter as SheetFooter2
|
|
975
977
|
} from "@greatapps/greatauth-ui/ui";
|
|
976
978
|
import { Loader2 as Loader22 } from "lucide-react";
|
|
977
979
|
import { toast as toast3 } from "sonner";
|
|
@@ -1116,7 +1118,7 @@ function AgentEditForm({ config, agent, idAccount, open, onOpenChange }) {
|
|
|
1116
1118
|
/* @__PURE__ */ jsx3("p", { className: "text-xs text-muted-foreground", children: "Espera por mensagens agrupadas" })
|
|
1117
1119
|
] })
|
|
1118
1120
|
] }),
|
|
1119
|
-
/* @__PURE__ */ jsxs3(
|
|
1121
|
+
/* @__PURE__ */ jsxs3(SheetFooter2, { children: [
|
|
1120
1122
|
/* @__PURE__ */ jsx3(
|
|
1121
1123
|
Button3,
|
|
1122
1124
|
{
|
|
@@ -1134,8 +1136,8 @@ function AgentEditForm({ config, agent, idAccount, open, onOpenChange }) {
|
|
|
1134
1136
|
] })
|
|
1135
1137
|
] });
|
|
1136
1138
|
if (open !== void 0 && onOpenChange) {
|
|
1137
|
-
return /* @__PURE__ */ jsx3(
|
|
1138
|
-
/* @__PURE__ */ jsx3(
|
|
1139
|
+
return /* @__PURE__ */ jsx3(Sheet2, { open, onOpenChange, children: /* @__PURE__ */ jsxs3(SheetContent2, { className: "sm:max-w-md overflow-y-auto", children: [
|
|
1140
|
+
/* @__PURE__ */ jsx3(SheetHeader2, { children: /* @__PURE__ */ jsx3(SheetTitle2, { children: "Editar Agente" }) }),
|
|
1139
1141
|
formContent
|
|
1140
1142
|
] }) });
|
|
1141
1143
|
}
|
|
@@ -1145,18 +1147,18 @@ function AgentEditForm({ config, agent, idAccount, open, onOpenChange }) {
|
|
|
1145
1147
|
// src/components/agents/agent-objectives-list.tsx
|
|
1146
1148
|
import { useState as useState6 } from "react";
|
|
1147
1149
|
import {
|
|
1148
|
-
Input as
|
|
1150
|
+
Input as Input4,
|
|
1149
1151
|
Button as Button5,
|
|
1150
1152
|
Switch as Switch3,
|
|
1151
1153
|
Skeleton,
|
|
1152
|
-
Textarea,
|
|
1154
|
+
Textarea as Textarea2,
|
|
1153
1155
|
Label as Label3,
|
|
1154
1156
|
Badge as Badge2,
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1157
|
+
Sheet as Sheet3,
|
|
1158
|
+
SheetContent as SheetContent3,
|
|
1159
|
+
SheetHeader as SheetHeader3,
|
|
1160
|
+
SheetTitle as SheetTitle3,
|
|
1161
|
+
SheetFooter as SheetFooter3,
|
|
1160
1162
|
AlertDialog as AlertDialog2,
|
|
1161
1163
|
AlertDialogAction as AlertDialogAction2,
|
|
1162
1164
|
AlertDialogCancel as AlertDialogCancel2,
|
|
@@ -1632,7 +1634,7 @@ function SortableOverlay(props) {
|
|
|
1632
1634
|
|
|
1633
1635
|
// src/components/agents/conversation-flow-editor.tsx
|
|
1634
1636
|
import { useCallback as useCallback3, useRef, useState as useState5 } from "react";
|
|
1635
|
-
import { Button as Button4,
|
|
1637
|
+
import { Button as Button4, Textarea } from "@greatapps/greatauth-ui/ui";
|
|
1636
1638
|
import { GripVertical, Plus, Trash2 as Trash22 } from "lucide-react";
|
|
1637
1639
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1638
1640
|
function renumber(steps) {
|
|
@@ -1698,46 +1700,50 @@ function ConversationFlowEditor({
|
|
|
1698
1700
|
SortableItem,
|
|
1699
1701
|
{
|
|
1700
1702
|
value: step._key,
|
|
1701
|
-
className: "flex
|
|
1703
|
+
className: "flex flex-col gap-2 rounded-lg border bg-card p-3",
|
|
1702
1704
|
children: [
|
|
1703
|
-
/* @__PURE__ */
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1705
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
1706
|
+
/* @__PURE__ */ jsx5(SortableItemHandle, { className: "shrink-0 cursor-grab text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ jsx5(GripVertical, { "aria-hidden": "true", className: "h-4 w-4" }) }),
|
|
1707
|
+
/* @__PURE__ */ jsxs4("span", { className: "shrink-0 text-xs font-medium text-muted-foreground tabular-nums", children: [
|
|
1708
|
+
step.order,
|
|
1709
|
+
"."
|
|
1710
|
+
] }),
|
|
1711
|
+
/* @__PURE__ */ jsx5("span", { className: "flex-1 text-sm font-medium truncate", children: step.instruction || "Nova etapa" }),
|
|
1712
|
+
/* @__PURE__ */ jsx5(
|
|
1713
|
+
Button4,
|
|
1714
|
+
{
|
|
1715
|
+
type: "button",
|
|
1716
|
+
variant: "ghost",
|
|
1717
|
+
size: "icon",
|
|
1718
|
+
"aria-label": "Remover etapa",
|
|
1719
|
+
className: "shrink-0 text-muted-foreground hover:text-destructive",
|
|
1720
|
+
onClick: () => handleRemove(step._key),
|
|
1721
|
+
children: /* @__PURE__ */ jsx5(Trash22, { className: "h-4 w-4" })
|
|
1722
|
+
}
|
|
1723
|
+
)
|
|
1707
1724
|
] }),
|
|
1708
|
-
/* @__PURE__ */
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
type: "button",
|
|
1731
|
-
variant: "ghost",
|
|
1732
|
-
size: "icon",
|
|
1733
|
-
"aria-label": "Remover etapa",
|
|
1734
|
-
className: cn(
|
|
1735
|
-
"shrink-0 text-muted-foreground hover:text-destructive"
|
|
1736
|
-
),
|
|
1737
|
-
onClick: () => handleRemove(step._key),
|
|
1738
|
-
children: /* @__PURE__ */ jsx5(Trash22, { className: "h-4 w-4" })
|
|
1739
|
-
}
|
|
1740
|
-
)
|
|
1725
|
+
/* @__PURE__ */ jsxs4("div", { className: "space-y-2 pl-8", children: [
|
|
1726
|
+
/* @__PURE__ */ jsx5(
|
|
1727
|
+
Textarea,
|
|
1728
|
+
{
|
|
1729
|
+
value: step.instruction,
|
|
1730
|
+
onChange: (e) => handleFieldChange(step._key, "instruction", e.target.value),
|
|
1731
|
+
placeholder: "Descreva o que o agente deve fazer nesta etapa...",
|
|
1732
|
+
className: "min-h-[2.5rem] resize-none",
|
|
1733
|
+
rows: 2
|
|
1734
|
+
}
|
|
1735
|
+
),
|
|
1736
|
+
/* @__PURE__ */ jsx5(
|
|
1737
|
+
Textarea,
|
|
1738
|
+
{
|
|
1739
|
+
value: step.example ?? "",
|
|
1740
|
+
onChange: (e) => handleFieldChange(step._key, "example", e.target.value),
|
|
1741
|
+
placeholder: "Exemplo de resposta do agente (opcional)",
|
|
1742
|
+
className: "min-h-[2.5rem] resize-none text-muted-foreground",
|
|
1743
|
+
rows: 1
|
|
1744
|
+
}
|
|
1745
|
+
)
|
|
1746
|
+
] })
|
|
1741
1747
|
]
|
|
1742
1748
|
},
|
|
1743
1749
|
step._key
|
|
@@ -1989,13 +1995,13 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
1989
1995
|
]
|
|
1990
1996
|
}
|
|
1991
1997
|
),
|
|
1992
|
-
/* @__PURE__ */ jsx6(
|
|
1993
|
-
/* @__PURE__ */ jsx6(
|
|
1994
|
-
/* @__PURE__ */ jsxs5("div", { className: "space-y-4", children: [
|
|
1998
|
+
/* @__PURE__ */ jsx6(Sheet3, { open: formOpen, onOpenChange: setFormOpen, children: /* @__PURE__ */ jsxs5(SheetContent3, { className: "sm:max-w-lg", children: [
|
|
1999
|
+
/* @__PURE__ */ jsx6(SheetHeader3, { children: /* @__PURE__ */ jsx6(SheetTitle3, { children: editTarget ? "Editar Objetivo" : "Novo Objetivo" }) }),
|
|
2000
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex-1 overflow-y-auto px-4 space-y-4", children: [
|
|
1995
2001
|
/* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
|
|
1996
2002
|
/* @__PURE__ */ jsx6(Label3, { htmlFor: "objective-title", children: "T\xEDtulo *" }),
|
|
1997
2003
|
/* @__PURE__ */ jsx6(
|
|
1998
|
-
|
|
2004
|
+
Input4,
|
|
1999
2005
|
{
|
|
2000
2006
|
id: "objective-title",
|
|
2001
2007
|
name: "title",
|
|
@@ -2015,7 +2021,7 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
2015
2021
|
/* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
|
|
2016
2022
|
/* @__PURE__ */ jsx6(Label3, { htmlFor: "objective-slug", children: "Slug (identificador) *" }),
|
|
2017
2023
|
/* @__PURE__ */ jsx6(
|
|
2018
|
-
|
|
2024
|
+
Input4,
|
|
2019
2025
|
{
|
|
2020
2026
|
id: "objective-slug",
|
|
2021
2027
|
name: "slug",
|
|
@@ -2033,7 +2039,7 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
2033
2039
|
/* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
|
|
2034
2040
|
/* @__PURE__ */ jsx6(Label3, { htmlFor: "objective-instruction", children: "Quando ativar (instru\xE7\xE3o curta) *" }),
|
|
2035
2041
|
/* @__PURE__ */ jsx6(
|
|
2036
|
-
|
|
2042
|
+
Input4,
|
|
2037
2043
|
{
|
|
2038
2044
|
id: "objective-instruction",
|
|
2039
2045
|
name: "instruction",
|
|
@@ -2047,7 +2053,7 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
2047
2053
|
/* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
|
|
2048
2054
|
/* @__PURE__ */ jsx6(Label3, { htmlFor: "objective-description", children: "Descri\xE7\xE3o" }),
|
|
2049
2055
|
/* @__PURE__ */ jsx6(
|
|
2050
|
-
|
|
2056
|
+
Textarea2,
|
|
2051
2057
|
{
|
|
2052
2058
|
id: "objective-description",
|
|
2053
2059
|
name: "description",
|
|
@@ -2073,7 +2079,7 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
2073
2079
|
/* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
|
|
2074
2080
|
/* @__PURE__ */ jsx6(Label3, { htmlFor: "objective-rules", children: "Regras" }),
|
|
2075
2081
|
/* @__PURE__ */ jsx6(
|
|
2076
|
-
|
|
2082
|
+
Textarea2,
|
|
2077
2083
|
{
|
|
2078
2084
|
id: "objective-rules",
|
|
2079
2085
|
name: "rules",
|
|
@@ -2086,7 +2092,7 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
2086
2092
|
/* @__PURE__ */ jsx6("p", { className: "text-xs text-muted-foreground", children: "Restri\xE7\xF5es e limites espec\xEDficos quando este objectivo est\xE1 activo." })
|
|
2087
2093
|
] })
|
|
2088
2094
|
] }),
|
|
2089
|
-
/* @__PURE__ */ jsxs5(
|
|
2095
|
+
/* @__PURE__ */ jsxs5(SheetFooter3, { className: "flex-row justify-end border-t", children: [
|
|
2090
2096
|
/* @__PURE__ */ jsx6(
|
|
2091
2097
|
Button5,
|
|
2092
2098
|
{
|
|
@@ -2133,8 +2139,8 @@ function AgentObjectivesList({ agent, config }) {
|
|
|
2133
2139
|
}
|
|
2134
2140
|
|
|
2135
2141
|
// 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,
|
|
2142
|
+
import { useState as useState7, useRef as useRef2, useCallback as useCallback4, useEffect as useEffect3, useMemo as useMemo5 } from "react";
|
|
2143
|
+
import { Button as Button6, Label as Label4 } from "@greatapps/greatauth-ui/ui";
|
|
2138
2144
|
import { Loader2 as Loader23 } from "lucide-react";
|
|
2139
2145
|
import { toast as toast5 } from "sonner";
|
|
2140
2146
|
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
@@ -2145,7 +2151,8 @@ var SECTIONS = [
|
|
|
2145
2151
|
helper: "Descreva quem \xE9 o agente, o seu nome e personalidade",
|
|
2146
2152
|
required: true,
|
|
2147
2153
|
field: "identity",
|
|
2148
|
-
type: "textarea"
|
|
2154
|
+
type: "textarea",
|
|
2155
|
+
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
2156
|
},
|
|
2150
2157
|
{
|
|
2151
2158
|
key: "mission",
|
|
@@ -2153,7 +2160,8 @@ var SECTIONS = [
|
|
|
2153
2160
|
helper: "Qual \xE9 a miss\xE3o principal deste agente",
|
|
2154
2161
|
required: true,
|
|
2155
2162
|
field: "mission",
|
|
2156
|
-
type: "textarea"
|
|
2163
|
+
type: "textarea",
|
|
2164
|
+
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
2165
|
},
|
|
2158
2166
|
{
|
|
2159
2167
|
key: "tone_style_format",
|
|
@@ -2161,7 +2169,8 @@ var SECTIONS = [
|
|
|
2161
2169
|
helper: "Defina como o agente comunica e formata as respostas",
|
|
2162
2170
|
required: false,
|
|
2163
2171
|
field: "tone_style_format",
|
|
2164
|
-
type: "textarea"
|
|
2172
|
+
type: "textarea",
|
|
2173
|
+
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
2174
|
},
|
|
2166
2175
|
{
|
|
2167
2176
|
key: "rules",
|
|
@@ -2169,7 +2178,8 @@ var SECTIONS = [
|
|
|
2169
2178
|
helper: "Limites, restri\xE7\xF5es e comportamentos obrigat\xF3rios",
|
|
2170
2179
|
required: false,
|
|
2171
2180
|
field: "rules",
|
|
2172
|
-
type: "textarea"
|
|
2181
|
+
type: "textarea",
|
|
2182
|
+
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
2183
|
},
|
|
2174
2184
|
{
|
|
2175
2185
|
key: "conversation_flow",
|
|
@@ -2177,7 +2187,8 @@ var SECTIONS = [
|
|
|
2177
2187
|
helper: "Etapas que o agente segue no in\xEDcio de cada conversa",
|
|
2178
2188
|
required: false,
|
|
2179
2189
|
field: "conversation_flow",
|
|
2180
|
-
type: "conversation_flow"
|
|
2190
|
+
type: "conversation_flow",
|
|
2191
|
+
placeholder: ""
|
|
2181
2192
|
},
|
|
2182
2193
|
{
|
|
2183
2194
|
key: "context",
|
|
@@ -2185,7 +2196,8 @@ var SECTIONS = [
|
|
|
2185
2196
|
helper: "Informa\xE7\xF5es adicionais que o agente deve saber",
|
|
2186
2197
|
required: false,
|
|
2187
2198
|
field: "context",
|
|
2188
|
-
type: "textarea"
|
|
2199
|
+
type: "textarea",
|
|
2200
|
+
placeholder: "A cl\xEDnica funciona de segunda a sexta, das 08h \xE0s 18h. Especialidades dispon\xEDveis: Cardiologia, Dermatologia, Ortopedia, Pediatria..."
|
|
2189
2201
|
}
|
|
2190
2202
|
];
|
|
2191
2203
|
function parseConversationFlow(raw) {
|
|
@@ -2262,7 +2274,6 @@ function AgentDefinitionEditor({ agent, config }) {
|
|
|
2262
2274
|
const [conversationFlowSteps, setConversationFlowSteps] = useState7(
|
|
2263
2275
|
() => parseConversationFlow(agent.conversation_flow)
|
|
2264
2276
|
);
|
|
2265
|
-
const [changeNotes, setChangeNotes] = useState7("");
|
|
2266
2277
|
if (trackedAgentId !== agent.id) {
|
|
2267
2278
|
setTrackedAgentId(agent.id);
|
|
2268
2279
|
setFields({
|
|
@@ -2273,12 +2284,31 @@ function AgentDefinitionEditor({ agent, config }) {
|
|
|
2273
2284
|
context: agent.context ?? ""
|
|
2274
2285
|
});
|
|
2275
2286
|
setConversationFlowSteps(parseConversationFlow(agent.conversation_flow));
|
|
2276
|
-
setChangeNotes("");
|
|
2277
2287
|
}
|
|
2278
2288
|
function updateField(key, value) {
|
|
2279
2289
|
setFields((prev) => ({ ...prev, [key]: value }));
|
|
2280
2290
|
}
|
|
2281
2291
|
const { chars, tokens } = computeTotals(fields, conversationFlowSteps);
|
|
2292
|
+
const hasChanges = useMemo5(() => {
|
|
2293
|
+
if (fields.identity !== (agent.identity ?? "")) return true;
|
|
2294
|
+
if (fields.mission !== (agent.mission ?? "")) return true;
|
|
2295
|
+
if (fields.tone_style_format !== (agent.tone_style_format ?? "")) return true;
|
|
2296
|
+
if (fields.rules !== (agent.rules ?? "")) return true;
|
|
2297
|
+
if (fields.context !== (agent.context ?? "")) return true;
|
|
2298
|
+
const originalSteps = parseConversationFlow(agent.conversation_flow);
|
|
2299
|
+
if (JSON.stringify(conversationFlowSteps) !== JSON.stringify(originalSteps)) return true;
|
|
2300
|
+
return false;
|
|
2301
|
+
}, [fields, conversationFlowSteps, agent]);
|
|
2302
|
+
function discard() {
|
|
2303
|
+
setFields({
|
|
2304
|
+
identity: agent.identity ?? "",
|
|
2305
|
+
mission: agent.mission ?? "",
|
|
2306
|
+
tone_style_format: agent.tone_style_format ?? "",
|
|
2307
|
+
rules: agent.rules ?? "",
|
|
2308
|
+
context: agent.context ?? ""
|
|
2309
|
+
});
|
|
2310
|
+
setConversationFlowSteps(parseConversationFlow(agent.conversation_flow));
|
|
2311
|
+
}
|
|
2282
2312
|
async function handleSave() {
|
|
2283
2313
|
if (!fields.identity.trim() || !fields.mission.trim()) {
|
|
2284
2314
|
toast5.error("Identidade e Miss\xE3o s\xE3o campos obrigat\xF3rios");
|
|
@@ -2292,12 +2322,8 @@ function AgentDefinitionEditor({ agent, config }) {
|
|
|
2292
2322
|
conversation_flow: conversationFlowSteps.length > 0 ? JSON.stringify(conversationFlowSteps) : null,
|
|
2293
2323
|
context: fields.context.trim() || null
|
|
2294
2324
|
};
|
|
2295
|
-
if (changeNotes.trim()) {
|
|
2296
|
-
body.change_notes = changeNotes.trim();
|
|
2297
|
-
}
|
|
2298
2325
|
try {
|
|
2299
2326
|
await updateAgent.mutateAsync({ id: agent.id, body });
|
|
2300
|
-
setChangeNotes("");
|
|
2301
2327
|
toast5.success("Defini\xE7\xE3o do agente salva com sucesso");
|
|
2302
2328
|
} catch {
|
|
2303
2329
|
toast5.error("Erro ao salvar defini\xE7\xE3o do agente");
|
|
@@ -2316,7 +2342,7 @@ function AgentDefinitionEditor({ agent, config }) {
|
|
|
2316
2342
|
value: fields[section.key] ?? "",
|
|
2317
2343
|
onChange: (v) => updateField(section.key, v),
|
|
2318
2344
|
disabled: updateAgent.isPending,
|
|
2319
|
-
placeholder:
|
|
2345
|
+
placeholder: section.placeholder,
|
|
2320
2346
|
ariaLabel: section.label
|
|
2321
2347
|
}
|
|
2322
2348
|
) : /* @__PURE__ */ jsx7(
|
|
@@ -2340,50 +2366,29 @@ function AgentDefinitionEditor({ agent, config }) {
|
|
|
2340
2366
|
" tokens"
|
|
2341
2367
|
] })
|
|
2342
2368
|
] }),
|
|
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
|
-
)
|
|
2369
|
+
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: [
|
|
2370
|
+
/* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "Voc\xEA tem altera\xE7\xF5es n\xE3o salvas." }),
|
|
2371
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex gap-2", children: [
|
|
2372
|
+
/* @__PURE__ */ jsx7(Button6, { variant: "ghost", size: "sm", onClick: discard, disabled: updateAgent.isPending, children: "Descartar" }),
|
|
2373
|
+
/* @__PURE__ */ jsxs6(Button6, { size: "sm", onClick: handleSave, disabled: updateAgent.isPending, children: [
|
|
2374
|
+
updateAgent.isPending && /* @__PURE__ */ jsx7(Loader23, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
2375
|
+
"Salvar"
|
|
2376
|
+
] })
|
|
2377
|
+
] })
|
|
2373
2378
|
] })
|
|
2374
2379
|
] });
|
|
2375
2380
|
}
|
|
2376
2381
|
|
|
2377
2382
|
// src/components/agents/agent-revision-tab.tsx
|
|
2378
|
-
import { useState as useState8, useMemo as
|
|
2383
|
+
import { useState as useState8, useMemo as useMemo6 } from "react";
|
|
2379
2384
|
import {
|
|
2380
2385
|
Button as Button7,
|
|
2381
2386
|
Badge as Badge3,
|
|
2382
2387
|
Skeleton as Skeleton2,
|
|
2383
|
-
Dialog
|
|
2384
|
-
DialogContent
|
|
2385
|
-
DialogHeader
|
|
2386
|
-
DialogTitle
|
|
2388
|
+
Dialog,
|
|
2389
|
+
DialogContent,
|
|
2390
|
+
DialogHeader,
|
|
2391
|
+
DialogTitle
|
|
2387
2392
|
} from "@greatapps/greatauth-ui/ui";
|
|
2388
2393
|
import { FileText, RotateCcw, X, AlertTriangle } from "lucide-react";
|
|
2389
2394
|
import { toast as toast6 } from "sonner";
|
|
@@ -2477,7 +2482,7 @@ function AgentRevisionTab({ agent, config }) {
|
|
|
2477
2482
|
(a, b) => new Date(b.datetime_add).getTime() - new Date(a.datetime_add).getTime()
|
|
2478
2483
|
);
|
|
2479
2484
|
const currentVersion = sortedVersions.find((v) => v.is_current) || sortedVersions[0] || null;
|
|
2480
|
-
const assembledPrompt =
|
|
2485
|
+
const assembledPrompt = useMemo6(() => buildAssembledPrompt(agent), [
|
|
2481
2486
|
agent.identity,
|
|
2482
2487
|
agent.mission,
|
|
2483
2488
|
agent.tone_style_format,
|
|
@@ -2629,14 +2634,14 @@ function AgentRevisionTab({ agent, config }) {
|
|
|
2629
2634
|
}) })
|
|
2630
2635
|
] }),
|
|
2631
2636
|
/* @__PURE__ */ jsx8(
|
|
2632
|
-
|
|
2637
|
+
Dialog,
|
|
2633
2638
|
{
|
|
2634
2639
|
open: !!legacyModalVersion,
|
|
2635
2640
|
onOpenChange: (open) => {
|
|
2636
2641
|
if (!open) setLegacyModalVersion(null);
|
|
2637
2642
|
},
|
|
2638
|
-
children: /* @__PURE__ */ jsxs7(
|
|
2639
|
-
/* @__PURE__ */ jsx8(
|
|
2643
|
+
children: /* @__PURE__ */ jsxs7(DialogContent, { className: "max-w-2xl", children: [
|
|
2644
|
+
/* @__PURE__ */ jsx8(DialogHeader, { children: /* @__PURE__ */ jsxs7(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
2640
2645
|
/* @__PURE__ */ jsx8(AlertTriangle, { className: "h-5 w-5 text-amber-500" }),
|
|
2641
2646
|
"Vers\xE3o Legada \u2014 v",
|
|
2642
2647
|
legacyModalVersion?.version_number
|
|
@@ -2888,7 +2893,7 @@ function AgentConversationsPanel({
|
|
|
2888
2893
|
}
|
|
2889
2894
|
|
|
2890
2895
|
// src/components/capabilities/capabilities-tab.tsx
|
|
2891
|
-
import { useState as useState10, useCallback as useCallback5, useEffect as useEffect4, useMemo as
|
|
2896
|
+
import { useState as useState10, useCallback as useCallback5, useEffect as useEffect4, useMemo as useMemo7 } from "react";
|
|
2892
2897
|
import {
|
|
2893
2898
|
Accordion,
|
|
2894
2899
|
AccordionItem,
|
|
@@ -3051,7 +3056,7 @@ function CapabilitiesTab({ config, agentId }) {
|
|
|
3051
3056
|
useEffect4(() => {
|
|
3052
3057
|
setInitialized(false);
|
|
3053
3058
|
}, [agentId]);
|
|
3054
|
-
const hasChanges =
|
|
3059
|
+
const hasChanges = useMemo7(
|
|
3055
3060
|
() => initialized && (!statesEqual(localState, serverState) || !instructionsEqual(localInstructions, serverInstructions, localState)),
|
|
3056
3061
|
[localState, serverState, localInstructions, serverInstructions, initialized]
|
|
3057
3062
|
);
|
|
@@ -3323,7 +3328,7 @@ function ModuleRow({
|
|
|
3323
3328
|
}
|
|
3324
3329
|
|
|
3325
3330
|
// src/components/capabilities/integrations-tab.tsx
|
|
3326
|
-
import { useCallback as useCallback6, useState as useState11, useEffect as useEffect5, useMemo as
|
|
3331
|
+
import { useCallback as useCallback6, useState as useState11, useEffect as useEffect5, useMemo as useMemo8 } from "react";
|
|
3327
3332
|
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
3333
|
import { Plug, Loader2 as Loader25, ChevronDown as ChevronDown2, Pencil as Pencil4 } from "lucide-react";
|
|
3329
3334
|
import { toast as toast8 } from "sonner";
|
|
@@ -3413,7 +3418,7 @@ function IntegrationsTab({
|
|
|
3413
3418
|
setServerState(JSON.parse(JSON.stringify(state, (_k, v) => v instanceof Set ? [...v] : v)));
|
|
3414
3419
|
setInitialized(true);
|
|
3415
3420
|
}, [connectedCards, agentTools, initialized]);
|
|
3416
|
-
const hasChanges =
|
|
3421
|
+
const hasChanges = useMemo8(() => {
|
|
3417
3422
|
if (!initialized) return false;
|
|
3418
3423
|
const localKeys = Object.keys(localState);
|
|
3419
3424
|
for (const slug of localKeys) {
|
|
@@ -3768,13 +3773,13 @@ import {
|
|
|
3768
3773
|
Popover,
|
|
3769
3774
|
PopoverContent,
|
|
3770
3775
|
PopoverTrigger,
|
|
3771
|
-
Input as
|
|
3772
|
-
Textarea as
|
|
3773
|
-
Dialog as
|
|
3774
|
-
DialogContent as
|
|
3775
|
-
DialogHeader as
|
|
3776
|
-
DialogTitle as
|
|
3777
|
-
DialogFooter
|
|
3776
|
+
Input as Input5,
|
|
3777
|
+
Textarea as Textarea3,
|
|
3778
|
+
Dialog as Dialog2,
|
|
3779
|
+
DialogContent as DialogContent2,
|
|
3780
|
+
DialogHeader as DialogHeader2,
|
|
3781
|
+
DialogTitle as DialogTitle2,
|
|
3782
|
+
DialogFooter,
|
|
3778
3783
|
Label as Label5,
|
|
3779
3784
|
Select,
|
|
3780
3785
|
SelectContent,
|
|
@@ -3907,7 +3912,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
3907
3912
|
] }) }),
|
|
3908
3913
|
/* @__PURE__ */ jsxs13(PopoverContent, { className: "w-72 p-0", align: "end", children: [
|
|
3909
3914
|
/* @__PURE__ */ jsx15("div", { className: "p-2", children: /* @__PURE__ */ jsx15(
|
|
3910
|
-
|
|
3915
|
+
Input5,
|
|
3911
3916
|
{
|
|
3912
3917
|
placeholder: "Buscar ferramenta\\u2026",
|
|
3913
3918
|
"aria-label": "Buscar ferramenta",
|
|
@@ -3990,12 +3995,12 @@ function AgentToolsList({ agent, config }) {
|
|
|
3990
3995
|
);
|
|
3991
3996
|
}) }),
|
|
3992
3997
|
/* @__PURE__ */ jsx15(
|
|
3993
|
-
|
|
3998
|
+
Dialog2,
|
|
3994
3999
|
{
|
|
3995
4000
|
open: !!configTarget,
|
|
3996
4001
|
onOpenChange: (open) => !open && setConfigTarget(null),
|
|
3997
|
-
children: /* @__PURE__ */ jsxs13(
|
|
3998
|
-
/* @__PURE__ */ jsx15(
|
|
4002
|
+
children: /* @__PURE__ */ jsxs13(DialogContent2, { className: "sm:max-w-lg", children: [
|
|
4003
|
+
/* @__PURE__ */ jsx15(DialogHeader2, { children: /* @__PURE__ */ jsx15(DialogTitle2, { children: "Instru\xE7\xF5es da Ferramenta" }) }),
|
|
3999
4004
|
/* @__PURE__ */ jsxs13("div", { className: "space-y-4", children: [
|
|
4000
4005
|
configTarget && getToolInfo(configTarget.id_tool)?.type !== "none" && /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
|
|
4001
4006
|
/* @__PURE__ */ jsx15(Label5, { htmlFor: "tool-credential", children: "Credencial" }),
|
|
@@ -4018,7 +4023,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
4018
4023
|
/* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
|
|
4019
4024
|
/* @__PURE__ */ jsx15(Label5, { htmlFor: "tool-instructions", children: "Instru\xE7\xF5es Personalizadas" }),
|
|
4020
4025
|
/* @__PURE__ */ jsx15(
|
|
4021
|
-
|
|
4026
|
+
Textarea3,
|
|
4022
4027
|
{
|
|
4023
4028
|
id: "tool-instructions",
|
|
4024
4029
|
name: "instructions",
|
|
@@ -4031,7 +4036,7 @@ function AgentToolsList({ agent, config }) {
|
|
|
4031
4036
|
/* @__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
4037
|
] })
|
|
4033
4038
|
] }),
|
|
4034
|
-
/* @__PURE__ */ jsxs13(
|
|
4039
|
+
/* @__PURE__ */ jsxs13(DialogFooter, { children: [
|
|
4035
4040
|
/* @__PURE__ */ jsx15(
|
|
4036
4041
|
Button11,
|
|
4037
4042
|
{
|
|
@@ -4080,10 +4085,10 @@ function AgentToolsList({ agent, config }) {
|
|
|
4080
4085
|
}
|
|
4081
4086
|
|
|
4082
4087
|
// src/components/tools/tools-table.tsx
|
|
4083
|
-
import { useMemo as
|
|
4088
|
+
import { useMemo as useMemo9, useState as useState13 } from "react";
|
|
4084
4089
|
import { DataTable as DataTable2 } from "@greatapps/greatauth-ui";
|
|
4085
4090
|
import {
|
|
4086
|
-
Input as
|
|
4091
|
+
Input as Input6,
|
|
4087
4092
|
Badge as Badge7,
|
|
4088
4093
|
Tooltip as Tooltip3,
|
|
4089
4094
|
TooltipTrigger as TooltipTrigger3,
|
|
@@ -4177,7 +4182,7 @@ function useColumns2(onEdit, onDelete) {
|
|
|
4177
4182
|
function ToolsTable({ onEdit, config }) {
|
|
4178
4183
|
const [search, setSearch] = useState13("");
|
|
4179
4184
|
const [page, setPage] = useState13(1);
|
|
4180
|
-
const queryParams =
|
|
4185
|
+
const queryParams = useMemo9(() => {
|
|
4181
4186
|
const params = {
|
|
4182
4187
|
limit: "15",
|
|
4183
4188
|
page: String(page)
|
|
@@ -4215,7 +4220,7 @@ function ToolsTable({ onEdit, config }) {
|
|
|
4215
4220
|
/* @__PURE__ */ jsx16("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs14("div", { className: "relative flex-1 max-w-md", children: [
|
|
4216
4221
|
/* @__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
4222
|
/* @__PURE__ */ jsx16(
|
|
4218
|
-
|
|
4223
|
+
Input6,
|
|
4219
4224
|
{
|
|
4220
4225
|
placeholder: "Buscar ferramentas\\u2026",
|
|
4221
4226
|
"aria-label": "Buscar ferramentas",
|
|
@@ -4272,14 +4277,14 @@ function ToolsTable({ onEdit, config }) {
|
|
|
4272
4277
|
// src/components/tools/tool-form-dialog.tsx
|
|
4273
4278
|
import { useState as useState14 } from "react";
|
|
4274
4279
|
import {
|
|
4275
|
-
Dialog as
|
|
4276
|
-
DialogContent as
|
|
4277
|
-
DialogHeader as
|
|
4278
|
-
DialogTitle as
|
|
4279
|
-
DialogFooter as
|
|
4280
|
+
Dialog as Dialog3,
|
|
4281
|
+
DialogContent as DialogContent3,
|
|
4282
|
+
DialogHeader as DialogHeader3,
|
|
4283
|
+
DialogTitle as DialogTitle3,
|
|
4284
|
+
DialogFooter as DialogFooter2,
|
|
4280
4285
|
Button as Button13,
|
|
4281
|
-
Input as
|
|
4282
|
-
Textarea as
|
|
4286
|
+
Input as Input7,
|
|
4287
|
+
Textarea as Textarea4,
|
|
4283
4288
|
Label as Label6,
|
|
4284
4289
|
Select as Select2,
|
|
4285
4290
|
SelectContent as SelectContent2,
|
|
@@ -4399,13 +4404,13 @@ function ToolFormDialog({
|
|
|
4399
4404
|
);
|
|
4400
4405
|
}
|
|
4401
4406
|
}
|
|
4402
|
-
return /* @__PURE__ */ jsx17(
|
|
4403
|
-
/* @__PURE__ */ jsx17(
|
|
4407
|
+
return /* @__PURE__ */ jsx17(Dialog3, { open, onOpenChange, children: /* @__PURE__ */ jsxs15(DialogContent3, { className: "sm:max-w-lg", children: [
|
|
4408
|
+
/* @__PURE__ */ jsx17(DialogHeader3, { children: /* @__PURE__ */ jsx17(DialogTitle3, { children: isEditing ? "Editar Ferramenta" : "Nova Ferramenta" }) }),
|
|
4404
4409
|
/* @__PURE__ */ jsxs15("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
|
|
4405
4410
|
/* @__PURE__ */ jsxs15("div", { className: "space-y-2", children: [
|
|
4406
4411
|
/* @__PURE__ */ jsx17(Label6, { htmlFor: "tool-name", children: "Nome *" }),
|
|
4407
4412
|
/* @__PURE__ */ jsx17(
|
|
4408
|
-
|
|
4413
|
+
Input7,
|
|
4409
4414
|
{
|
|
4410
4415
|
id: "tool-name",
|
|
4411
4416
|
name: "name",
|
|
@@ -4428,7 +4433,7 @@ function ToolFormDialog({
|
|
|
4428
4433
|
/* @__PURE__ */ jsxs15("div", { className: "space-y-2", children: [
|
|
4429
4434
|
/* @__PURE__ */ jsx17(Label6, { htmlFor: "tool-slug", children: "Slug (identificador \xFAnico) *" }),
|
|
4430
4435
|
/* @__PURE__ */ jsx17(
|
|
4431
|
-
|
|
4436
|
+
Input7,
|
|
4432
4437
|
{
|
|
4433
4438
|
id: "tool-slug",
|
|
4434
4439
|
name: "slug",
|
|
@@ -4474,7 +4479,7 @@ function ToolFormDialog({
|
|
|
4474
4479
|
/* @__PURE__ */ jsxs15("div", { className: "space-y-2", children: [
|
|
4475
4480
|
/* @__PURE__ */ jsx17(Label6, { htmlFor: "tool-description", children: "Descri\xE7\xE3o" }),
|
|
4476
4481
|
/* @__PURE__ */ jsx17(
|
|
4477
|
-
|
|
4482
|
+
Textarea4,
|
|
4478
4483
|
{
|
|
4479
4484
|
id: "tool-description",
|
|
4480
4485
|
name: "description",
|
|
@@ -4489,7 +4494,7 @@ function ToolFormDialog({
|
|
|
4489
4494
|
/* @__PURE__ */ jsxs15("div", { className: "space-y-2", children: [
|
|
4490
4495
|
/* @__PURE__ */ jsx17(Label6, { htmlFor: "tool-function-defs", children: "Defini\xE7\xF5es de Fun\xE7\xE3o (JSON)" }),
|
|
4491
4496
|
/* @__PURE__ */ jsx17(
|
|
4492
|
-
|
|
4497
|
+
Textarea4,
|
|
4493
4498
|
{
|
|
4494
4499
|
id: "tool-function-defs",
|
|
4495
4500
|
name: "functionDefs",
|
|
@@ -4523,7 +4528,7 @@ function ToolFormDialog({
|
|
|
4523
4528
|
/* @__PURE__ */ jsx17("p", { className: "text-xs text-muted-foreground", children: "Array de defini\xE7\xF5es no formato OpenAI Function Calling." }),
|
|
4524
4529
|
form.jsonError && /* @__PURE__ */ jsx17("p", { className: "text-sm text-destructive", children: "JSON inv\xE1lido" })
|
|
4525
4530
|
] }),
|
|
4526
|
-
/* @__PURE__ */ jsxs15(
|
|
4531
|
+
/* @__PURE__ */ jsxs15(DialogFooter2, { children: [
|
|
4527
4532
|
/* @__PURE__ */ jsx17(
|
|
4528
4533
|
Button13,
|
|
4529
4534
|
{
|
|
@@ -4544,10 +4549,10 @@ function ToolFormDialog({
|
|
|
4544
4549
|
}
|
|
4545
4550
|
|
|
4546
4551
|
// src/components/tools/tool-credentials-form.tsx
|
|
4547
|
-
import { useMemo as
|
|
4552
|
+
import { useMemo as useMemo10, useState as useState15 } from "react";
|
|
4548
4553
|
import { DataTable as DataTable3 } from "@greatapps/greatauth-ui";
|
|
4549
4554
|
import {
|
|
4550
|
-
Input as
|
|
4555
|
+
Input as Input8,
|
|
4551
4556
|
Button as Button14,
|
|
4552
4557
|
Badge as Badge8,
|
|
4553
4558
|
Tooltip as Tooltip4,
|
|
@@ -4642,13 +4647,13 @@ function ToolCredentialsForm({
|
|
|
4642
4647
|
const tools = (toolsData?.data || []).filter((t) => !t.slug?.startsWith("gclinic_"));
|
|
4643
4648
|
const [search, setSearch] = useState15("");
|
|
4644
4649
|
const [removeTarget, setRemoveTarget] = useState15(null);
|
|
4645
|
-
const internalToolIds =
|
|
4650
|
+
const internalToolIds = useMemo10(() => {
|
|
4646
4651
|
const allRawTools = toolsData?.data || [];
|
|
4647
4652
|
return new Set(
|
|
4648
4653
|
allRawTools.filter((t) => t.slug?.startsWith("gclinic_")).map((t) => t.id)
|
|
4649
4654
|
);
|
|
4650
4655
|
}, [toolsData]);
|
|
4651
|
-
const filteredCredentials =
|
|
4656
|
+
const filteredCredentials = useMemo10(() => {
|
|
4652
4657
|
const visible = credentials.filter(
|
|
4653
4658
|
(cred) => !cred.id_tool || !internalToolIds.has(cred.id_tool)
|
|
4654
4659
|
);
|
|
@@ -4682,7 +4687,7 @@ function ToolCredentialsForm({
|
|
|
4682
4687
|
/* @__PURE__ */ jsx18("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs16("div", { className: "relative flex-1 max-w-md", children: [
|
|
4683
4688
|
/* @__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
4689
|
/* @__PURE__ */ jsx18(
|
|
4685
|
-
|
|
4690
|
+
Input8,
|
|
4686
4691
|
{
|
|
4687
4692
|
placeholder: "Buscar credenciais\\u2026",
|
|
4688
4693
|
"aria-label": "Buscar credenciais",
|
|
@@ -5006,11 +5011,11 @@ function AdvancedTab({ config, agentId, gagentsApiUrl }) {
|
|
|
5006
5011
|
// src/components/capabilities/integration-wizard.tsx
|
|
5007
5012
|
import { useCallback as useCallback7, useEffect as useEffect6, useRef as useRef3, useState as useState18 } from "react";
|
|
5008
5013
|
import {
|
|
5009
|
-
Dialog as
|
|
5010
|
-
DialogContent as
|
|
5011
|
-
DialogFooter as
|
|
5012
|
-
DialogHeader as
|
|
5013
|
-
DialogTitle as
|
|
5014
|
+
Dialog as Dialog4,
|
|
5015
|
+
DialogContent as DialogContent4,
|
|
5016
|
+
DialogFooter as DialogFooter3,
|
|
5017
|
+
DialogHeader as DialogHeader4,
|
|
5018
|
+
DialogTitle as DialogTitle4,
|
|
5014
5019
|
Button as Button17
|
|
5015
5020
|
} from "@greatapps/greatauth-ui/ui";
|
|
5016
5021
|
import { Loader2 as Loader29, ChevronLeft, ChevronRight, Check as Check2 } from "lucide-react";
|
|
@@ -5073,7 +5078,7 @@ function InfoStep({ integration, meta }) {
|
|
|
5073
5078
|
|
|
5074
5079
|
// src/components/capabilities/wizard-steps/credentials-step.tsx
|
|
5075
5080
|
import { CheckCircle2, Loader2 as Loader27, AlertCircle, Shield } from "lucide-react";
|
|
5076
|
-
import { Button as Button16, Input as
|
|
5081
|
+
import { Button as Button16, Input as Input9, Label as Label7 } from "@greatapps/greatauth-ui/ui";
|
|
5077
5082
|
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5078
5083
|
function CredentialsStep({
|
|
5079
5084
|
integration,
|
|
@@ -5196,7 +5201,7 @@ function ApiKeyCredentials({
|
|
|
5196
5201
|
/* @__PURE__ */ jsxs20("div", { className: "space-y-2", children: [
|
|
5197
5202
|
/* @__PURE__ */ jsx22(Label7, { htmlFor: "integration-api-key", children: "Chave de API" }),
|
|
5198
5203
|
/* @__PURE__ */ jsx22(
|
|
5199
|
-
|
|
5204
|
+
Input9,
|
|
5200
5205
|
{
|
|
5201
5206
|
id: "integration-api-key",
|
|
5202
5207
|
type: "password",
|
|
@@ -5598,8 +5603,8 @@ function IntegrationWizard({
|
|
|
5598
5603
|
const selectedConfigOption = configOptions.find((o) => o.id === selectedConfigValue) || null;
|
|
5599
5604
|
const isLastStep = currentStep === "confirm";
|
|
5600
5605
|
const effectiveSteps = meta.hasConfigStep ? STEPS : STEPS.filter((s) => s !== "config");
|
|
5601
|
-
return /* @__PURE__ */ jsx25(
|
|
5602
|
-
/* @__PURE__ */ jsx25(
|
|
5606
|
+
return /* @__PURE__ */ jsx25(Dialog4, { open, onOpenChange, children: /* @__PURE__ */ jsxs23(DialogContent4, { className: "sm:max-w-lg", children: [
|
|
5607
|
+
/* @__PURE__ */ jsx25(DialogHeader4, { children: /* @__PURE__ */ jsx25(DialogTitle4, { children: integration.name }) }),
|
|
5603
5608
|
/* @__PURE__ */ jsx25(StepIndicator, { steps: effectiveSteps, currentStep }),
|
|
5604
5609
|
/* @__PURE__ */ jsxs23("div", { className: "min-h-[280px] py-2", children: [
|
|
5605
5610
|
currentStep === "info" && /* @__PURE__ */ jsx25(
|
|
@@ -5643,7 +5648,7 @@ function IntegrationWizard({
|
|
|
5643
5648
|
}
|
|
5644
5649
|
)
|
|
5645
5650
|
] }),
|
|
5646
|
-
/* @__PURE__ */ jsxs23(
|
|
5651
|
+
/* @__PURE__ */ jsxs23(DialogFooter3, { className: "flex-row justify-between sm:justify-between", children: [
|
|
5647
5652
|
/* @__PURE__ */ jsx25("div", { children: currentStep === "info" ? /* @__PURE__ */ jsx25(
|
|
5648
5653
|
Button17,
|
|
5649
5654
|
{
|