@projectcor/maia-components 2.11.67-1 → 2.11.67-2
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/lib/components/atoms/Chip/Chip.js +50 -15
- package/lib/components/atoms/Chip/styles.js +9 -5
- package/lib/components/atoms/ContextMentionPopover/ContextMentionPopover.js +38 -6
- package/lib/components/atoms/ContextMentionPopover/ContextMentionPopover.styles.js +21 -13
- package/lib/components/atoms/MAIAInput/MAIAInput.js +71 -215
- package/lib/components/atoms/MAIAInput/styles.js +24 -64
- package/lib/components/atoms/MAIAMessage/MAIAMessage.js +2 -4
- package/lib/components/molecules/ChatAIHome/ChatAIHome.js +297 -46
- package/lib/components/molecules/ChatAIHome/styles.js +63 -26
- package/lib/components/molecules/ChatAIMessages/ChatAIMessages.js +84 -159
- package/lib/components/molecules/ChatAIMessages/newStyles.js +19 -9
- package/lib/components/molecules/ChatAIModal/ChatAIModal.js +220 -42
- package/lib/components/molecules/ChatAIModal/components/ChatAiModalFooter/ChatAiModalFooter.js +26 -1
- package/lib/components/molecules/ChatAIModal/components/ChatAiModalHeader/ChatAiModalHeader.js +17 -17
- package/lib/components/molecules/ChatFooter/ChatFooter.js +75 -18
- package/lib/components/molecules/ChatFooter/ChatFooterFaqs.js +22 -7
- package/lib/components/molecules/ChatFooter/styles.js +11 -2
- package/lib/components/molecules/Sidebar/Sidebar.js +11 -7
- package/lib/components/organisms/EditQuestionModal/EditQuestionModal.js +2 -2
- package/lib/constants/maiaTaskPanelAccess.js +7 -5
- package/lib/constants/taskUrls.js +3 -1
- package/lib/context/global-context.js +8 -1
- package/lib/dev/DevContextMentionInput.js +1 -3
- package/lib/hooks/index.js +2 -1
- package/lib/hooks/useChatManager/useChatManager.js +155 -144
- package/lib/hooks/useChatMessages/useChatMessages.js +33 -2
- package/lib/hooks/useContextPinPopover.js +235 -0
- package/lib/hooks/useEntitySearch.js +74 -129
- package/lib/hooks/useEvent.js +2 -1
- package/lib/hooks/useFrequentlyAskedQuestions.js +12 -10
- package/lib/hooks/useFrequentlyUsedActions.js +5 -3
- package/lib/hooks/useMentionAllowedTypes.js +11 -1
- package/lib/hooks/useMentionPopover.js +3 -2
- package/lib/hooks/useOrchestratorStream/useOrchestratorStream.interface.js +1 -1
- package/lib/hooks/useOrchestratorStream/useOrchestratorStream.js +28 -22
- package/lib/hooks/useProjectSearch.js +4 -28
- package/lib/hooks/useProjectSummaryConfig.js +88 -33
- package/lib/hooks/useRecentClientsSearch.js +4 -34
- package/lib/hooks/useRecentContexts.js +86 -0
- package/lib/hooks/useSmoothStreamText/useSmoothStreamText.js +24 -16
- package/lib/lang/br/index.js +28 -10
- package/lib/lang/en/index.js +28 -10
- package/lib/lang/es/index.js +28 -10
- package/lib/lang/fr/index.js +28 -10
- package/lib/services/maia/Actions/getFrequentlyUsedActions.js +6 -3
- package/lib/services/maia/Agents/getAgents.js +225 -175
- package/lib/services/maia/Chats/getChatMessages.js +13 -3
- package/lib/services/maia/Chats/getChatsByUserId.js +10 -2
- package/lib/services/maia/Faqs/getFrequentlyAskedQuestions.js +6 -4
- package/lib/services/maia/Orchestrator/orchestrator.js +25 -11
- package/lib/services/maia/RecentContexts/getRecentContexts.js +54 -0
- package/lib/services/maia/RecentContexts/index.js +6 -0
- package/lib/services/maia/index.js +4 -2
- package/lib/services/utils/validateIsMaia.js +2 -2
- package/lib/types/Chat.js +1 -1
- package/lib/types/agent.js +1 -1
- package/lib/utils/agentDisplayName.js +9 -1
- package/lib/utils/entityLinkRender.js +132 -0
- package/lib/utils/hitlAnalytics.js +3 -3
- package/lib/utils/renderContextMentions.js +3 -1
- package/package.json +1 -1
- package/lib/components/atoms/MAIAViz/MAIAViz.js +0 -97
- package/lib/components/atoms/MAIAViz/MAIAViz.parse.js +0 -131
- package/lib/components/atoms/MAIAViz/MAIAViz.skeleton.js +0 -40
- package/lib/components/atoms/MAIAViz/MAIAViz.styles.js +0 -8
- package/lib/components/atoms/MAIAViz/MAIAViz.types.js +0 -49
- package/lib/components/atoms/MAIAViz/MAIAVizBar.js +0 -123
- package/lib/components/atoms/MAIAViz/MAIAVizDonut.js +0 -111
- package/lib/components/atoms/MAIAViz/MAIAVizKpis.js +0 -34
- package/lib/components/atoms/MAIAViz/README.md +0 -85
- package/lib/components/atoms/MAIAViz/index.js +0 -2
- package/lib/types/Hitl.js +0 -2
- package/lib/utils/maiaStreamdownRenderers.js +0 -16
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
# MAIAViz — PoC de visualizaciones inline en el chat
|
|
2
|
-
|
|
3
|
-
Renderiza KPIs, gráficos de barras y donas dentro de los mensajes de MAIA, igual
|
|
4
|
-
que Claude renderiza cuadros y gráficos. **El modelo no genera HTML ni SVG**: solo
|
|
5
|
-
emite datos en JSON dentro de un bloque de código ` ```maia-viz `. El render lo hace
|
|
6
|
-
el cliente (estos componentes), por lo que es seguro y no pasa por la sanitización
|
|
7
|
-
de HTML de Streamdown.
|
|
8
|
-
|
|
9
|
-
## Cómo funciona
|
|
10
|
-
|
|
11
|
-
Streamdown expone `plugins.renderers` (el mismo mecanismo con el que integra Mermaid).
|
|
12
|
-
Registramos un `CustomRenderer` para el lenguaje `maia-viz`:
|
|
13
|
-
|
|
14
|
-
```tsx
|
|
15
|
-
// maiaStreamdownRenderers.tsx
|
|
16
|
-
export const MAIA_STREAMDOWN_RENDERERS = [{ language: 'maia-viz', component: MAIAViz }]
|
|
17
|
-
|
|
18
|
-
// MAIAMessage.tsx
|
|
19
|
-
<Streamdown plugins={{ code, renderers: MAIA_STREAMDOWN_RENDERERS }}>{message}</Streamdown>
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Cuando el stream contiene un fence ` ```maia-viz `, Streamdown llama a `MAIAViz`
|
|
23
|
-
con `{ code, isIncomplete, language, meta }`. Mientras `isIncomplete` es `true`
|
|
24
|
-
(JSON parcial durante el streaming) mostramos un skeleton; al cerrarse el fence,
|
|
25
|
-
parseamos el JSON y dibujamos la visualización.
|
|
26
|
-
|
|
27
|
-
## Contrato de datos
|
|
28
|
-
|
|
29
|
-
Un bloque `maia-viz` contiene **un** objeto JSON. Tipos soportados:
|
|
30
|
-
|
|
31
|
-
### `kpis` — tarjetas de indicadores
|
|
32
|
-
```maia-viz
|
|
33
|
-
{ "type": "kpis", "items": [
|
|
34
|
-
{ "label": "Ingresos", "value": "$184.6M", "delta": "+18.3% vs 2024", "trend": "up" },
|
|
35
|
-
{ "label": "Margen EBITDA", "value": "21.4%", "delta": "+2.1 pts", "trend": "up" }
|
|
36
|
-
] }
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### `bar` — gráfico de barras
|
|
40
|
-
```maia-viz
|
|
41
|
-
{ "type": "bar", "title": "Ingresos por trimestre", "unit": "M USD", "data": [
|
|
42
|
-
{ "label": "Q1", "value": 40 }, { "label": "Q2", "value": 44 },
|
|
43
|
-
{ "label": "Q3", "value": 47 }, { "label": "Q4", "value": 52 }
|
|
44
|
-
] }
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### `donut` — distribución porcentual
|
|
48
|
-
```maia-viz
|
|
49
|
-
{ "type": "donut", "title": "Mix de ingresos", "data": [
|
|
50
|
-
{ "label": "Last-mile", "value": 52 }, { "label": "Freight", "value": 28 },
|
|
51
|
-
{ "label": "Warehousing", "value": 13 }, { "label": "Otros", "value": 7 }
|
|
52
|
-
] }
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### `report` — reporte compuesto (varios bloques)
|
|
56
|
-
```maia-viz
|
|
57
|
-
{ "type": "report", "title": "Nordvik Logistics — KPIs anuales",
|
|
58
|
-
"subtitle": "Año fiscal 2025 · Logística",
|
|
59
|
-
"blocks": [
|
|
60
|
-
{ "type": "kpis", "items": [ ... ] },
|
|
61
|
-
{ "type": "bar", "title": "Ingresos por trimestre", "unit": "M USD", "data": [ ... ] },
|
|
62
|
-
{ "type": "donut", "title": "Mix de ingresos", "data": [ ... ] }
|
|
63
|
-
] }
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Campos: `delta` y `trend` (`up`/`down`/`flat`) son opcionales; `trend` colorea el
|
|
67
|
-
delta (verde/rojo/gris). `color` (HEX) es opcional por punto; si no, se usa la
|
|
68
|
-
paleta de COR por índice (navy → blue → teal → green → purple → ...).
|
|
69
|
-
|
|
70
|
-
## Snippet para el system prompt del agente
|
|
71
|
-
|
|
72
|
-
> Cuando presentes métricas, KPIs, distribuciones o series numéricas, podés
|
|
73
|
-
> renderizar una visualización emitiendo un bloque de código con el lenguaje
|
|
74
|
-
> `maia-viz` que contenga **un único objeto JSON válido** con el contrato
|
|
75
|
-
> documentado (tipos: `kpis`, `bar`, `donut`, `report`). No incluyas texto
|
|
76
|
-
> dentro del bloque, solo JSON. Usá una visualización solo cuando aporte valor
|
|
77
|
-
> sobre el texto; el resto del mensaje sigue siendo Markdown normal. Si no estás
|
|
78
|
-
> seguro de los datos, no inventes un gráfico.
|
|
79
|
-
|
|
80
|
-
## Extensión
|
|
81
|
-
|
|
82
|
-
Agregar un tipo nuevo (p. ej. `line`): crear `MAIAVizLine.tsx`, sumarlo al
|
|
83
|
-
discriminador en `MAIAViz.tsx` (`renderBlock`) y al contrato en `MAIAViz.types.ts`.
|
|
84
|
-
Para charts más complejos/interactivos se puede reemplazar el SVG por Recharts sin
|
|
85
|
-
cambiar el contrato ni el cableado de Streamdown.
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { MAIAViz } from './MAIAViz';
|
|
2
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJNQUlBVml6Il0sInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2NvbXBvbmVudHMvYXRvbXMvTUFJQVZpei9pbmRleC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgeyBNQUlBVml6IH0gZnJvbSAnLi9NQUlBVml6J1xuZXhwb3J0IHR5cGUge1xuICBNYWlhVml6U3BlYyxcbiAgS3Bpc1NwZWMsXG4gIEJhclNwZWMsXG4gIERvbnV0U3BlYyxcbiAgUmVwb3J0U3BlYyxcbiAgUmVwb3J0QmxvY2ssXG4gIEtwaUl0ZW0sXG4gIFNlcmllc1BvaW50LFxufSBmcm9tICcuL01BSUFWaXoudHlwZXMnXG4iXSwibWFwcGluZ3MiOiJBQUFBLFNBQVNBLE9BQU8sUUFBUSxXQUFXIiwiaWdub3JlTGlzdCI6W119
|
package/lib/types/Hitl.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiLi4vLi4vc3JjL3R5cGVzL0hpdGwudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHR5cGUgSGl0bEFwcHJvdmFsTW9kZSA9ICdhcHByb3ZlX2VhY2gnIHwgJ2Z1bGxfYWNjZXNzJ1xuIl0sIm1hcHBpbmdzIjoiIiwiaWdub3JlTGlzdCI6W119
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { MAIAViz } from '../components/atoms/MAIAViz/MAIAViz';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Renderers custom de Streamdown. Cada bloque de código cuyo lenguaje matchee
|
|
5
|
-
* con `language` se renderiza con `component` (recibe { code, isIncomplete, ... })
|
|
6
|
-
* en lugar del bloque de código por defecto. Es el mismo mecanismo que usa
|
|
7
|
-
* Streamdown para Mermaid.
|
|
8
|
-
*
|
|
9
|
-
* El modelo solo emite datos en JSON dentro de un fence ```maia-viz; el render
|
|
10
|
-
* (KPIs, barras, dona) lo hace el cliente, sin pasar por HTML ni sanitización.
|
|
11
|
-
*/
|
|
12
|
-
export var MAIA_STREAMDOWN_RENDERERS = [{
|
|
13
|
-
language: 'maia-viz',
|
|
14
|
-
component: MAIAViz
|
|
15
|
-
}];
|
|
16
|
-
//# sourceMappingURL=data:application/json;charset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