@orbe-agro/client-core 5.6.324 → 5.6.326
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/@ecme/assets/styles/app.css +29 -0
- package/dist/@ecme/assets/styles/tailwind/index.css +29 -0
- package/dist/@ecme/components/template/Footer.js +1 -1
- package/dist/@ecme/components/template/OrbeAiWidget/OrbeAiWidget.js +7 -1
- package/dist/@ecme/components/template/OrbeAiWidget/OrbeAiWidget.js.map +1 -1
- package/dist/@ecme/components/ui/Alert/Alert.js +2 -0
- package/dist/@ecme/components/ui/Alert/Alert.js.map +1 -1
- package/dist/@ecme/components/ui/Tooltip/Tooltip.js.map +1 -1
- package/dist/@ecme/components/view/ChatBox/ChatBox.js +3 -1
- package/dist/@ecme/components/view/ChatBox/ChatBox.js.map +1 -1
- package/dist/@ecme/components/view/ChatBox/components/ChatInput.js +2 -1
- package/dist/@ecme/components/view/ChatBox/components/ChatInput.js.map +1 -1
- package/dist/@ecme/locales/lang/ptBR/nav.js +3 -0
- package/dist/@ecme/locales/lang/ptBR/nav.js.map +1 -1
- package/dist/@ecme/services/AiService.js +4 -2
- package/dist/@ecme/services/AiService.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Chat/components/ChatView.js +45 -3
- package/dist/@ecme/views/concepts/ai/Chat/components/ChatView.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Chat/components/EsforcoRaciocinio.js +85 -0
- package/dist/@ecme/views/concepts/ai/Chat/components/EsforcoRaciocinio.js.map +1 -0
- package/dist/@ecme/views/concepts/ai/Chat/hooks/useChatSend.js +20 -3
- package/dist/@ecme/views/concepts/ai/Chat/hooks/useChatSend.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Chat/store/esforcoStore.js +15 -0
- package/dist/@ecme/views/concepts/ai/Chat/store/esforcoStore.js.map +1 -0
- package/dist/@types/@ecme/components/template/OrbeAiWidget/OrbeAiWidget.d.ts.map +1 -1
- package/dist/@types/@ecme/components/ui/Alert/Alert.d.ts.map +1 -1
- package/dist/@types/@ecme/components/ui/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/@types/@ecme/components/view/ChatBox/ChatBox.d.ts.map +1 -1
- package/dist/@types/@ecme/components/view/ChatBox/components/ChatInput.d.ts +3 -1
- package/dist/@types/@ecme/components/view/ChatBox/components/ChatInput.d.ts.map +1 -1
- package/dist/@types/@ecme/locales/lang/ptBR/nav.d.ts.map +1 -1
- package/dist/@types/@ecme/services/AiService.d.ts +7 -3
- package/dist/@types/@ecme/services/AiService.d.ts.map +1 -1
- package/dist/@types/@ecme/views/concepts/ai/Chat/components/ChatView.d.ts +6 -1
- package/dist/@types/@ecme/views/concepts/ai/Chat/components/ChatView.d.ts.map +1 -1
- package/dist/@types/@ecme/views/concepts/ai/Chat/components/EsforcoRaciocinio.d.ts +14 -0
- package/dist/@types/@ecme/views/concepts/ai/Chat/components/EsforcoRaciocinio.d.ts.map +1 -0
- package/dist/@types/@ecme/views/concepts/ai/Chat/hooks/useChatSend.d.ts.map +1 -1
- package/dist/@types/@ecme/views/concepts/ai/Chat/store/esforcoStore.d.ts +27 -0
- package/dist/@types/@ecme/views/concepts/ai/Chat/store/esforcoStore.d.ts.map +1 -0
- package/dist/@types/@ecme/views/concepts/ai/Chat/types.d.ts +30 -0
- package/dist/@types/@ecme/views/concepts/ai/Chat/types.d.ts.map +1 -1
- package/dist/@types/base/configs/navigation.config/submenu/orcamento/relatorios/analiseVariacoes.submenu.d.ts +4 -0
- package/dist/@types/base/configs/navigation.config/submenu/orcamento/relatorios/analiseVariacoes.submenu.d.ts.map +1 -0
- package/dist/@types/base/configs/navigation.config/submenu/orcamento/relatorios/relatorios.submenu.d.ts.map +1 -1
- package/dist/base/assets/styles/init.css +33 -0
- package/dist/base/configs/navigation.config/submenu/orcamento/relatorios/analiseVariacoes.submenu.js +17 -0
- package/dist/base/configs/navigation.config/submenu/orcamento/relatorios/analiseVariacoes.submenu.js.map +1 -0
- package/dist/base/configs/navigation.config/submenu/orcamento/relatorios/relatorios.submenu.js +3 -1
- package/dist/base/configs/navigation.config/submenu/orcamento/relatorios/relatorios.submenu.js.map +1 -1
- package/lib/@ecme/components/template/OrbeAiWidget/OrbeAiWidget.tsx +4 -1
- package/lib/@ecme/components/ui/Alert/Alert.tsx +3 -0
- package/lib/@ecme/components/ui/Tooltip/Tooltip.tsx +2 -1
- package/lib/@ecme/components/view/ChatBox/ChatBox.tsx +2 -0
- package/lib/@ecme/components/view/ChatBox/components/ChatInput.tsx +5 -2
- package/lib/@ecme/locales/lang/ptBR/nav.ts +3 -0
- package/lib/@ecme/services/AiService.ts +9 -3
- package/lib/@ecme/views/concepts/ai/Chat/components/ChatView.tsx +49 -3
- package/lib/@ecme/views/concepts/ai/Chat/components/EsforcoRaciocinio.tsx +115 -0
- package/lib/@ecme/views/concepts/ai/Chat/hooks/useChatSend.ts +24 -3
- package/lib/@ecme/views/concepts/ai/Chat/store/esforcoStore.ts +25 -0
- package/lib/@ecme/views/concepts/ai/Chat/types.ts +32 -0
- package/lib/base/configs/navigation.config/submenu/orcamento/relatorios/analiseVariacoes.submenu.ts +17 -0
- package/lib/base/configs/navigation.config/submenu/orcamento/relatorios/relatorios.submenu.ts +2 -1
- package/package.json +2 -1
|
@@ -67,6 +67,15 @@ export type Conversation = {
|
|
|
67
67
|
pendingApproval?: PendingApproval;
|
|
68
68
|
/** Preenchido quando o agente pausou pedindo os dados que faltam. */
|
|
69
69
|
pendingInput?: PendingInput;
|
|
70
|
+
/** Preenchido quando o agente gerou dados de planilha para download. */
|
|
71
|
+
spreadsheet?: {
|
|
72
|
+
titulo: string;
|
|
73
|
+
abas: Array<{
|
|
74
|
+
nome: string;
|
|
75
|
+
colunas: string[];
|
|
76
|
+
linhas: Record<string, unknown>[];
|
|
77
|
+
}>;
|
|
78
|
+
};
|
|
70
79
|
};
|
|
71
80
|
/**
|
|
72
81
|
* Eventos do stream de /ai/chat/stream.
|
|
@@ -98,6 +107,20 @@ export type ChatEvent = {
|
|
|
98
107
|
content: string;
|
|
99
108
|
is_error: boolean;
|
|
100
109
|
};
|
|
110
|
+
} | {
|
|
111
|
+
/**
|
|
112
|
+
* O agente gerou dados de planilha. O front gera o .xlsx no navegador
|
|
113
|
+
* (SheetJS) e mostra um botao de download.
|
|
114
|
+
*/
|
|
115
|
+
type: 'spreadsheet_data';
|
|
116
|
+
data: {
|
|
117
|
+
titulo: string;
|
|
118
|
+
abas: Array<{
|
|
119
|
+
nome: string;
|
|
120
|
+
colunas: string[];
|
|
121
|
+
linhas: Record<string, unknown>[];
|
|
122
|
+
}>;
|
|
123
|
+
};
|
|
101
124
|
} | {
|
|
102
125
|
/**
|
|
103
126
|
* O agente parou antes de uma operacao de escrita e espera decisao.
|
|
@@ -164,6 +187,13 @@ export type HistoryMessage = Omit<Conversation, 'timestamp'> & {
|
|
|
164
187
|
export type HistoryChat = Omit<ChatHistory, 'conversation'> & {
|
|
165
188
|
conversation: HistoryMessage[];
|
|
166
189
|
};
|
|
190
|
+
/**
|
|
191
|
+
* Nível de raciocínio do modelo, escolhido no chat e enviado em cada mensagem.
|
|
192
|
+
*
|
|
193
|
+
* Os valores são os do OpenRouter, sem tradução — o backend valida contra o
|
|
194
|
+
* mesmo conjunto (enum `Esforco`) e responde 422 para qualquer outro.
|
|
195
|
+
*/
|
|
196
|
+
export type Esforco = 'minimal' | 'medium' | 'high' | 'max';
|
|
167
197
|
/** Resumo de uma conversa, como vem do GET /ai/chat/conversations. */
|
|
168
198
|
export type ConversationSummary = {
|
|
169
199
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../lib/@ecme/views/concepts/ai/Chat/types.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,MAAM,QAAQ,GAAG;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,O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ACnB,MAAM,EAAE,OAAO,CAAA;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,WAAW,EAAE,CAAA;AAEzC,MAAM,MAAM,sBAAsB,GAAG,aAAa,CAAA;AAElD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,GAAG;IAC3D,SAAS,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,gFAAgF;AAChF,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG;IAC1D,YAAY,EAAE,cAAc,EAAE,CAAA;CACjC,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAA;AAE3D,sEAAsE;AACtE,MAAM,MAAM,mBAAmB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,mBAAmB,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analiseVariacoes.submenu.d.ts","sourceRoot":"","sources":["../../../../../../../../lib/base/configs/navigation.config/submenu/orcamento/relatorios/analiseVariacoes.submenu.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,QAAA,MAAM,uBAAuB,EAAE,cAU9B,CAAA;AAED,eAAe,uBAAuB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relatorios.submenu.d.ts","sourceRoot":"","sources":["../../../../../../../../lib/base/configs/navigation.config/submenu/orcamento/relatorios/relatorios.submenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"relatorios.submenu.d.ts","sourceRoot":"","sources":["../../../../../../../../lib/base/configs/navigation.config/submenu/orcamento/relatorios/relatorios.submenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAMpD,QAAA,MAAM,iBAAiB,EAAE,cAAc,EAKtC,CAAA;AAED,eAAe,iBAAiB,CAAA"}
|
|
@@ -5757,6 +5757,9 @@ video {
|
|
|
5757
5757
|
.w-6{
|
|
5758
5758
|
width: 1.5rem;
|
|
5759
5759
|
}
|
|
5760
|
+
.w-72{
|
|
5761
|
+
width: 18rem;
|
|
5762
|
+
}
|
|
5760
5763
|
.w-8{
|
|
5761
5764
|
width: 2rem;
|
|
5762
5765
|
}
|
|
@@ -6420,6 +6423,10 @@ video {
|
|
|
6420
6423
|
.border-none{
|
|
6421
6424
|
border-style: none;
|
|
6422
6425
|
}
|
|
6426
|
+
.border-emerald-300{
|
|
6427
|
+
--tw-border-opacity: 1;
|
|
6428
|
+
border-color: rgb(110 231 183 / var(--tw-border-opacity, 1));
|
|
6429
|
+
}
|
|
6423
6430
|
.border-error{
|
|
6424
6431
|
border-color: var(--error);
|
|
6425
6432
|
}
|
|
@@ -6567,6 +6574,10 @@ video {
|
|
|
6567
6574
|
--tw-bg-opacity: 1;
|
|
6568
6575
|
background-color: rgb(167 243 208 / var(--tw-bg-opacity, 1));
|
|
6569
6576
|
}
|
|
6577
|
+
.bg-emerald-50{
|
|
6578
|
+
--tw-bg-opacity: 1;
|
|
6579
|
+
background-color: rgb(236 253 245 / var(--tw-bg-opacity, 1));
|
|
6580
|
+
}
|
|
6570
6581
|
.bg-emerald-500{
|
|
6571
6582
|
--tw-bg-opacity: 1;
|
|
6572
6583
|
background-color: rgb(16 185 129 / var(--tw-bg-opacity, 1));
|
|
@@ -7264,6 +7275,10 @@ video {
|
|
|
7264
7275
|
--tw-text-opacity: 1;
|
|
7265
7276
|
color: rgb(5 150 105 / var(--tw-text-opacity, 1));
|
|
7266
7277
|
}
|
|
7278
|
+
.text-emerald-700{
|
|
7279
|
+
--tw-text-opacity: 1;
|
|
7280
|
+
color: rgb(4 120 87 / var(--tw-text-opacity, 1));
|
|
7281
|
+
}
|
|
7267
7282
|
.text-error{
|
|
7268
7283
|
color: var(--error);
|
|
7269
7284
|
}
|
|
@@ -7731,6 +7746,11 @@ video {
|
|
|
7731
7746
|
background-color: rgb(37 99 235 / var(--tw-bg-opacity, 1));
|
|
7732
7747
|
}
|
|
7733
7748
|
|
|
7749
|
+
.hover\:bg-emerald-100:hover{
|
|
7750
|
+
--tw-bg-opacity: 1;
|
|
7751
|
+
background-color: rgb(209 250 229 / var(--tw-bg-opacity, 1));
|
|
7752
|
+
}
|
|
7753
|
+
|
|
7734
7754
|
.hover\:bg-gray-100:hover{
|
|
7735
7755
|
background-color: var(--gray-100);
|
|
7736
7756
|
}
|
|
@@ -8068,6 +8088,11 @@ video {
|
|
|
8068
8088
|
border-style: solid;
|
|
8069
8089
|
}
|
|
8070
8090
|
|
|
8091
|
+
.dark\:border-emerald-700:is(.dark *){
|
|
8092
|
+
--tw-border-opacity: 1;
|
|
8093
|
+
border-color: rgb(4 120 87 / var(--tw-border-opacity, 1));
|
|
8094
|
+
}
|
|
8095
|
+
|
|
8071
8096
|
.dark\:border-gray-500:is(.dark *){
|
|
8072
8097
|
border-color: var(--gray-500);
|
|
8073
8098
|
}
|
|
@@ -8157,6 +8182,10 @@ video {
|
|
|
8157
8182
|
background-color: rgb(16 185 129 / 0.2);
|
|
8158
8183
|
}
|
|
8159
8184
|
|
|
8185
|
+
.dark\:bg-emerald-900\/30:is(.dark *){
|
|
8186
|
+
background-color: rgb(6 78 59 / 0.3);
|
|
8187
|
+
}
|
|
8188
|
+
|
|
8160
8189
|
.dark\:bg-fuchsia-200:is(.dark *){
|
|
8161
8190
|
--tw-bg-opacity: 1;
|
|
8162
8191
|
background-color: rgb(245 208 254 / var(--tw-bg-opacity, 1));
|
|
@@ -8514,6 +8543,10 @@ video {
|
|
|
8514
8543
|
background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1));
|
|
8515
8544
|
}
|
|
8516
8545
|
|
|
8546
|
+
.dark\:hover\:bg-emerald-900\/50:hover:is(.dark *){
|
|
8547
|
+
background-color: rgb(6 78 59 / 0.5);
|
|
8548
|
+
}
|
|
8549
|
+
|
|
8517
8550
|
.dark\:hover\:bg-gray-200:hover:is(.dark *){
|
|
8518
8551
|
background-color: var(--gray-200);
|
|
8519
8552
|
}
|
package/dist/base/configs/navigation.config/submenu/orcamento/relatorios/analiseVariacoes.submenu.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NAV_ITEM_TYPE_ITEM } from "../../../../../../@ecme/constants/navigation.constant.js";
|
|
2
|
+
import { ADMIN } from "../../../../../../@ecme/constants/roles.constant.js";
|
|
3
|
+
const analiseVariacoesSubmenu = {
|
|
4
|
+
key: "modules.orcamento.relatorios.analiseVariacoes",
|
|
5
|
+
path: "/orcamento/relatorio-variacoes",
|
|
6
|
+
title: "Análise - Variações Relevantes",
|
|
7
|
+
translateKey: "nav.modules.orcamento.relatorios.analiseVariacoes.title",
|
|
8
|
+
icon: "chart",
|
|
9
|
+
type: NAV_ITEM_TYPE_ITEM,
|
|
10
|
+
forceShowTitle: true,
|
|
11
|
+
authority: [ADMIN],
|
|
12
|
+
subMenu: []
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
analiseVariacoesSubmenu as default
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=analiseVariacoes.submenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analiseVariacoes.submenu.js","sources":["../../../../../../../lib/base/configs/navigation.config/submenu/orcamento/relatorios/analiseVariacoes.submenu.ts"],"sourcesContent":["import { NAV_ITEM_TYPE_ITEM } from '@/constants/navigation.constant'\nimport { ADMIN } from '@/constants/roles.constant'\nimport { NavigationTree } from '@/@types/navigation'\n\nconst analiseVariacoesSubmenu: NavigationTree = {\n key: 'modules.orcamento.relatorios.analiseVariacoes',\n path: '/orcamento/relatorio-variacoes',\n title: 'Análise - Variações Relevantes',\n translateKey: 'nav.modules.orcamento.relatorios.analiseVariacoes.title',\n icon: 'chart',\n type: NAV_ITEM_TYPE_ITEM,\n forceShowTitle: true,\n authority: [ADMIN],\n subMenu: [],\n}\n\nexport default analiseVariacoesSubmenu\n"],"names":[],"mappings":";;AAIA,MAAM,0BAA0C;AAAA,EAC5C,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,cAAc;AAAA,EACd,MAAM;AAAA,EACN,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,WAAW,CAAC,KAAK;AAAA,EACjB,SAAS,CAAA;AACb;"}
|
package/dist/base/configs/navigation.config/submenu/orcamento/relatorios/relatorios.submenu.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import analiseDepartamentoSubmenu from "./analiseDepartamento.submenu.js";
|
|
2
2
|
import analiseContaContabilSubmenu from "./analiseContaContabil.submenu.js";
|
|
3
3
|
import analiseCentroDeCustosSubmenu from "./analiseCentroDeCustos.submenu.js";
|
|
4
|
+
import analiseVariacoesSubmenu from "./analiseVariacoes.submenu.js";
|
|
4
5
|
const relatoriosSubmenu = [
|
|
5
6
|
analiseCentroDeCustosSubmenu,
|
|
6
7
|
analiseContaContabilSubmenu,
|
|
7
|
-
analiseDepartamentoSubmenu
|
|
8
|
+
analiseDepartamentoSubmenu,
|
|
9
|
+
analiseVariacoesSubmenu
|
|
8
10
|
];
|
|
9
11
|
export {
|
|
10
12
|
relatoriosSubmenu as default
|
package/dist/base/configs/navigation.config/submenu/orcamento/relatorios/relatorios.submenu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relatorios.submenu.js","sources":["../../../../../../../lib/base/configs/navigation.config/submenu/orcamento/relatorios/relatorios.submenu.ts"],"sourcesContent":["import { NavigationTree } from '@/@types/navigation'\nimport analiseDepartamentoSubmenu from './analiseDepartamento.submenu'\nimport analiseContaContabilSubmenu from './analiseContaContabil.submenu'\nimport analiseCentroDeCustosSubmenu from './analiseCentroDeCustos.submenu'\n\nconst relatoriosSubmenu: NavigationTree[] = [\n analiseCentroDeCustosSubmenu,\n analiseContaContabilSubmenu,\n analiseDepartamentoSubmenu,\n]\n\nexport default relatoriosSubmenu\n
|
|
1
|
+
{"version":3,"file":"relatorios.submenu.js","sources":["../../../../../../../lib/base/configs/navigation.config/submenu/orcamento/relatorios/relatorios.submenu.ts"],"sourcesContent":["import { NavigationTree } from '@/@types/navigation'\nimport analiseDepartamentoSubmenu from './analiseDepartamento.submenu'\nimport analiseContaContabilSubmenu from './analiseContaContabil.submenu'\nimport analiseCentroDeCustosSubmenu from './analiseCentroDeCustos.submenu'\nimport analiseVariacoesSubmenu from './analiseVariacoes.submenu'\n\nconst relatoriosSubmenu: NavigationTree[] = [\n analiseCentroDeCustosSubmenu,\n analiseContaContabilSubmenu,\n analiseDepartamentoSubmenu,\n analiseVariacoesSubmenu,\n]\n\nexport default relatoriosSubmenu\n"],"names":[],"mappings":";;;;AAMA,MAAM,oBAAsC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;"}
|
|
@@ -125,7 +125,10 @@ const OrbeAiWidget = () => {
|
|
|
125
125
|
</div>
|
|
126
126
|
|
|
127
127
|
<div className="min-h-0 flex-1 p-2">
|
|
128
|
-
<ChatView
|
|
128
|
+
<ChatView
|
|
129
|
+
showMobileNav={false}
|
|
130
|
+
dropdownFloatingClass="!z-[10000]"
|
|
131
|
+
/>
|
|
129
132
|
<ChatHistoryRenameDialog overlayClassName="!z-[10000]" />
|
|
130
133
|
</div>
|
|
131
134
|
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
HiXCircle,
|
|
9
9
|
} from 'react-icons/hi'
|
|
10
10
|
import { motion } from 'framer-motion'
|
|
11
|
+
import type { MotionStyle } from 'framer-motion'
|
|
11
12
|
import CloseButton from '../CloseButton'
|
|
12
13
|
import StatusIcon from '../StatusIcon'
|
|
13
14
|
import type { TypeAttributes, CommonProps } from '../@types/common'
|
|
@@ -78,6 +79,7 @@ const Alert = (props: AlertProps) => {
|
|
|
78
79
|
onClose,
|
|
79
80
|
ref,
|
|
80
81
|
showIcon = false,
|
|
82
|
+
style,
|
|
81
83
|
triggerByToast = false,
|
|
82
84
|
...rest
|
|
83
85
|
} = props
|
|
@@ -149,6 +151,7 @@ const Alert = (props: AlertProps) => {
|
|
|
149
151
|
<motion.div
|
|
150
152
|
ref={ref}
|
|
151
153
|
className={alertClass}
|
|
154
|
+
style={style as MotionStyle}
|
|
152
155
|
initial={{ opacity: 1 }}
|
|
153
156
|
animate={display === 'hiding' ? 'exit' : 'animate'}
|
|
154
157
|
transition={{ duration: 0.25, type: 'tween' }}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
2
|
import classNames from 'classnames'
|
|
3
3
|
import { motion, AnimatePresence } from 'framer-motion'
|
|
4
|
+
import type { MotionStyle } from 'framer-motion'
|
|
4
5
|
import Arrow from './Arrow'
|
|
5
6
|
import type { CommonProps } from '../@types/common'
|
|
6
7
|
import type { ArrowPlacement } from './Arrow'
|
|
@@ -127,7 +128,7 @@ const Tooltip = (props: TooltipProps) => {
|
|
|
127
128
|
duration: 0.15,
|
|
128
129
|
type: 'tween',
|
|
129
130
|
}}
|
|
130
|
-
style={floatingStyles}
|
|
131
|
+
style={floatingStyles as MotionStyle}
|
|
131
132
|
{...getFloatingProps()}
|
|
132
133
|
>
|
|
133
134
|
<span>{title}</span>
|
|
@@ -27,6 +27,7 @@ const ChatBox = forwardRef<ScrollBarRef, ChatBoxProps>((props, ref) => {
|
|
|
27
27
|
header,
|
|
28
28
|
placeholder,
|
|
29
29
|
onInputChange,
|
|
30
|
+
inputActions,
|
|
30
31
|
showAvatar,
|
|
31
32
|
avatarGap,
|
|
32
33
|
customRenderer,
|
|
@@ -49,6 +50,7 @@ const ChatBox = forwardRef<ScrollBarRef, ChatBoxProps>((props, ref) => {
|
|
|
49
50
|
<ChatInput
|
|
50
51
|
placeholder={placeholder}
|
|
51
52
|
onInputChange={onInputChange}
|
|
53
|
+
inputActions={inputActions}
|
|
52
54
|
/>
|
|
53
55
|
}
|
|
54
56
|
>
|
|
@@ -3,12 +3,14 @@ import Button from '@/components/ui/Button'
|
|
|
3
3
|
import Upload from '@/components/ui/Upload'
|
|
4
4
|
import hooks from '@/components/ui/hooks'
|
|
5
5
|
import { TbPhotoPlus, TbArrowRight } from 'react-icons/tb'
|
|
6
|
-
import type { KeyboardEvent, Ref } from 'react'
|
|
6
|
+
import type { KeyboardEvent, ReactNode, Ref } from 'react'
|
|
7
7
|
|
|
8
8
|
export type ChatInputProps = {
|
|
9
9
|
placeholder?: string
|
|
10
10
|
onInputChange?: (payload: { value: string; attachments: File[] }) => void
|
|
11
11
|
ref?: Ref<HTMLInputElement>
|
|
12
|
+
/** Controles extras dentro da caixa, logo antes do botão de enviar. */
|
|
13
|
+
inputActions?: ReactNode
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
const { useMergeRef } = hooks
|
|
@@ -16,7 +18,7 @@ const { useMergeRef } = hooks
|
|
|
16
18
|
const ChatInput = (props: ChatInputProps) => {
|
|
17
19
|
const [attachments, setAttachments] = useState<File[]>([])
|
|
18
20
|
|
|
19
|
-
const { placeholder, onInputChange, ref = null } = props
|
|
21
|
+
const { placeholder, onInputChange, ref = null, inputActions } = props
|
|
20
22
|
|
|
21
23
|
const inputRef = useRef<HTMLInputElement>(null)
|
|
22
24
|
|
|
@@ -78,6 +80,7 @@ const ChatInput = (props: ChatInputProps) => {
|
|
|
78
80
|
placeholder={placeholder}
|
|
79
81
|
onKeyDown={handleKeyDown}
|
|
80
82
|
/>
|
|
83
|
+
{inputActions}
|
|
81
84
|
<Button
|
|
82
85
|
size="xs"
|
|
83
86
|
shape="circle"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { authHeaders } from './aiAuthHeaders'
|
|
2
2
|
import ApiService from './ApiService'
|
|
3
3
|
import { readSse } from './sseParser'
|
|
4
|
-
import type { ChatEvent } from '@/views/concepts/ai/Chat/types'
|
|
4
|
+
import type { ChatEvent, Esforco } from '@/views/concepts/ai/Chat/types'
|
|
5
5
|
import type { AxiosRequestConfig } from 'axios'
|
|
6
6
|
|
|
7
7
|
const AI_DEV_URL = 'http://localhost:8000'
|
|
@@ -80,6 +80,8 @@ export type StreamChatParams = {
|
|
|
80
80
|
prompt: string
|
|
81
81
|
/** Identifica a conversa; o backend usa como thread da memoria. */
|
|
82
82
|
conversationId?: string
|
|
83
|
+
/** Nivel de raciocinio desta mensagem; ausente = o padrao do backend. */
|
|
84
|
+
esforco?: Esforco
|
|
83
85
|
signal?: AbortSignal
|
|
84
86
|
onEvent: (evento: ChatEvent) => void
|
|
85
87
|
}
|
|
@@ -94,6 +96,8 @@ export type ResumeChatParams = {
|
|
|
94
96
|
approved?: boolean
|
|
95
97
|
dados?: Record<string, unknown> | null
|
|
96
98
|
conversationId?: string
|
|
99
|
+
/** A retomada tambem chama o modelo: vale o mesmo nivel do envio. */
|
|
100
|
+
esforco?: Esforco
|
|
97
101
|
signal?: AbortSignal
|
|
98
102
|
onEvent: (evento: ChatEvent) => void
|
|
99
103
|
}
|
|
@@ -107,12 +111,13 @@ export type ResumeChatParams = {
|
|
|
107
111
|
export async function streamChat({
|
|
108
112
|
prompt,
|
|
109
113
|
conversationId,
|
|
114
|
+
esforco,
|
|
110
115
|
signal,
|
|
111
116
|
onEvent,
|
|
112
117
|
}: StreamChatParams): Promise<void> {
|
|
113
118
|
await postarEConsumir(
|
|
114
119
|
'/ai/chat/stream',
|
|
115
|
-
{ prompt, conversation_id: conversationId },
|
|
120
|
+
{ prompt, conversation_id: conversationId, esforco },
|
|
116
121
|
onEvent,
|
|
117
122
|
signal,
|
|
118
123
|
)
|
|
@@ -131,12 +136,13 @@ export async function resumeChat({
|
|
|
131
136
|
approved,
|
|
132
137
|
dados,
|
|
133
138
|
conversationId,
|
|
139
|
+
esforco,
|
|
134
140
|
signal,
|
|
135
141
|
onEvent,
|
|
136
142
|
}: ResumeChatParams): Promise<void> {
|
|
137
143
|
await postarEConsumir(
|
|
138
144
|
'/ai/chat/resume',
|
|
139
|
-
{ approved, dados, conversation_id: conversationId },
|
|
145
|
+
{ approved, dados, conversation_id: conversationId, esforco },
|
|
140
146
|
onEvent,
|
|
141
147
|
signal,
|
|
142
148
|
)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { useRef, useEffect, useMemo } from 'react'
|
|
1
|
+
import { useRef, useEffect, useMemo, useCallback } from 'react'
|
|
2
|
+
import { TbDownload } from 'react-icons/tb'
|
|
3
|
+
import * as XLSX from 'xlsx'
|
|
2
4
|
import Card from '@/components/ui/Card'
|
|
3
5
|
import ChatBox from '@/components/view/ChatBox'
|
|
4
6
|
import ChatLandingView from './ChatLandingView'
|
|
@@ -10,6 +12,7 @@ import AiErrorMessage from './AiErrorMessage'
|
|
|
10
12
|
import ToolCallChip from './ToolCallChip'
|
|
11
13
|
import ApprovalCard from './ApprovalCard'
|
|
12
14
|
import DataRequestCard from './DataRequestCard'
|
|
15
|
+
import EsforcoRaciocinio from './EsforcoRaciocinio'
|
|
13
16
|
import { usGenerativeChatStore } from '../store/generativeChatStore'
|
|
14
17
|
import useChatSend from '../hooks/useChatSend'
|
|
15
18
|
import useConversationMessages from '../hooks/useConversationMessages'
|
|
@@ -38,9 +41,17 @@ type ChatViewProps = {
|
|
|
38
41
|
* flutuante desliga, porque tem o próprio drawer dentro do painel.
|
|
39
42
|
*/
|
|
40
43
|
showMobileNav?: boolean
|
|
44
|
+
/**
|
|
45
|
+
* Classes dos menus flutuantes do chat. O widget passa um z-index acima do
|
|
46
|
+
* próprio painel; sem isso o menu abriria atrás dele.
|
|
47
|
+
*/
|
|
48
|
+
dropdownFloatingClass?: string
|
|
41
49
|
}
|
|
42
50
|
|
|
43
|
-
const ChatView = ({
|
|
51
|
+
const ChatView = ({
|
|
52
|
+
showMobileNav = true,
|
|
53
|
+
dropdownFloatingClass,
|
|
54
|
+
}: ChatViewProps) => {
|
|
44
55
|
const scrollRef = useRef<ScrollBarRef>(null)
|
|
45
56
|
const { selectedConversation, chatHistory, isTyping, disabledChatFresh } =
|
|
46
57
|
usGenerativeChatStore()
|
|
@@ -82,6 +93,23 @@ const ChatView = ({ showMobileNav = true }: ChatViewProps) => {
|
|
|
82
93
|
scrollToBottom()
|
|
83
94
|
}
|
|
84
95
|
|
|
96
|
+
const handleSpreadsheetDownload = useCallback(
|
|
97
|
+
(titulo: string, abas: Array<{ nome: string; colunas: string[]; linhas: Record<string, unknown>[] }>) => {
|
|
98
|
+
const workbook = XLSX.utils.book_new()
|
|
99
|
+
for (const aba of abas) {
|
|
100
|
+
const sheet = XLSX.utils.aoa_to_sheet([
|
|
101
|
+
aba.colunas,
|
|
102
|
+
...aba.linhas.map((linha) =>
|
|
103
|
+
aba.colunas.map((col) => linha[col] ?? ''),
|
|
104
|
+
),
|
|
105
|
+
])
|
|
106
|
+
XLSX.utils.book_append_sheet(workbook, sheet, aba.nome.slice(0, 31))
|
|
107
|
+
}
|
|
108
|
+
XLSX.writeFile(workbook, `${titulo}.xlsx`)
|
|
109
|
+
},
|
|
110
|
+
[],
|
|
111
|
+
)
|
|
112
|
+
|
|
85
113
|
return (
|
|
86
114
|
<Card className="flex-1 h-full" bodyClass="h-full">
|
|
87
115
|
{showMobileNav && <ChatMobileNav />}
|
|
@@ -122,7 +150,7 @@ const ChatView = ({ showMobileNav = true }: ChatViewProps) => {
|
|
|
122
150
|
if (message.sender.id === 'ai') {
|
|
123
151
|
// As ferramentas e as pausas chegam pelo streaming e
|
|
124
152
|
// vivem no Conversation; o tipo do ChatBox nao os conhece.
|
|
125
|
-
const { tools, pendingApproval, pendingInput } =
|
|
153
|
+
const { tools, pendingApproval, pendingInput, spreadsheet } =
|
|
126
154
|
message as Conversation
|
|
127
155
|
// Enquanto as ferramentas rodam o conteudo ainda e '':
|
|
128
156
|
// sem esta guarda sobraria um balao cinza vazio.
|
|
@@ -150,6 +178,21 @@ const ChatView = ({ showMobileNav = true }: ChatViewProps) => {
|
|
|
150
178
|
/>
|
|
151
179
|
</div>
|
|
152
180
|
)}
|
|
181
|
+
{spreadsheet && (
|
|
182
|
+
<button
|
|
183
|
+
type="button"
|
|
184
|
+
onClick={() =>
|
|
185
|
+
handleSpreadsheetDownload(
|
|
186
|
+
spreadsheet.titulo,
|
|
187
|
+
spreadsheet.abas,
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
className="inline-flex items-center gap-2 rounded-lg border border-emerald-300 bg-emerald-50 px-3 py-2 text-sm font-medium text-emerald-700 transition-colors hover:bg-emerald-100 dark:border-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400 dark:hover:bg-emerald-900/50"
|
|
191
|
+
>
|
|
192
|
+
<TbDownload size={18} />
|
|
193
|
+
<span>Baixar {spreadsheet.titulo}.xlsx</span>
|
|
194
|
+
</button>
|
|
195
|
+
)}
|
|
153
196
|
{pendingInput && (
|
|
154
197
|
<DataRequestCard
|
|
155
198
|
input={pendingInput}
|
|
@@ -192,6 +235,9 @@ const ChatView = ({ showMobileNav = true }: ChatViewProps) => {
|
|
|
192
235
|
return null
|
|
193
236
|
}}
|
|
194
237
|
onInputChange={handleInputChange}
|
|
238
|
+
inputActions={
|
|
239
|
+
<EsforcoRaciocinio floatingClass={dropdownFloatingClass} />
|
|
240
|
+
}
|
|
195
241
|
>
|
|
196
242
|
{/* Os children ficam entre a lista e o input: sem conversa e a
|
|
197
243
|
landing com os cards; com conversa, o aviso sobre a IA. */}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { TbBrain, TbCheck, TbChevronDown } from 'react-icons/tb'
|
|
2
|
+
import Dropdown from '@/components/ui/Dropdown'
|
|
3
|
+
import { useEsforcoStore } from '../store/esforcoStore'
|
|
4
|
+
import type { Esforco } from '../types'
|
|
5
|
+
|
|
6
|
+
type NivelDeEsforco = {
|
|
7
|
+
valor: Esforco
|
|
8
|
+
rotulo: string
|
|
9
|
+
descricao: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Os níveis, do menor para o maior raciocínio. Servem o botão e o menu. */
|
|
13
|
+
const NIVEIS: ReadonlyArray<NivelDeEsforco> = [
|
|
14
|
+
{
|
|
15
|
+
valor: 'minimal',
|
|
16
|
+
rotulo: 'Mínimo',
|
|
17
|
+
descricao: 'Mais rápido, para consultas diretas.',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
valor: 'medium',
|
|
21
|
+
rotulo: 'Médio',
|
|
22
|
+
descricao: 'Equilíbrio entre rapidez e cuidado. Recomendado.',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
valor: 'high',
|
|
26
|
+
rotulo: 'Alto',
|
|
27
|
+
descricao: 'Pensa mais antes de responder; bom para análises.',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
valor: 'max',
|
|
31
|
+
rotulo: 'Máximo',
|
|
32
|
+
descricao: 'Pensa o máximo possível antes de responder.',
|
|
33
|
+
},
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
/** O `eventKey` do Dropdown é `string`; só um dos níveis acima é aceito. */
|
|
37
|
+
const ehEsforco = (valor: string): valor is Esforco =>
|
|
38
|
+
NIVEIS.some((nivel) => nivel.valor === valor)
|
|
39
|
+
|
|
40
|
+
type EsforcoRaciocinioProps = {
|
|
41
|
+
/** Classes do menu flutuante; o widget passa um z-index acima do painel. */
|
|
42
|
+
floatingClass?: string
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Seletor do nível de raciocínio, dentro da caixa de mensagem.
|
|
47
|
+
*
|
|
48
|
+
* O botão mostra o nível atual; o menu abre para cima, com uma linha
|
|
49
|
+
* explicando cada nível. A escolha vale para as próximas mensagens (e para as
|
|
50
|
+
* retomadas de aprovação e de formulário); as respostas já dadas não mudam.
|
|
51
|
+
*/
|
|
52
|
+
const EsforcoRaciocinio = ({ floatingClass }: EsforcoRaciocinioProps) => {
|
|
53
|
+
const { esforco, setEsforco } = useEsforcoStore()
|
|
54
|
+
const atual = NIVEIS.find((nivel) => nivel.valor === esforco)
|
|
55
|
+
|
|
56
|
+
const handleSelect = (valor: string) => {
|
|
57
|
+
if (ehEsforco(valor)) {
|
|
58
|
+
setEsforco(valor)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<Dropdown
|
|
64
|
+
placement="top-end"
|
|
65
|
+
activeKey={esforco}
|
|
66
|
+
menuClass="w-72"
|
|
67
|
+
floatingClass={floatingClass}
|
|
68
|
+
renderTitle={
|
|
69
|
+
<button
|
|
70
|
+
type="button"
|
|
71
|
+
aria-label={`Nível de raciocínio: ${atual?.rotulo}`}
|
|
72
|
+
className="flex items-center gap-1 rounded-lg px-2 py-1 text-xs font-semibold text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-gray-100"
|
|
73
|
+
>
|
|
74
|
+
<TbBrain className="text-base" />
|
|
75
|
+
<span>{atual?.rotulo}</span>
|
|
76
|
+
<TbChevronDown />
|
|
77
|
+
</button>
|
|
78
|
+
}
|
|
79
|
+
>
|
|
80
|
+
<Dropdown.Item variant="header">
|
|
81
|
+
<div className="px-3 pb-2">
|
|
82
|
+
<div className="heading-text text-sm font-bold">
|
|
83
|
+
Raciocínio
|
|
84
|
+
</div>
|
|
85
|
+
<div className="text-xs text-gray-500 dark:text-gray-400">
|
|
86
|
+
Quanto o assistente pensa antes de responder.
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
</Dropdown.Item>
|
|
90
|
+
{NIVEIS.map((nivel) => (
|
|
91
|
+
<Dropdown.Item
|
|
92
|
+
key={nivel.valor}
|
|
93
|
+
eventKey={nivel.valor}
|
|
94
|
+
onSelect={handleSelect}
|
|
95
|
+
// O MenuItem fixa 42px de altura e `nowrap`, feitos para
|
|
96
|
+
// uma linha; aqui cada item tem título e descrição.
|
|
97
|
+
style={{ height: 'auto' }}
|
|
98
|
+
className="items-start whitespace-normal py-2"
|
|
99
|
+
>
|
|
100
|
+
<div className="flex-1">
|
|
101
|
+
<div>{nivel.rotulo}</div>
|
|
102
|
+
<div className="text-xs font-normal text-gray-500 dark:text-gray-400">
|
|
103
|
+
{nivel.descricao}
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
{nivel.valor === esforco && (
|
|
107
|
+
<TbCheck className="mt-0.5 shrink-0 text-lg" />
|
|
108
|
+
)}
|
|
109
|
+
</Dropdown.Item>
|
|
110
|
+
))}
|
|
111
|
+
</Dropdown>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export default EsforcoRaciocinio
|