@dolfinhos/studio 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +273 -155
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -3
- package/dist/index.d.ts +23 -3
- package/dist/index.js +270 -153
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -63,7 +63,10 @@ function createStudioClient(options = {}) {
|
|
|
63
63
|
searchKnowledge: (query, audience) => request("GET", `/knowledge/search${q({ q: query, audience })}`),
|
|
64
64
|
factSubjects: (type) => request("GET", `/facts${q({ type })}`),
|
|
65
65
|
facts: (subject) => request("GET", `/facts${q({ type: subject.type, id: subject.id })}`),
|
|
66
|
-
forget: (id) => request("DELETE", `/facts/${encodeURIComponent(id)}`)
|
|
66
|
+
forget: (id) => request("DELETE", `/facts/${encodeURIComponent(id)}`),
|
|
67
|
+
credentials: () => request("GET", "/credentials"),
|
|
68
|
+
saveCredential: (name, value) => request("PUT", `/credentials/${encodeURIComponent(name)}`, { value }),
|
|
69
|
+
removeCredential: (name) => request("DELETE", `/credentials/${encodeURIComponent(name)}`)
|
|
67
70
|
};
|
|
68
71
|
}
|
|
69
72
|
var StudioContext = createContext(null);
|
|
@@ -678,20 +681,131 @@ function BehaviorSettings({ currency }) {
|
|
|
678
681
|
] });
|
|
679
682
|
}
|
|
680
683
|
|
|
681
|
-
// src/
|
|
684
|
+
// src/Keys.tsx
|
|
682
685
|
import { useId as useId4, useState as useState6 } from "react";
|
|
683
|
-
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
686
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
687
|
+
function ProviderKey({ provider, onChanged }) {
|
|
688
|
+
const { client, locale } = useStudio();
|
|
689
|
+
const id = useId4();
|
|
690
|
+
const [editing, setEditing] = useState6(!provider.configured);
|
|
691
|
+
const [value, setValue] = useState6("");
|
|
692
|
+
const [busy, setBusy] = useState6(null);
|
|
693
|
+
const [message, setMessage] = useState6(null);
|
|
694
|
+
async function save() {
|
|
695
|
+
setBusy("save");
|
|
696
|
+
setMessage(null);
|
|
697
|
+
try {
|
|
698
|
+
await client.saveCredential(provider.name, value.trim());
|
|
699
|
+
setValue("");
|
|
700
|
+
setEditing(false);
|
|
701
|
+
setMessage({ tone: "success", text: "Chave testada e salva. A partir de agora o uso de IA desta empresa vai para esta conta." });
|
|
702
|
+
await onChanged();
|
|
703
|
+
} catch (e) {
|
|
704
|
+
setMessage({ tone: "error", text: e instanceof Error ? e.message : String(e) });
|
|
705
|
+
} finally {
|
|
706
|
+
setBusy(null);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
async function remove() {
|
|
710
|
+
if (!window.confirm(`Remover a chave da ${provider.label}? O assistente e o bot deixam de usar esta conta.${provider.whenMissing ? ` ${provider.whenMissing}` : ""}`)) return;
|
|
711
|
+
setBusy("remove");
|
|
712
|
+
setMessage(null);
|
|
713
|
+
try {
|
|
714
|
+
await client.removeCredential(provider.name);
|
|
715
|
+
setEditing(true);
|
|
716
|
+
setMessage({ tone: "success", text: "Chave removida." });
|
|
717
|
+
await onChanged();
|
|
718
|
+
} catch (e) {
|
|
719
|
+
setMessage({ tone: "error", text: e instanceof Error ? e.message : String(e) });
|
|
720
|
+
} finally {
|
|
721
|
+
setBusy(null);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
return /* @__PURE__ */ jsxs6("li", { className: "dlf-item", children: [
|
|
725
|
+
/* @__PURE__ */ jsxs6("div", { className: "dlf-item-row", children: [
|
|
726
|
+
/* @__PURE__ */ jsxs6("div", { style: { minWidth: 0 }, children: [
|
|
727
|
+
/* @__PURE__ */ jsx6("p", { className: "dlf-item-title", children: provider.label }),
|
|
728
|
+
provider.configured && provider.updatedAt ? /* @__PURE__ */ jsxs6("p", { className: "dlf-item-meta", children: [
|
|
729
|
+
"Chave terminada em ",
|
|
730
|
+
/* @__PURE__ */ jsxs6("span", { translate: "no", style: { fontVariantNumeric: "tabular-nums" }, children: [
|
|
731
|
+
"\u2026",
|
|
732
|
+
provider.last4
|
|
733
|
+
] }),
|
|
734
|
+
" \xB7 salva em",
|
|
735
|
+
" ",
|
|
736
|
+
/* @__PURE__ */ jsx6("time", { dateTime: provider.updatedAt, children: formatDateTime(provider.updatedAt, locale) })
|
|
737
|
+
] }) : /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
738
|
+
provider.description && /* @__PURE__ */ jsx6("p", { className: "dlf-item-meta", children: provider.description }),
|
|
739
|
+
provider.whenMissing && /* @__PURE__ */ jsx6("p", { className: "dlf-item-meta", children: provider.whenMissing })
|
|
740
|
+
] })
|
|
741
|
+
] }),
|
|
742
|
+
/* @__PURE__ */ jsxs6("div", { className: "dlf-actions", children: [
|
|
743
|
+
provider.configured ? /* @__PURE__ */ jsx6(Badge, { tone: "success", children: "Configurada" }) : /* @__PURE__ */ jsx6(Badge, { children: "Sem chave" }),
|
|
744
|
+
provider.configured && !editing && /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
745
|
+
/* @__PURE__ */ jsx6(Button, { variant: "ghost", disabled: !!busy, onClick: () => setEditing(true), children: "Trocar" }),
|
|
746
|
+
/* @__PURE__ */ jsx6(Button, { variant: "ghost", loading: busy === "remove", disabled: !!busy, onClick: remove, children: "Remover" })
|
|
747
|
+
] })
|
|
748
|
+
] })
|
|
749
|
+
] }),
|
|
750
|
+
message && /* @__PURE__ */ jsx6(Notice, { tone: message.tone, children: message.text }),
|
|
751
|
+
editing && /* @__PURE__ */ jsxs6(
|
|
752
|
+
"form",
|
|
753
|
+
{
|
|
754
|
+
className: "dlf-field",
|
|
755
|
+
style: { gap: "0.75rem", maxWidth: "32rem" },
|
|
756
|
+
onSubmit: (e) => {
|
|
757
|
+
e.preventDefault();
|
|
758
|
+
void save();
|
|
759
|
+
},
|
|
760
|
+
children: [
|
|
761
|
+
/* @__PURE__ */ jsx6(Field, { label: provider.configured ? "Nova chave" : "Chave de API", htmlFor: `${id}-chave`, hint: "A chave \xE9 testada no provedor antes de salvar e fica criptografada. Ningu\xE9m consegue v\xEA-la depois, nem aqui.", children: /* @__PURE__ */ jsx6(
|
|
762
|
+
"input",
|
|
763
|
+
{
|
|
764
|
+
id: `${id}-chave`,
|
|
765
|
+
className: "dlf-input",
|
|
766
|
+
type: "password",
|
|
767
|
+
autoComplete: "off",
|
|
768
|
+
spellCheck: false,
|
|
769
|
+
maxLength: 500,
|
|
770
|
+
placeholder: "sk-\u2026",
|
|
771
|
+
value,
|
|
772
|
+
onChange: (e) => setValue(e.target.value)
|
|
773
|
+
}
|
|
774
|
+
) }),
|
|
775
|
+
/* @__PURE__ */ jsxs6("div", { className: "dlf-actions", children: [
|
|
776
|
+
/* @__PURE__ */ jsx6(Button, { type: "submit", variant: "primary", loading: busy === "save", disabled: value.trim().length < 8, children: "Testar e salvar" }),
|
|
777
|
+
provider.configured && /* @__PURE__ */ jsx6(Button, { variant: "ghost", onClick: () => setEditing(false), children: "Cancelar" })
|
|
778
|
+
] })
|
|
779
|
+
]
|
|
780
|
+
}
|
|
781
|
+
)
|
|
782
|
+
] });
|
|
783
|
+
}
|
|
784
|
+
function ProviderKeys() {
|
|
785
|
+
const { client } = useStudio();
|
|
786
|
+
const list = useResource(() => client.credentials(), [client]);
|
|
787
|
+
return /* @__PURE__ */ jsxs6(Section, { title: "Chave de IA", description: "A conta do provedor de IA que esta empresa usa. O gasto do assistente, do bot e das automa\xE7\xF5es vai para ela, e a aba Custos mostra quanto.", children: [
|
|
788
|
+
list.error && /* @__PURE__ */ jsx6(Notice, { tone: "error", children: list.error }),
|
|
789
|
+
list.loading && !list.data && /* @__PURE__ */ jsx6(Loading, {}),
|
|
790
|
+
list.data && !list.data.length && /* @__PURE__ */ jsx6(Empty, { title: "A aplica\xE7\xE3o n\xE3o usa chaves por empresa" }),
|
|
791
|
+
!!list.data?.length && /* @__PURE__ */ jsx6("ul", { className: "dlf-list", children: list.data.map((p) => /* @__PURE__ */ jsx6(ProviderKey, { provider: p, onChanged: list.reload }, p.name)) })
|
|
792
|
+
] });
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
// src/Knowledge.tsx
|
|
796
|
+
import { useId as useId5, useState as useState7 } from "react";
|
|
797
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
684
798
|
function KnowledgeBase() {
|
|
685
799
|
const { client, locale } = useStudio();
|
|
686
|
-
const ids =
|
|
800
|
+
const ids = useId5();
|
|
687
801
|
const docs = useResource(() => client.knowledge(), [client]);
|
|
688
|
-
const [draft, setDraft] =
|
|
689
|
-
const [saving, setSaving] =
|
|
690
|
-
const [message, setMessage] =
|
|
691
|
-
const [query, setQuery] =
|
|
692
|
-
const [queryAudience, setQueryAudience] =
|
|
693
|
-
const [hits, setHits] =
|
|
694
|
-
const [searching, setSearching] =
|
|
802
|
+
const [draft, setDraft] = useState7(null);
|
|
803
|
+
const [saving, setSaving] = useState7(null);
|
|
804
|
+
const [message, setMessage] = useState7(null);
|
|
805
|
+
const [query, setQuery] = useState7("");
|
|
806
|
+
const [queryAudience, setQueryAudience] = useState7("all");
|
|
807
|
+
const [hits, setHits] = useState7(null);
|
|
808
|
+
const [searching, setSearching] = useState7(false);
|
|
695
809
|
async function save() {
|
|
696
810
|
if (!draft) return;
|
|
697
811
|
setSaving("form");
|
|
@@ -732,34 +846,34 @@ function KnowledgeBase() {
|
|
|
732
846
|
setSearching(false);
|
|
733
847
|
}
|
|
734
848
|
}
|
|
735
|
-
return /* @__PURE__ */
|
|
736
|
-
/* @__PURE__ */
|
|
849
|
+
return /* @__PURE__ */ jsxs7("div", { className: "dlf-stack", children: [
|
|
850
|
+
/* @__PURE__ */ jsxs7(
|
|
737
851
|
Section,
|
|
738
852
|
{
|
|
739
853
|
title: "Base de conhecimento",
|
|
740
854
|
description: "O que o assistente e o bot consultam antes de responder: perguntas frequentes, pol\xEDticas, explica\xE7\xF5es de produtos. Documentos internos nunca chegam ao bot de atendimento.",
|
|
741
|
-
actions: !draft && /* @__PURE__ */
|
|
855
|
+
actions: !draft && /* @__PURE__ */ jsx7(Button, { onClick: () => setDraft({ title: "", content: "", audience: "internal", tags: [] }), disabled: !!saving, children: "Novo documento" }),
|
|
742
856
|
children: [
|
|
743
|
-
message && /* @__PURE__ */
|
|
744
|
-
docs.error && /* @__PURE__ */
|
|
745
|
-
docs.loading && !docs.data && /* @__PURE__ */
|
|
746
|
-
docs.data && !docs.data.length && !draft && /* @__PURE__ */
|
|
747
|
-
!!docs.data?.length && /* @__PURE__ */
|
|
748
|
-
/* @__PURE__ */
|
|
749
|
-
/* @__PURE__ */
|
|
750
|
-
/* @__PURE__ */
|
|
857
|
+
message && /* @__PURE__ */ jsx7(Notice, { tone: message.tone, children: message.text }),
|
|
858
|
+
docs.error && /* @__PURE__ */ jsx7(Notice, { tone: "error", children: docs.error }),
|
|
859
|
+
docs.loading && !docs.data && /* @__PURE__ */ jsx7(Loading, {}),
|
|
860
|
+
docs.data && !docs.data.length && !draft && /* @__PURE__ */ jsx7(Empty, { title: "Nenhum documento", children: "Comece pelas perguntas que os clientes mais fazem e pela pol\xEDtica de trocas e pagamentos." }),
|
|
861
|
+
!!docs.data?.length && /* @__PURE__ */ jsx7("ul", { className: "dlf-list", children: docs.data.map((doc) => /* @__PURE__ */ jsx7("li", { className: "dlf-item", children: /* @__PURE__ */ jsxs7("div", { className: "dlf-item-row", children: [
|
|
862
|
+
/* @__PURE__ */ jsxs7("div", { style: { minWidth: 0 }, children: [
|
|
863
|
+
/* @__PURE__ */ jsx7("p", { className: "dlf-item-title", children: doc.title }),
|
|
864
|
+
/* @__PURE__ */ jsxs7("p", { className: "dlf-item-meta", children: [
|
|
751
865
|
doc.content.length.toLocaleString(locale),
|
|
752
866
|
" caracteres \xB7 atualizado em ",
|
|
753
|
-
/* @__PURE__ */
|
|
867
|
+
/* @__PURE__ */ jsx7("time", { dateTime: doc.updatedAt, children: formatDateTime(doc.updatedAt, locale) })
|
|
754
868
|
] })
|
|
755
869
|
] }),
|
|
756
|
-
/* @__PURE__ */
|
|
757
|
-
doc.audience === "all" ? /* @__PURE__ */
|
|
758
|
-
/* @__PURE__ */
|
|
759
|
-
/* @__PURE__ */
|
|
870
|
+
/* @__PURE__ */ jsxs7("div", { className: "dlf-actions", children: [
|
|
871
|
+
doc.audience === "all" ? /* @__PURE__ */ jsx7(Badge, { tone: "accent", children: "Equipe e clientes" }) : /* @__PURE__ */ jsx7(Badge, { children: "S\xF3 a equipe" }),
|
|
872
|
+
/* @__PURE__ */ jsx7(Button, { variant: "ghost", disabled: !!saving, onClick: () => setDraft({ id: doc.id, title: doc.title, content: doc.content, audience: doc.audience, tags: doc.tags }), children: "Editar" }),
|
|
873
|
+
/* @__PURE__ */ jsx7(Button, { variant: "ghost", loading: saving === doc.id, disabled: !!saving, onClick: () => remove(doc), children: "Excluir" })
|
|
760
874
|
] })
|
|
761
875
|
] }) }, doc.id)) }),
|
|
762
|
-
draft && /* @__PURE__ */
|
|
876
|
+
draft && /* @__PURE__ */ jsxs7(
|
|
763
877
|
"form",
|
|
764
878
|
{
|
|
765
879
|
className: "dlf-form",
|
|
@@ -769,28 +883,28 @@ function KnowledgeBase() {
|
|
|
769
883
|
void save();
|
|
770
884
|
},
|
|
771
885
|
children: [
|
|
772
|
-
/* @__PURE__ */
|
|
773
|
-
/* @__PURE__ */
|
|
774
|
-
/* @__PURE__ */
|
|
775
|
-
/* @__PURE__ */
|
|
776
|
-
/* @__PURE__ */
|
|
777
|
-
/* @__PURE__ */
|
|
778
|
-
/* @__PURE__ */
|
|
886
|
+
/* @__PURE__ */ jsx7(Field, { label: "T\xEDtulo", htmlFor: `${ids}-titulo`, children: /* @__PURE__ */ jsx7("input", { id: `${ids}-titulo`, className: "dlf-input", required: true, maxLength: 200, autoComplete: "off", placeholder: "Ex.: Pol\xEDtica de trocas\u2026", value: draft.title, onChange: (e) => setDraft({ ...draft, title: e.target.value }) }) }),
|
|
887
|
+
/* @__PURE__ */ jsx7(Field, { label: "Conte\xFAdo", htmlFor: `${ids}-conteudo`, hint: "Texto simples. Separe assuntos em par\xE1grafos: a busca devolve o trecho mais relevante.", children: /* @__PURE__ */ jsx7("textarea", { id: `${ids}-conteudo`, className: "dlf-textarea", required: true, rows: 12, maxLength: 1e5, value: draft.content, onChange: (e) => setDraft({ ...draft, content: e.target.value }) }) }),
|
|
888
|
+
/* @__PURE__ */ jsxs7("fieldset", { className: "dlf-field", style: { border: 0, padding: 0, margin: 0 }, children: [
|
|
889
|
+
/* @__PURE__ */ jsx7("legend", { className: "dlf-label", children: "Quem pode ler" }),
|
|
890
|
+
/* @__PURE__ */ jsxs7("label", { className: "dlf-choice", children: [
|
|
891
|
+
/* @__PURE__ */ jsx7("input", { type: "radio", name: `${ids}-publico`, checked: draft.audience === "internal", onChange: () => setDraft({ ...draft, audience: "internal" }) }),
|
|
892
|
+
/* @__PURE__ */ jsxs7("span", { children: [
|
|
779
893
|
"S\xF3 a equipe ",
|
|
780
|
-
/* @__PURE__ */
|
|
894
|
+
/* @__PURE__ */ jsx7("span", { className: "dlf-muted", children: "(o assistente do painel)" })
|
|
781
895
|
] })
|
|
782
896
|
] }),
|
|
783
|
-
/* @__PURE__ */
|
|
784
|
-
/* @__PURE__ */
|
|
785
|
-
/* @__PURE__ */
|
|
897
|
+
/* @__PURE__ */ jsxs7("label", { className: "dlf-choice", children: [
|
|
898
|
+
/* @__PURE__ */ jsx7("input", { type: "radio", name: `${ids}-publico`, checked: draft.audience === "all", onChange: () => setDraft({ ...draft, audience: "all" }) }),
|
|
899
|
+
/* @__PURE__ */ jsxs7("span", { children: [
|
|
786
900
|
"Equipe e clientes ",
|
|
787
|
-
/* @__PURE__ */
|
|
901
|
+
/* @__PURE__ */ jsx7("span", { className: "dlf-muted", children: "(o bot de atendimento tamb\xE9m usa nas respostas)" })
|
|
788
902
|
] })
|
|
789
903
|
] })
|
|
790
904
|
] }),
|
|
791
|
-
/* @__PURE__ */
|
|
792
|
-
/* @__PURE__ */
|
|
793
|
-
/* @__PURE__ */
|
|
905
|
+
/* @__PURE__ */ jsxs7("div", { className: "dlf-actions", children: [
|
|
906
|
+
/* @__PURE__ */ jsx7(Button, { type: "submit", variant: "primary", loading: saving === "form", disabled: !draft.title.trim() || !draft.content.trim(), children: "Salvar documento" }),
|
|
907
|
+
/* @__PURE__ */ jsx7(Button, { variant: "ghost", onClick: () => setDraft(null), children: "Cancelar" })
|
|
794
908
|
] })
|
|
795
909
|
]
|
|
796
910
|
}
|
|
@@ -798,8 +912,8 @@ function KnowledgeBase() {
|
|
|
798
912
|
]
|
|
799
913
|
}
|
|
800
914
|
),
|
|
801
|
-
/* @__PURE__ */
|
|
802
|
-
/* @__PURE__ */
|
|
915
|
+
/* @__PURE__ */ jsxs7(Section, { title: "Testar a busca", description: "Veja o que o assistente encontra para uma pergunta.", children: [
|
|
916
|
+
/* @__PURE__ */ jsxs7(
|
|
803
917
|
"form",
|
|
804
918
|
{
|
|
805
919
|
className: "dlf-row",
|
|
@@ -809,32 +923,32 @@ function KnowledgeBase() {
|
|
|
809
923
|
void search();
|
|
810
924
|
},
|
|
811
925
|
children: [
|
|
812
|
-
/* @__PURE__ */
|
|
813
|
-
/* @__PURE__ */
|
|
814
|
-
/* @__PURE__ */
|
|
815
|
-
/* @__PURE__ */
|
|
926
|
+
/* @__PURE__ */ jsx7(Field, { label: "Pergunta", htmlFor: `${ids}-busca`, children: /* @__PURE__ */ jsx7("input", { id: `${ids}-busca`, className: "dlf-input", type: "search", autoComplete: "off", maxLength: 300, placeholder: "Ex.: qual o prazo para trocar?\u2026", value: query, onChange: (e) => setQuery(e.target.value) }) }),
|
|
927
|
+
/* @__PURE__ */ jsx7(Field, { label: "Como", htmlFor: `${ids}-como`, children: /* @__PURE__ */ jsxs7("select", { id: `${ids}-como`, className: "dlf-select", value: queryAudience, onChange: (e) => setQueryAudience(e.target.value), children: [
|
|
928
|
+
/* @__PURE__ */ jsx7("option", { value: "all", children: "O bot de atendimento veria" }),
|
|
929
|
+
/* @__PURE__ */ jsx7("option", { value: "internal", children: "O assistente da equipe veria" })
|
|
816
930
|
] }) }),
|
|
817
|
-
/* @__PURE__ */
|
|
931
|
+
/* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(Button, { type: "submit", loading: searching, disabled: !query.trim(), children: "Buscar" }) })
|
|
818
932
|
]
|
|
819
933
|
}
|
|
820
934
|
),
|
|
821
|
-
hits && !hits.length && /* @__PURE__ */
|
|
822
|
-
!!hits?.length && /* @__PURE__ */
|
|
823
|
-
/* @__PURE__ */
|
|
824
|
-
/* @__PURE__ */
|
|
935
|
+
hits && !hits.length && /* @__PURE__ */ jsx7(Empty, { title: "Nada encontrado", children: "Nesse caso o assistente diz que vai verificar, em vez de inventar." }),
|
|
936
|
+
!!hits?.length && /* @__PURE__ */ jsx7("ul", { className: "dlf-list", "aria-live": "polite", children: hits.map((h) => /* @__PURE__ */ jsxs7("li", { className: "dlf-item", children: [
|
|
937
|
+
/* @__PURE__ */ jsx7("p", { className: "dlf-item-title", children: h.title }),
|
|
938
|
+
/* @__PURE__ */ jsx7("p", { className: "dlf-item-meta dlf-measure", style: { whiteSpace: "pre-line" }, children: h.excerpt.length > 600 ? `${h.excerpt.slice(0, 600)}\u2026` : h.excerpt })
|
|
825
939
|
] }, h.docId)) })
|
|
826
940
|
] })
|
|
827
941
|
] });
|
|
828
942
|
}
|
|
829
943
|
|
|
830
944
|
// src/Memory.tsx
|
|
831
|
-
import { useState as
|
|
832
|
-
import { Fragment as
|
|
945
|
+
import { useState as useState8 } from "react";
|
|
946
|
+
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
833
947
|
function FactList({ subject, emptyText }) {
|
|
834
948
|
const { client, locale } = useStudio();
|
|
835
949
|
const facts = useResource(() => client.facts(subject), [client, subject.type, subject.id]);
|
|
836
|
-
const [removing, setRemoving] =
|
|
837
|
-
const [error, setError] =
|
|
950
|
+
const [removing, setRemoving] = useState8(null);
|
|
951
|
+
const [error, setError] = useState8(null);
|
|
838
952
|
async function forget(fact) {
|
|
839
953
|
if (!window.confirm(`Esquecer \u201C${fact.text}\u201D? O assistente deixa de usar isso nas pr\xF3ximas conversas.`)) return;
|
|
840
954
|
setRemoving(fact.id);
|
|
@@ -848,35 +962,35 @@ function FactList({ subject, emptyText }) {
|
|
|
848
962
|
setRemoving(null);
|
|
849
963
|
}
|
|
850
964
|
}
|
|
851
|
-
if (facts.error) return /* @__PURE__ */
|
|
852
|
-
if (!facts.data) return /* @__PURE__ */
|
|
853
|
-
if (!facts.data.length) return /* @__PURE__ */
|
|
854
|
-
return /* @__PURE__ */
|
|
855
|
-
error && /* @__PURE__ */
|
|
856
|
-
/* @__PURE__ */
|
|
857
|
-
/* @__PURE__ */
|
|
858
|
-
/* @__PURE__ */
|
|
859
|
-
/* @__PURE__ */
|
|
860
|
-
/* @__PURE__ */
|
|
965
|
+
if (facts.error) return /* @__PURE__ */ jsx8(Notice, { tone: "error", children: facts.error });
|
|
966
|
+
if (!facts.data) return /* @__PURE__ */ jsx8(Loading, {});
|
|
967
|
+
if (!facts.data.length) return /* @__PURE__ */ jsx8(Empty, { title: "Nada guardado", children: emptyText });
|
|
968
|
+
return /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
969
|
+
error && /* @__PURE__ */ jsx8(Notice, { tone: "error", children: error }),
|
|
970
|
+
/* @__PURE__ */ jsx8("ul", { className: "dlf-list", children: facts.data.map((f) => /* @__PURE__ */ jsx8("li", { className: "dlf-item", children: /* @__PURE__ */ jsxs8("div", { className: "dlf-item-row", children: [
|
|
971
|
+
/* @__PURE__ */ jsxs8("div", { style: { minWidth: 0 }, children: [
|
|
972
|
+
/* @__PURE__ */ jsx8("p", { className: "dlf-item-title", style: { fontWeight: 400 }, children: f.text }),
|
|
973
|
+
/* @__PURE__ */ jsxs8("p", { className: "dlf-item-meta", children: [
|
|
974
|
+
/* @__PURE__ */ jsx8("time", { dateTime: f.createdAt, children: formatDateTime(f.createdAt, locale) }),
|
|
861
975
|
f.createdBy?.name ? ` \xB7 por ${f.createdBy.name}` : f.createdBy?.type === "service" ? " \xB7 pelo bot" : ""
|
|
862
976
|
] })
|
|
863
977
|
] }),
|
|
864
|
-
/* @__PURE__ */
|
|
978
|
+
/* @__PURE__ */ jsx8(Button, { variant: "ghost", loading: removing === f.id, disabled: !!removing, onClick: () => forget(f), "aria-label": `Esquecer: ${f.text}`, children: "Esquecer" })
|
|
865
979
|
] }) }, f.id)) })
|
|
866
980
|
] });
|
|
867
981
|
}
|
|
868
982
|
function MemoryBrowser() {
|
|
869
983
|
const { client, labels, locale } = useStudio();
|
|
870
984
|
const subjects = useResource(() => client.factSubjects(), [client]);
|
|
871
|
-
const [open, setOpen] =
|
|
985
|
+
const [open, setOpen] = useState8(null);
|
|
872
986
|
const typeLabel = (type) => labels.subjects?.[type] ?? type;
|
|
873
987
|
if (open) {
|
|
874
|
-
return /* @__PURE__ */
|
|
988
|
+
return /* @__PURE__ */ jsx8(
|
|
875
989
|
Section,
|
|
876
990
|
{
|
|
877
991
|
title: open.label ?? open.id,
|
|
878
992
|
description: `${typeLabel(open.type)}. O que o assistente lembra nas pr\xF3ximas conversas. Esque\xE7a o que estiver errado ou n\xE3o deveria ser guardado.`,
|
|
879
|
-
actions: /* @__PURE__ */
|
|
993
|
+
actions: /* @__PURE__ */ jsx8(
|
|
880
994
|
Button,
|
|
881
995
|
{
|
|
882
996
|
variant: "ghost",
|
|
@@ -887,40 +1001,40 @@ function MemoryBrowser() {
|
|
|
887
1001
|
children: "Voltar para a lista"
|
|
888
1002
|
}
|
|
889
1003
|
),
|
|
890
|
-
children: /* @__PURE__ */
|
|
1004
|
+
children: /* @__PURE__ */ jsx8(FactList, { subject: open, emptyText: "Tudo foi esquecido." })
|
|
891
1005
|
}
|
|
892
1006
|
);
|
|
893
1007
|
}
|
|
894
|
-
return /* @__PURE__ */
|
|
895
|
-
subjects.error && /* @__PURE__ */
|
|
896
|
-
subjects.loading && !subjects.data && /* @__PURE__ */
|
|
897
|
-
subjects.data && !subjects.data.length && /* @__PURE__ */
|
|
898
|
-
!!subjects.data?.length && /* @__PURE__ */
|
|
899
|
-
/* @__PURE__ */
|
|
900
|
-
/* @__PURE__ */
|
|
901
|
-
/* @__PURE__ */
|
|
902
|
-
/* @__PURE__ */
|
|
903
|
-
/* @__PURE__ */
|
|
1008
|
+
return /* @__PURE__ */ jsxs8(Section, { title: "Mem\xF3ria", description: "O que o assistente e o bot guardaram sobre clientes e pessoas da equipe, de conversas anteriores.", children: [
|
|
1009
|
+
subjects.error && /* @__PURE__ */ jsx8(Notice, { tone: "error", children: subjects.error }),
|
|
1010
|
+
subjects.loading && !subjects.data && /* @__PURE__ */ jsx8(Loading, {}),
|
|
1011
|
+
subjects.data && !subjects.data.length && /* @__PURE__ */ jsx8(Empty, { title: "Nada guardado ainda", children: "O bot guarda o que o cliente conta (prefer\xEAncias, contexto) e o assistente guarda como cada pessoa gosta de trabalhar." }),
|
|
1012
|
+
!!subjects.data?.length && /* @__PURE__ */ jsx8("div", { className: "dlf-table-wrap", children: /* @__PURE__ */ jsxs8("table", { className: "dlf-table", children: [
|
|
1013
|
+
/* @__PURE__ */ jsx8("thead", { children: /* @__PURE__ */ jsxs8("tr", { children: [
|
|
1014
|
+
/* @__PURE__ */ jsx8("th", { scope: "col", children: "Sobre" }),
|
|
1015
|
+
/* @__PURE__ */ jsx8("th", { scope: "col", children: "Tipo" }),
|
|
1016
|
+
/* @__PURE__ */ jsx8("th", { scope: "col", className: "dlf-num", children: "Fatos" }),
|
|
1017
|
+
/* @__PURE__ */ jsx8("th", { scope: "col", children: "\xDAltimo" })
|
|
904
1018
|
] }) }),
|
|
905
|
-
/* @__PURE__ */
|
|
906
|
-
/* @__PURE__ */
|
|
907
|
-
/* @__PURE__ */
|
|
908
|
-
/* @__PURE__ */
|
|
909
|
-
/* @__PURE__ */
|
|
1019
|
+
/* @__PURE__ */ jsx8("tbody", { children: subjects.data.map((s) => /* @__PURE__ */ jsxs8("tr", { children: [
|
|
1020
|
+
/* @__PURE__ */ jsx8("td", { children: /* @__PURE__ */ jsx8("button", { type: "button", className: "dlf-link-button", onClick: () => setOpen(s), children: s.label ?? s.id }) }),
|
|
1021
|
+
/* @__PURE__ */ jsx8("td", { children: typeLabel(s.type) }),
|
|
1022
|
+
/* @__PURE__ */ jsx8("td", { className: "dlf-num", children: s.count }),
|
|
1023
|
+
/* @__PURE__ */ jsx8("td", { children: /* @__PURE__ */ jsx8("time", { dateTime: s.lastAt, children: formatDateTime(s.lastAt, locale) }) })
|
|
910
1024
|
] }, `${s.type}:${s.id}`)) })
|
|
911
1025
|
] }) })
|
|
912
1026
|
] });
|
|
913
1027
|
}
|
|
914
1028
|
function MyMemory({ subject }) {
|
|
915
|
-
return /* @__PURE__ */
|
|
1029
|
+
return /* @__PURE__ */ jsx8(Section, { title: "O que o assistente lembra de voc\xEA", description: "Prefer\xEAncias que voc\xEA pediu para ele guardar. Esque\xE7a o que n\xE3o valer mais.", children: /* @__PURE__ */ jsx8(FactList, { subject, emptyText: 'Pe\xE7a ao assistente, por exemplo: "lembre que prefiro respostas curtas".' }) });
|
|
916
1030
|
}
|
|
917
1031
|
|
|
918
1032
|
// src/Studio.tsx
|
|
919
|
-
import { useState as
|
|
1033
|
+
import { useState as useState10 } from "react";
|
|
920
1034
|
|
|
921
1035
|
// src/Usage.tsx
|
|
922
|
-
import { useId as
|
|
923
|
-
import { Fragment as
|
|
1036
|
+
import { useId as useId6, useState as useState9 } from "react";
|
|
1037
|
+
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
924
1038
|
var periodRange = (period) => {
|
|
925
1039
|
const now = /* @__PURE__ */ new Date();
|
|
926
1040
|
const monthStart = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1));
|
|
@@ -930,8 +1044,8 @@ var periodRange = (period) => {
|
|
|
930
1044
|
};
|
|
931
1045
|
function UsageReport() {
|
|
932
1046
|
const { client, labels, locale } = useStudio();
|
|
933
|
-
const ids =
|
|
934
|
-
const [period, setPeriod] =
|
|
1047
|
+
const ids = useId6();
|
|
1048
|
+
const [period, setPeriod] = useState9("month");
|
|
935
1049
|
const usage = useResource(() => client.usage(periodRange(period)), [client, period]);
|
|
936
1050
|
const data = usage.data;
|
|
937
1051
|
const money = (n) => formatMoney(n, data?.currency ?? null, locale);
|
|
@@ -939,41 +1053,41 @@ function UsageReport() {
|
|
|
939
1053
|
const channelLabel = (c) => labels.channels?.[c] ?? c;
|
|
940
1054
|
const maxDay = Math.max(...data?.byDay.map((d) => data.currency ? d.cost : d.inputTokens + d.outputTokens) ?? [0], 0);
|
|
941
1055
|
const used = data?.budget && period === "month" ? data.total.cost / data.budget.monthly : null;
|
|
942
|
-
return /* @__PURE__ */
|
|
1056
|
+
return /* @__PURE__ */ jsxs9(
|
|
943
1057
|
Section,
|
|
944
1058
|
{
|
|
945
1059
|
title: "Uso e custos",
|
|
946
1060
|
description: "Quanto o assistente, o bot e as automa\xE7\xF5es gastaram com IA.",
|
|
947
|
-
actions: /* @__PURE__ */
|
|
948
|
-
/* @__PURE__ */
|
|
949
|
-
/* @__PURE__ */
|
|
950
|
-
/* @__PURE__ */
|
|
1061
|
+
actions: /* @__PURE__ */ jsx9(Field, { label: "Per\xEDodo", htmlFor: `${ids}-periodo`, children: /* @__PURE__ */ jsxs9("select", { id: `${ids}-periodo`, className: "dlf-select", value: period, onChange: (e) => setPeriod(e.target.value), children: [
|
|
1062
|
+
/* @__PURE__ */ jsx9("option", { value: "month", children: "Este m\xEAs" }),
|
|
1063
|
+
/* @__PURE__ */ jsx9("option", { value: "last-month", children: "M\xEAs passado" }),
|
|
1064
|
+
/* @__PURE__ */ jsx9("option", { value: "7d", children: "\xDAltimos 7 dias" })
|
|
951
1065
|
] }) }),
|
|
952
1066
|
children: [
|
|
953
|
-
usage.error && /* @__PURE__ */
|
|
954
|
-
usage.loading && !data && /* @__PURE__ */
|
|
955
|
-
data && /* @__PURE__ */
|
|
956
|
-
/* @__PURE__ */
|
|
957
|
-
/* @__PURE__ */
|
|
958
|
-
/* @__PURE__ */
|
|
959
|
-
/* @__PURE__ */
|
|
1067
|
+
usage.error && /* @__PURE__ */ jsx9(Notice, { tone: "error", children: usage.error }),
|
|
1068
|
+
usage.loading && !data && /* @__PURE__ */ jsx9(Loading, {}),
|
|
1069
|
+
data && /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
1070
|
+
/* @__PURE__ */ jsxs9("dl", { className: "dlf-stats", children: [
|
|
1071
|
+
/* @__PURE__ */ jsxs9("div", { className: "dlf-stat", children: [
|
|
1072
|
+
/* @__PURE__ */ jsx9("dt", { children: "Custo" }),
|
|
1073
|
+
/* @__PURE__ */ jsx9("dd", { children: data.currency ? money(data.total.cost) : "\u2014" })
|
|
960
1074
|
] }),
|
|
961
|
-
/* @__PURE__ */
|
|
962
|
-
/* @__PURE__ */
|
|
963
|
-
/* @__PURE__ */
|
|
1075
|
+
/* @__PURE__ */ jsxs9("div", { className: "dlf-stat", children: [
|
|
1076
|
+
/* @__PURE__ */ jsx9("dt", { children: "Conversas e tarefas" }),
|
|
1077
|
+
/* @__PURE__ */ jsx9("dd", { children: formatNumber(data.total.runs, locale) })
|
|
964
1078
|
] }),
|
|
965
|
-
/* @__PURE__ */
|
|
966
|
-
/* @__PURE__ */
|
|
967
|
-
/* @__PURE__ */
|
|
1079
|
+
/* @__PURE__ */ jsxs9("div", { className: "dlf-stat", children: [
|
|
1080
|
+
/* @__PURE__ */ jsx9("dt", { children: "Tokens" }),
|
|
1081
|
+
/* @__PURE__ */ jsx9("dd", { children: tokens(data.total) })
|
|
968
1082
|
] })
|
|
969
1083
|
] }),
|
|
970
|
-
!data.currency && /* @__PURE__ */
|
|
971
|
-
data.total.unpricedCalls > 0 && data.currency && /* @__PURE__ */
|
|
1084
|
+
!data.currency && /* @__PURE__ */ jsx9("p", { className: "dlf-muted", children: "Sem tabela de pre\xE7os configurada na aplica\xE7\xE3o: s\xF3 os tokens aparecem." }),
|
|
1085
|
+
data.total.unpricedCalls > 0 && data.currency && /* @__PURE__ */ jsxs9("p", { className: "dlf-muted", children: [
|
|
972
1086
|
formatNumber(data.total.unpricedCalls, locale),
|
|
973
1087
|
" chamadas usaram modelos sem pre\xE7o configurado e n\xE3o entram no custo."
|
|
974
1088
|
] }),
|
|
975
|
-
used !== null && data.budget && /* @__PURE__ */
|
|
976
|
-
/* @__PURE__ */
|
|
1089
|
+
used !== null && data.budget && /* @__PURE__ */ jsxs9("div", { className: "dlf-field", children: [
|
|
1090
|
+
/* @__PURE__ */ jsxs9("p", { className: "dlf-muted", id: `${ids}-limite`, children: [
|
|
977
1091
|
money(data.total.cost),
|
|
978
1092
|
" de ",
|
|
979
1093
|
money(data.budget.monthly),
|
|
@@ -982,7 +1096,7 @@ function UsageReport() {
|
|
|
982
1096
|
"%)",
|
|
983
1097
|
used >= 1 ? ". Limite atingido: o assistente est\xE1 parado at\xE9 o m\xEAs virar ou o limite subir." : ""
|
|
984
1098
|
] }),
|
|
985
|
-
/* @__PURE__ */
|
|
1099
|
+
/* @__PURE__ */ jsx9(
|
|
986
1100
|
"div",
|
|
987
1101
|
{
|
|
988
1102
|
className: used >= 1 ? "dlf-meter dlf-meter--over" : "dlf-meter",
|
|
@@ -991,38 +1105,38 @@ function UsageReport() {
|
|
|
991
1105
|
"aria-valuemin": 0,
|
|
992
1106
|
"aria-valuemax": 100,
|
|
993
1107
|
"aria-valuenow": Math.min(100, Math.round(used * 100)),
|
|
994
|
-
children: /* @__PURE__ */
|
|
1108
|
+
children: /* @__PURE__ */ jsx9("span", { style: { width: `${Math.min(100, used * 100)}%` } })
|
|
995
1109
|
}
|
|
996
1110
|
)
|
|
997
1111
|
] }),
|
|
998
|
-
!data.byDay.length ? /* @__PURE__ */
|
|
999
|
-
/* @__PURE__ */
|
|
1000
|
-
/* @__PURE__ */
|
|
1001
|
-
/* @__PURE__ */
|
|
1112
|
+
!data.byDay.length ? /* @__PURE__ */ jsx9(Empty, { title: "Nenhum uso no per\xEDodo" }) : /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
1113
|
+
/* @__PURE__ */ jsxs9("div", { children: [
|
|
1114
|
+
/* @__PURE__ */ jsx9("h3", { className: "dlf-h3", style: { marginBottom: "0.5rem" }, children: "Por dia" }),
|
|
1115
|
+
/* @__PURE__ */ jsx9("div", { className: "dlf-bars", children: data.byDay.map((d) => {
|
|
1002
1116
|
const value = data.currency ? d.cost : d.inputTokens + d.outputTokens;
|
|
1003
|
-
return /* @__PURE__ */
|
|
1004
|
-
/* @__PURE__ */
|
|
1005
|
-
/* @__PURE__ */
|
|
1006
|
-
/* @__PURE__ */
|
|
1117
|
+
return /* @__PURE__ */ jsxs9("div", { style: { display: "contents" }, children: [
|
|
1118
|
+
/* @__PURE__ */ jsx9("span", { className: "dlf-muted", children: new Intl.DateTimeFormat(locale, { day: "2-digit", month: "2-digit", timeZone: "UTC" }).format(/* @__PURE__ */ new Date(`${d.day}T00:00:00Z`)) }),
|
|
1119
|
+
/* @__PURE__ */ jsx9("span", { className: "dlf-bar", style: { width: `${maxDay ? value / maxDay * 100 : 0}%` }, "aria-hidden": true }),
|
|
1120
|
+
/* @__PURE__ */ jsx9("span", { className: "dlf-num", children: data.currency ? money(d.cost) : tokens(d) })
|
|
1007
1121
|
] }, d.day);
|
|
1008
1122
|
}) })
|
|
1009
1123
|
] }),
|
|
1010
1124
|
[
|
|
1011
1125
|
["Por canal", data.byChannel.map((c) => ({ key: c.channel, label: channelLabel(c.channel), t: c }))],
|
|
1012
1126
|
["Por modelo", data.byModel.map((m) => ({ key: m.model, label: m.model.slice(m.model.indexOf(":") + 1), t: m }))]
|
|
1013
|
-
].map(([title, rows]) => /* @__PURE__ */
|
|
1014
|
-
/* @__PURE__ */
|
|
1015
|
-
/* @__PURE__ */
|
|
1016
|
-
/* @__PURE__ */
|
|
1017
|
-
/* @__PURE__ */
|
|
1018
|
-
/* @__PURE__ */
|
|
1019
|
-
data.currency && /* @__PURE__ */
|
|
1127
|
+
].map(([title, rows]) => /* @__PURE__ */ jsx9("div", { className: "dlf-table-wrap", children: /* @__PURE__ */ jsxs9("table", { className: "dlf-table", children: [
|
|
1128
|
+
/* @__PURE__ */ jsx9("caption", { className: "dlf-sr-only", children: title }),
|
|
1129
|
+
/* @__PURE__ */ jsx9("thead", { children: /* @__PURE__ */ jsxs9("tr", { children: [
|
|
1130
|
+
/* @__PURE__ */ jsx9("th", { scope: "col", children: title }),
|
|
1131
|
+
/* @__PURE__ */ jsx9("th", { scope: "col", className: "dlf-num", children: "Execu\xE7\xF5es" }),
|
|
1132
|
+
/* @__PURE__ */ jsx9("th", { scope: "col", className: "dlf-num", children: "Tokens" }),
|
|
1133
|
+
data.currency && /* @__PURE__ */ jsx9("th", { scope: "col", className: "dlf-num", children: "Custo" })
|
|
1020
1134
|
] }) }),
|
|
1021
|
-
/* @__PURE__ */
|
|
1022
|
-
/* @__PURE__ */
|
|
1023
|
-
/* @__PURE__ */
|
|
1024
|
-
/* @__PURE__ */
|
|
1025
|
-
data.currency && /* @__PURE__ */
|
|
1135
|
+
/* @__PURE__ */ jsx9("tbody", { children: rows.map((r) => /* @__PURE__ */ jsxs9("tr", { children: [
|
|
1136
|
+
/* @__PURE__ */ jsx9("td", { children: r.label }),
|
|
1137
|
+
/* @__PURE__ */ jsx9("td", { className: "dlf-num", children: formatNumber(r.t.runs, locale) }),
|
|
1138
|
+
/* @__PURE__ */ jsx9("td", { className: "dlf-num", children: tokens(r.t) }),
|
|
1139
|
+
data.currency && /* @__PURE__ */ jsx9("td", { className: "dlf-num", children: money(r.t.cost) })
|
|
1026
1140
|
] }, r.key)) })
|
|
1027
1141
|
] }) }, title))
|
|
1028
1142
|
] })
|
|
@@ -1033,7 +1147,7 @@ function UsageReport() {
|
|
|
1033
1147
|
}
|
|
1034
1148
|
|
|
1035
1149
|
// src/Studio.tsx
|
|
1036
|
-
import { jsx as
|
|
1150
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1037
1151
|
var LABELS = {
|
|
1038
1152
|
approvals: "Aprova\xE7\xF5es",
|
|
1039
1153
|
behavior: "Regras",
|
|
@@ -1041,12 +1155,13 @@ var LABELS = {
|
|
|
1041
1155
|
knowledge: "Conhecimento",
|
|
1042
1156
|
memory: "Mem\xF3ria",
|
|
1043
1157
|
usage: "Custos",
|
|
1158
|
+
keys: "Chave de IA",
|
|
1044
1159
|
audit: "Auditoria"
|
|
1045
1160
|
};
|
|
1046
1161
|
function DolfinhosStudio({ sections, section, defaultSection, onSectionChange, currency, pendingApprovals, onPendingApprovalsChange }) {
|
|
1047
1162
|
const visible = sections ?? Object.keys(LABELS);
|
|
1048
|
-
const [own, setOwn] =
|
|
1049
|
-
const [pending, setPending] =
|
|
1163
|
+
const [own, setOwn] = useState10(defaultSection ?? visible[0]);
|
|
1164
|
+
const [pending, setPending] = useState10(pendingApprovals);
|
|
1050
1165
|
const current = section ?? own;
|
|
1051
1166
|
const select = (s) => {
|
|
1052
1167
|
setOwn(s);
|
|
@@ -1057,16 +1172,17 @@ function DolfinhosStudio({ sections, section, defaultSection, onSectionChange, c
|
|
|
1057
1172
|
onPendingApprovalsChange?.(n);
|
|
1058
1173
|
};
|
|
1059
1174
|
const panels = {
|
|
1060
|
-
approvals: () => /* @__PURE__ */
|
|
1061
|
-
behavior: () => /* @__PURE__ */
|
|
1062
|
-
automations: () => /* @__PURE__ */
|
|
1063
|
-
knowledge: () => /* @__PURE__ */
|
|
1064
|
-
memory: () => /* @__PURE__ */
|
|
1065
|
-
usage: () => /* @__PURE__ */
|
|
1066
|
-
|
|
1175
|
+
approvals: () => /* @__PURE__ */ jsx10(ApprovalsInbox, { onCount }),
|
|
1176
|
+
behavior: () => /* @__PURE__ */ jsx10(BehaviorSettings, { currency: currency ?? null }),
|
|
1177
|
+
automations: () => /* @__PURE__ */ jsx10(AutomationsEditor, {}),
|
|
1178
|
+
knowledge: () => /* @__PURE__ */ jsx10(KnowledgeBase, {}),
|
|
1179
|
+
memory: () => /* @__PURE__ */ jsx10(MemoryBrowser, {}),
|
|
1180
|
+
usage: () => /* @__PURE__ */ jsx10(UsageReport, {}),
|
|
1181
|
+
keys: () => /* @__PURE__ */ jsx10(ProviderKeys, {}),
|
|
1182
|
+
audit: () => /* @__PURE__ */ jsx10(AuditLog, {})
|
|
1067
1183
|
};
|
|
1068
|
-
return /* @__PURE__ */
|
|
1069
|
-
/* @__PURE__ */
|
|
1184
|
+
return /* @__PURE__ */ jsxs10("div", { className: "dlf dlf-studio", children: [
|
|
1185
|
+
/* @__PURE__ */ jsx10(
|
|
1070
1186
|
Tabs,
|
|
1071
1187
|
{
|
|
1072
1188
|
label: "\xC1reas do assistente de IA",
|
|
@@ -1075,12 +1191,12 @@ function DolfinhosStudio({ sections, section, defaultSection, onSectionChange, c
|
|
|
1075
1191
|
tabs: visible.map((id) => ({ id, label: LABELS[id], ...id === "approvals" ? { count: pendingApprovals ?? pending ?? 0 } : {} }))
|
|
1076
1192
|
}
|
|
1077
1193
|
),
|
|
1078
|
-
/* @__PURE__ */
|
|
1194
|
+
/* @__PURE__ */ jsx10("div", { role: "tabpanel", id: `dlf-panel-${current}`, "aria-labelledby": `dlf-tab-${current}`, tabIndex: 0, style: { outlineOffset: 4 }, children: panels[current]() })
|
|
1079
1195
|
] });
|
|
1080
1196
|
}
|
|
1081
1197
|
|
|
1082
1198
|
// src/index.tsx
|
|
1083
|
-
import { jsx as
|
|
1199
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1084
1200
|
function StudioProvider({ children, endpoint, headers, fetch: fetch2, labels, locale = "pt-BR", navigate }) {
|
|
1085
1201
|
const client = useMemo(
|
|
1086
1202
|
() => createStudioClient({ ...endpoint ? { endpoint } : {}, ...headers ? { headers } : {}, ...fetch2 ? { fetch: fetch2 } : {} }),
|
|
@@ -1088,7 +1204,7 @@ function StudioProvider({ children, endpoint, headers, fetch: fetch2, labels, lo
|
|
|
1088
1204
|
[endpoint]
|
|
1089
1205
|
);
|
|
1090
1206
|
const value = useMemo(() => ({ client, labels: labels ?? {}, locale, ...navigate ? { navigate } : {} }), [client, labels, locale, navigate]);
|
|
1091
|
-
return /* @__PURE__ */
|
|
1207
|
+
return /* @__PURE__ */ jsx11(StudioContextProvider, { value, children });
|
|
1092
1208
|
}
|
|
1093
1209
|
export {
|
|
1094
1210
|
ApprovalsInbox,
|
|
@@ -1099,6 +1215,7 @@ export {
|
|
|
1099
1215
|
KnowledgeBase,
|
|
1100
1216
|
MemoryBrowser,
|
|
1101
1217
|
MyMemory,
|
|
1218
|
+
ProviderKeys,
|
|
1102
1219
|
StudioError,
|
|
1103
1220
|
StudioProvider,
|
|
1104
1221
|
UsageReport,
|