@orbe-agro/client-core 5.6.252 → 5.6.254
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/components/template/Footer.js +1 -1
- package/dist/@ecme/views/concepts/ai/Chat/components/ApprovalCard.js +1 -1
- package/dist/@ecme/views/concepts/ai/Chat/components/ApprovalCard.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Chat/components/ChatLandingView.js +33 -32
- package/dist/@ecme/views/concepts/ai/Chat/components/ChatLandingView.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Chat/components/ToolCallChip.js +1 -1
- package/dist/@ecme/views/concepts/ai/Chat/components/ToolCallChip.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Chat/components/toolPresentation.js +90 -8
- package/dist/@ecme/views/concepts/ai/Chat/components/toolPresentation.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Chat/hooks/useChatSend.js +2 -3
- package/dist/@ecme/views/concepts/ai/Chat/hooks/useChatSend.js.map +1 -1
- package/dist/@types/@ecme/views/concepts/ai/Chat/components/ChatLandingView.d.ts.map +1 -1
- package/dist/@types/@ecme/views/concepts/ai/Chat/components/toolPresentation.d.ts +9 -4
- package/dist/@types/@ecme/views/concepts/ai/Chat/components/toolPresentation.d.ts.map +1 -1
- package/dist/@types/@ecme/views/concepts/ai/Chat/hooks/useChatSend.d.ts.map +1 -1
- package/dist/@types/base/@types/models/racao/carga.d.ts +10 -0
- package/dist/@types/base/@types/models/racao/carga.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/endpoints.navigation.d.ts +4 -0
- package/dist/@types/base/configs/endpoints.config/endpoints.navigation.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/racao/config/carga.d.ts +4 -0
- package/dist/@types/base/configs/endpoints.config/racao/config/carga.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/racao/racao.d.ts +4 -0
- package/dist/@types/base/configs/endpoints.config/racao/racao.d.ts.map +1 -1
- package/dist/@types/base/services/modules/racao/carga/CargaService.d.ts +2 -1
- package/dist/@types/base/services/modules/racao/carga/CargaService.d.ts.map +1 -1
- package/dist/base/@types/models/racao/carga.js.map +1 -1
- package/dist/base/configs/endpoints.config/racao/config/carga.js +1 -0
- package/dist/base/configs/endpoints.config/racao/config/carga.js.map +1 -1
- package/dist/base/index.js +2 -1
- package/dist/base/services/index.js +2 -1
- package/dist/base/services/modules/index.js +2 -1
- package/dist/base/services/modules/racao/carga/CargaService.js +7 -0
- package/dist/base/services/modules/racao/carga/CargaService.js.map +1 -1
- package/dist/base/services/modules/racao/index.js +2 -1
- package/lib/@ecme/views/concepts/ai/Chat/components/ApprovalCard.tsx +1 -1
- package/lib/@ecme/views/concepts/ai/Chat/components/ChatLandingView.tsx +52 -44
- package/lib/@ecme/views/concepts/ai/Chat/components/ToolCallChip.tsx +1 -1
- package/lib/@ecme/views/concepts/ai/Chat/components/toolPresentation.ts +126 -9
- package/lib/@ecme/views/concepts/ai/Chat/hooks/useChatSend.ts +12 -5
- package/lib/base/@types/models/racao/carga.ts +19 -0
- package/lib/base/configs/endpoints.config/racao/config/carga.ts +1 -0
- package/lib/base/services/modules/racao/carga/CargaService.ts +8 -1
- package/package.json +1 -1
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { formatQuantity } from '@base/utils/functions/stringUtils'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
TbBriefcase,
|
|
4
|
+
TbBuildingPlus,
|
|
5
|
+
TbCalendarEvent,
|
|
6
|
+
TbFilePlus,
|
|
7
|
+
TbForms,
|
|
8
|
+
TbListSearch,
|
|
9
|
+
TbPackage,
|
|
10
|
+
TbPackages,
|
|
11
|
+
TbSearch,
|
|
12
|
+
TbTool,
|
|
13
|
+
TbUserSearch,
|
|
14
|
+
} from 'react-icons/tb'
|
|
3
15
|
import type { IconType } from 'react-icons'
|
|
4
16
|
|
|
5
17
|
/**
|
|
@@ -36,6 +48,53 @@ const FERRAMENTAS: Record<string, Ferramenta> = {
|
|
|
36
48
|
executando: 'Criando contrato',
|
|
37
49
|
icone: TbFilePlus,
|
|
38
50
|
},
|
|
51
|
+
buscar_area: {
|
|
52
|
+
rotulo: 'Consulta de área',
|
|
53
|
+
executando: 'Consultando área',
|
|
54
|
+
icone: TbSearch,
|
|
55
|
+
},
|
|
56
|
+
listar_areas: {
|
|
57
|
+
rotulo: 'Consulta de áreas',
|
|
58
|
+
executando: 'Consultando áreas',
|
|
59
|
+
icone: TbListSearch,
|
|
60
|
+
},
|
|
61
|
+
criar_area: {
|
|
62
|
+
rotulo: 'Criação de área',
|
|
63
|
+
executando: 'Criando área',
|
|
64
|
+
icone: TbBuildingPlus,
|
|
65
|
+
},
|
|
66
|
+
buscar_usuario: {
|
|
67
|
+
rotulo: 'Consulta de usuário',
|
|
68
|
+
executando: 'Consultando usuário',
|
|
69
|
+
icone: TbUserSearch,
|
|
70
|
+
},
|
|
71
|
+
listar_safras: {
|
|
72
|
+
rotulo: 'Consulta de safras',
|
|
73
|
+
executando: 'Consultando safras',
|
|
74
|
+
icone: TbCalendarEvent,
|
|
75
|
+
},
|
|
76
|
+
listar_parceiros: {
|
|
77
|
+
rotulo: 'Consulta de parceiros de negócio',
|
|
78
|
+
executando: 'Consultando parceiros',
|
|
79
|
+
icone: TbBriefcase,
|
|
80
|
+
},
|
|
81
|
+
listar_produtos: {
|
|
82
|
+
rotulo: 'Consulta de produtos',
|
|
83
|
+
executando: 'Consultando produtos',
|
|
84
|
+
icone: TbPackages,
|
|
85
|
+
},
|
|
86
|
+
buscar_produto: {
|
|
87
|
+
rotulo: 'Consulta de produto',
|
|
88
|
+
executando: 'Consultando produto',
|
|
89
|
+
icone: TbPackage,
|
|
90
|
+
},
|
|
91
|
+
// Nao executa nada no ERP: e o sinal de que faltam campos. Mas o agente a
|
|
92
|
+
// pede como qualquer outra, entao um chip aparece junto do formulario.
|
|
93
|
+
solicitar_dados: {
|
|
94
|
+
rotulo: 'Dados necessários',
|
|
95
|
+
executando: 'Verificando os dados',
|
|
96
|
+
icone: TbForms,
|
|
97
|
+
},
|
|
39
98
|
}
|
|
40
99
|
|
|
41
100
|
const humanizar = (texto: string) =>
|
|
@@ -62,7 +121,29 @@ const CAMPOS: Record<string, string> = {
|
|
|
62
121
|
tipo_contrato: 'Tipo de contrato',
|
|
63
122
|
contrato_venda: 'Contrato de venda',
|
|
64
123
|
ordem_venda: 'Ordem de venda',
|
|
65
|
-
id: '
|
|
124
|
+
id: 'Código',
|
|
125
|
+
nome: 'Nome',
|
|
126
|
+
responsavel_id: 'Responsável',
|
|
127
|
+
responsavel_nome: 'Nome do responsável',
|
|
128
|
+
// Safra, produto e parceiro de negócio
|
|
129
|
+
safra: 'Safra',
|
|
130
|
+
ids: 'Códigos',
|
|
131
|
+
search: 'Busca',
|
|
132
|
+
codigo: 'Código',
|
|
133
|
+
descricao: 'Descrição',
|
|
134
|
+
tipo_produto: 'Tipo do produto',
|
|
135
|
+
is_cultura: 'É cultura',
|
|
136
|
+
status_material: 'Situação',
|
|
137
|
+
business_partner: 'Código do parceiro',
|
|
138
|
+
nome_completo: 'Nome do parceiro',
|
|
139
|
+
cpf_ou_cnpj: 'CPF ou CNPJ',
|
|
140
|
+
cpf: 'CPF',
|
|
141
|
+
cnpj: 'CNPJ',
|
|
142
|
+
is_cliente: 'É cliente',
|
|
143
|
+
is_produtor: 'É produtor',
|
|
144
|
+
is_transportadora: 'É transportadora',
|
|
145
|
+
is_armazem: 'É armazém',
|
|
146
|
+
status_elegibilidade: 'Elegibilidade',
|
|
66
147
|
page_number: 'Página',
|
|
67
148
|
page_size: 'Itens por página',
|
|
68
149
|
sort_field: 'Ordenar por',
|
|
@@ -70,7 +151,27 @@ const CAMPOS: Record<string, string> = {
|
|
|
70
151
|
filtro: 'Filtro',
|
|
71
152
|
}
|
|
72
153
|
|
|
73
|
-
|
|
154
|
+
/**
|
|
155
|
+
* Rotulos que dependem da ferramenta.
|
|
156
|
+
*
|
|
157
|
+
* O `id` e o caso: o mesmo parametro nomeia entidades diferentes conforme quem
|
|
158
|
+
* o recebe. Sem isto, buscar o usuario 5 exibiria "Contrato: #5".
|
|
159
|
+
*/
|
|
160
|
+
const CAMPO_POR_FERRAMENTA: Record<string, Record<string, string>> = {
|
|
161
|
+
buscar_contrato_armazenagem_graos: { id: 'Contrato' },
|
|
162
|
+
buscar_area: { id: 'Área' },
|
|
163
|
+
listar_areas: { id: 'Área' },
|
|
164
|
+
buscar_usuario: { id: 'Usuário' },
|
|
165
|
+
listar_safras: { id: 'Safra' },
|
|
166
|
+
listar_parceiros: { id: 'Parceiro' },
|
|
167
|
+
listar_produtos: { id: 'Produto' },
|
|
168
|
+
buscar_produto: { id: 'Produto' },
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export const rotularCampo = (chave: string, ferramenta?: string) =>
|
|
172
|
+
CAMPO_POR_FERRAMENTA[ferramenta ?? '']?.[chave] ??
|
|
173
|
+
CAMPOS[chave] ??
|
|
174
|
+
humanizar(chave)
|
|
74
175
|
|
|
75
176
|
/** Campos que sao referencia a um registro: exibidos como "#123". */
|
|
76
177
|
const REFERENCIAS = new Set([
|
|
@@ -79,6 +180,7 @@ const REFERENCIAS = new Set([
|
|
|
79
180
|
'safra_id',
|
|
80
181
|
'contrato_venda',
|
|
81
182
|
'ordem_venda',
|
|
183
|
+
'responsavel_id',
|
|
82
184
|
'id',
|
|
83
185
|
])
|
|
84
186
|
|
|
@@ -114,7 +216,11 @@ export const tipoDoCampo = (chave: string): 'numero' | 'enum' | 'texto' => {
|
|
|
114
216
|
}
|
|
115
217
|
|
|
116
218
|
/** Converte o valor tecnico no que o usuario espera ler. */
|
|
117
|
-
export const formatarValor = (
|
|
219
|
+
export const formatarValor = (
|
|
220
|
+
chave: string,
|
|
221
|
+
valor: unknown,
|
|
222
|
+
ferramenta?: string,
|
|
223
|
+
): string => {
|
|
118
224
|
if (valor === null || valor === undefined || valor === '') {
|
|
119
225
|
return '—'
|
|
120
226
|
}
|
|
@@ -143,14 +249,25 @@ export const formatarValor = (chave: string, valor: unknown): string => {
|
|
|
143
249
|
return '—'
|
|
144
250
|
}
|
|
145
251
|
return entradas
|
|
146
|
-
.map(
|
|
252
|
+
.map(
|
|
253
|
+
([k, v]) =>
|
|
254
|
+
`${rotularCampo(k, ferramenta)}: ${formatarValor(k, v, ferramenta)}`,
|
|
255
|
+
)
|
|
147
256
|
.join(', ')
|
|
148
257
|
}
|
|
149
258
|
return String(valor)
|
|
150
259
|
}
|
|
151
260
|
|
|
152
|
-
/**
|
|
153
|
-
|
|
261
|
+
/**
|
|
262
|
+
* Pares (rotulo, valor) prontos para exibir, ignorando o que esta vazio.
|
|
263
|
+
*
|
|
264
|
+
* `ferramenta` resolve os rotulos ambiguos (ver CAMPO_POR_FERRAMENTA); quem nao
|
|
265
|
+
* a conhece — o formulario de coleta, por exemplo — pode omitir.
|
|
266
|
+
*/
|
|
267
|
+
export const camposVisiveis = (
|
|
268
|
+
args: Record<string, unknown>,
|
|
269
|
+
ferramenta?: string,
|
|
270
|
+
) =>
|
|
154
271
|
Object.entries(args)
|
|
155
272
|
.filter(([, valor]) => {
|
|
156
273
|
if (valor === null || valor === undefined || valor === '') return false
|
|
@@ -161,6 +278,6 @@ export const camposVisiveis = (args: Record<string, unknown>) =>
|
|
|
161
278
|
})
|
|
162
279
|
.map(([chave, valor]) => ({
|
|
163
280
|
chave,
|
|
164
|
-
rotulo: rotularCampo(chave),
|
|
165
|
-
valor: formatarValor(chave, valor),
|
|
281
|
+
rotulo: rotularCampo(chave, ferramenta),
|
|
282
|
+
valor: formatarValor(chave, valor, ferramenta),
|
|
166
283
|
}))
|
|
@@ -147,11 +147,18 @@ const useChatSend = () => {
|
|
|
147
147
|
break
|
|
148
148
|
|
|
149
149
|
case 'done':
|
|
150
|
-
// O done
|
|
151
|
-
//
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
150
|
+
// O done é a fonte autoritativa do texto DESTA requisição —
|
|
151
|
+
// se algum token se perdeu, ele corrige.
|
|
152
|
+
//
|
|
153
|
+
// Numa retomada, porém, o que o agente disse ANTES da pausa
|
|
154
|
+
// não vem nele (o backend acumula as falas por requisição):
|
|
155
|
+
// veio em `inicial.texto`. Sem concatenar, a bolha encolhia
|
|
156
|
+
// para só a frase final — "Vou criar a área para você…"
|
|
157
|
+
// virava "Nada foi criado" — e o agente parecia ter
|
|
158
|
+
// esquecido tudo. No primeiro envio `inicial.texto` é '',
|
|
159
|
+
// então nada muda ali.
|
|
160
|
+
texto = inicial.texto + evento.data.content
|
|
161
|
+
updateConversation(chatId, messageId, { content: texto })
|
|
155
162
|
break
|
|
156
163
|
|
|
157
164
|
case 'error':
|
|
@@ -3,6 +3,15 @@ export enum TipoCarga {
|
|
|
3
3
|
TRANSFERENCIA_CD = 'TRANSFERENCIA_CD',
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
+
export type TEtapaAgendamentoCarga =
|
|
7
|
+
| 'AGUARDANDO_CHEGADA_PORTARIA'
|
|
8
|
+
| 'CHEGADA_PORTARIA'
|
|
9
|
+
| 'TRIAGEM'
|
|
10
|
+
| 'CHAMADA_USINA'
|
|
11
|
+
| 'CARREGAMENTO'
|
|
12
|
+
| 'FATURAMENTO'
|
|
13
|
+
| 'SAIDA_PORTARIA'
|
|
14
|
+
|
|
6
15
|
export type TCargaColumnDef = {
|
|
7
16
|
id: number
|
|
8
17
|
dataCriacao: string
|
|
@@ -21,6 +30,8 @@ export type TCargaColumnDef = {
|
|
|
21
30
|
pesoTotal: number
|
|
22
31
|
valorFreteTotal: number
|
|
23
32
|
tipoCarga: string
|
|
33
|
+
etapaAgendamento?: TEtapaAgendamentoCarga | null
|
|
34
|
+
agendamentoId?: number | null
|
|
24
35
|
}
|
|
25
36
|
|
|
26
37
|
export type TCarga = {
|
|
@@ -111,6 +122,14 @@ export type TContadoresCarga = {
|
|
|
111
122
|
reprovadas: number
|
|
112
123
|
}
|
|
113
124
|
|
|
125
|
+
export type TContadoresEtapaAgendamentoCarga = {
|
|
126
|
+
aguardandoAgendamento: number
|
|
127
|
+
aguardandoChegada: number
|
|
128
|
+
emTriagem: number
|
|
129
|
+
emCarregamento: number
|
|
130
|
+
saidaPortaria: number
|
|
131
|
+
}
|
|
132
|
+
|
|
114
133
|
export type TAprovarRacaoCargaPayload = {
|
|
115
134
|
periodoInicial: string
|
|
116
135
|
periodoFinal: string
|
|
@@ -9,6 +9,7 @@ const carga = {
|
|
|
9
9
|
reprovar: { endpoint: `${CARGA_BASE_URL}/reprovar/`, method: 'post' },
|
|
10
10
|
findMonitor: { endpoint: `${CARGA_BASE_URL}/find-monitor`, method: 'post' },
|
|
11
11
|
findContadores: { endpoint: `${CARGA_BASE_URL}/contadores`, method: 'get' },
|
|
12
|
+
findContadoresEtapaAgendamento: { endpoint: `${CARGA_BASE_URL}/contadores-etapa-agendamento`, method: 'get' },
|
|
12
13
|
findOrdensDisponiveis: { endpoint: `${CARGA_BASE_URL}/ordens-disponiveis/`, method: 'get' },
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ApiService from "@/services/ApiService";
|
|
2
2
|
import { IFilterParams, TQueryResponse } from "@base/@types/api";
|
|
3
|
-
import { TCarga, TAprovarRacaoCarga, TContadoresCarga } from "@base/@types/models/racao/carga";
|
|
3
|
+
import { TCarga, TAprovarRacaoCarga, TContadoresCarga, TContadoresEtapaAgendamentoCarga } from "@base/@types/models/racao/carga";
|
|
4
4
|
import endpointConfig from "@base/configs/endpoints.config/endpoints.navigation";
|
|
5
5
|
|
|
6
6
|
const CARGA_ENDPOINT = endpointConfig.racao.carga;
|
|
@@ -72,3 +72,10 @@ export async function apiFindContadoresRacaoCarga() {
|
|
|
72
72
|
method: CARGA_ENDPOINT.findContadores.method,
|
|
73
73
|
})
|
|
74
74
|
}
|
|
75
|
+
|
|
76
|
+
export async function apiFindContadoresEtapaAgendamentoRacaoCarga() {
|
|
77
|
+
return ApiService.fetchDataWithAxios<TContadoresEtapaAgendamentoCarga>({
|
|
78
|
+
url: CARGA_ENDPOINT.findContadoresEtapaAgendamento.endpoint,
|
|
79
|
+
method: CARGA_ENDPOINT.findContadoresEtapaAgendamento.method,
|
|
80
|
+
})
|
|
81
|
+
}
|
package/package.json
CHANGED