@foris/ai-agent 1.0.5 → 1.0.7
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/ai-agent.es.js +13430 -12628
- package/dist/ai-agent.umd.js +67 -92
- package/dist/components/chat-panel/{ChatPanel.d.ts → chat-panel/ChatPanel.d.ts} +3 -17
- package/dist/components/chat-panel/chat-panel/ChatPanel.test.d.ts +0 -0
- package/dist/components/chat-panel/chat-panel/chatPanel.constants.d.ts +6 -0
- package/dist/components/chat-panel/chat-panel/chatPanel.types.d.ts +84 -0
- package/dist/components/chat-panel/chat-panel/index.d.ts +3 -0
- package/dist/components/chat-panel/{ChatPanelClearDialog.d.ts → clear-dialog/ClearDialog.d.ts} +3 -3
- package/dist/components/chat-panel/clear-dialog/index.d.ts +1 -0
- package/dist/components/chat-panel/error-connection-fullbody/ErrorConnectionFullBody.d.ts +4 -0
- package/dist/components/chat-panel/error-connection-fullbody/errorConnectionFullBody.type.d.ts +11 -0
- package/dist/components/chat-panel/error-connection-fullbody/index.d.ts +2 -0
- package/dist/components/chat-panel/error-connection-inline/ErrorConnectionInline.d.ts +4 -0
- package/dist/components/chat-panel/error-connection-inline/errorConnectionInline.type.d.ts +10 -0
- package/dist/components/chat-panel/error-connection-inline/index.d.ts +2 -0
- package/dist/components/chat-panel/footer/Footer.d.ts +4 -0
- package/dist/components/chat-panel/footer/footer.type.d.ts +18 -0
- package/dist/components/chat-panel/footer/index.d.ts +2 -0
- package/dist/components/chat-panel/{ChatPanelHeader.d.ts → header/Header.d.ts} +5 -6
- package/dist/components/chat-panel/header/Header.test.d.ts +0 -0
- package/dist/components/chat-panel/header/index.d.ts +1 -0
- package/dist/components/chat-panel/index.d.ts +1 -1
- package/dist/components/chat-panel/locale/en.json.d.ts +26 -2
- package/dist/components/chat-panel/locale/es.json.d.ts +26 -2
- package/dist/components/chat-panel/message-item/AssistantResponseFooter.d.ts +13 -0
- package/dist/components/chat-panel/message-item/MessageItem.d.ts +19 -0
- package/dist/components/chat-panel/message-item/MessageItem.test.d.ts +0 -0
- package/dist/components/chat-panel/message-item/index.d.ts +1 -0
- package/dist/components/chat-panel/reasoning-trace/ReasoningTrace.d.ts +4 -0
- package/dist/components/chat-panel/reasoning-trace/index.d.ts +2 -0
- package/dist/components/chat-panel/reasoning-trace/reasoningTrace.type.d.ts +12 -0
- package/dist/components/chat-panel/suggestions/Suggestions.d.ts +7 -0
- package/dist/components/chat-panel/suggestions/index.d.ts +1 -0
- package/dist/components/chat-panel/thinking-indicator/ThinkingIndicator.d.ts +8 -0
- package/dist/components/chat-panel/thinking-indicator/index.d.ts +1 -0
- package/dist/components/chat-panel/typing/Typing.d.ts +3 -0
- package/dist/components/chat-panel/typing/index.d.ts +1 -0
- package/dist/components/chat-panel/welcome/Welcome.d.ts +10 -0
- package/dist/components/chat-panel/welcome/Welcome.test.d.ts +0 -0
- package/dist/components/chat-panel/welcome/index.d.ts +1 -0
- package/dist/components/ui/card/Card.d.ts +4 -0
- package/dist/components/ui/card/Card.test.d.ts +0 -0
- package/dist/components/ui/card/card.types.d.ts +9 -0
- package/dist/components/ui/card/index.d.ts +2 -0
- package/dist/components/ui/icon-menu/IconMenu.d.ts +20 -0
- package/dist/components/ui/icon-menu/IconMenu.test.d.ts +0 -0
- package/dist/components/ui/icon-menu/index.d.ts +2 -0
- package/dist/components/ui/thinking-text/ThinkingText.d.ts +7 -0
- package/dist/components/ui/thinking-text/index.d.ts +1 -0
- package/dist/components/ui/tooltip.d.ts +8 -3
- package/dist/hooks/chat.constants.d.ts +2 -0
- package/dist/hooks/useChat.d.ts +8 -4
- package/dist/hooks/useChatSubmit.d.ts +2 -2
- package/dist/hooks/useClickOutside.d.ts +8 -0
- package/dist/hooks/useConnectivityPing.d.ts +27 -0
- package/dist/hooks/useMessageProcessor.d.ts +1 -1
- package/dist/hooks/useSplitChunks.d.ts +11 -2
- package/dist/hooks/useSplitChunks.test.d.ts +1 -0
- package/dist/hooks/useThinkingPhase.d.ts +19 -0
- package/dist/hooks/useThinkingPhase.test.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/style.css +1 -1
- package/package.json +5 -3
- package/dist/components/chat-panel/ChatMessageItem.d.ts +0 -7
- package/dist/components/chat-panel/ChatPanelFooter.d.ts +0 -11
- package/dist/components/chat-panel/ChatPanelWelcome.d.ts +0 -12
- package/dist/components/chat-panel/ChatSuggestionMessage.d.ts +0 -7
- package/dist/components/chat-panel/ChatTypingIndicator.d.ts +0 -3
- package/dist/components/chat-panel/chatPanel.types.d.ts +0 -18
- /package/dist/components/{ai-agent-icon → ui/ai-agent-icon}/AiAgentIcon.d.ts +0 -0
- /package/dist/components/{ai-agent-icon → ui/ai-agent-icon}/index.d.ts +0 -0
- /package/dist/components/{ai-chat-logo → ui/ai-chat-logo}/AiChatLogo.d.ts +0 -0
- /package/dist/components/{ai-chat-logo → ui/ai-chat-logo}/index.d.ts +0 -0
- /package/dist/{ai-chat-panel-menu → components/ui/ai-chat-panel-menu}/ChatPanelMenu.d.ts +0 -0
- /package/dist/{ai-chat-panel-menu → components/ui/ai-chat-panel-menu}/index.d.ts +0 -0
- /package/dist/{ai-sparkles-icon → components/ui/ai-sparkles-icon}/AiSparklesIcon.d.ts +0 -0
- /package/dist/{ai-sparkles-icon → components/ui/ai-sparkles-icon}/index.d.ts +0 -0
- /package/dist/components/{skeleton-bar → ui/skeleton-bar}/SkeletonBar.d.ts +0 -0
|
@@ -1,26 +1,12 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
2
|
import { type AiAgentTheme, type ResolveSyntaxAppearanceFn } from '@/context/AiAgentThemeContext';
|
|
3
|
-
import type { SuggestionType } from '
|
|
4
|
-
import type { DataSource } from '
|
|
5
|
-
|
|
6
|
-
title?: string;
|
|
7
|
-
welcomeTitle?: string;
|
|
8
|
-
welcomeDescription?: string;
|
|
9
|
-
suggestionsTitle?: string;
|
|
10
|
-
placeholder?: string;
|
|
11
|
-
disclaimer?: string;
|
|
12
|
-
clearChatTitle?: string;
|
|
13
|
-
clearChatDescription?: string;
|
|
14
|
-
clearChatConfirm?: string;
|
|
15
|
-
clearChatCancel?: string;
|
|
16
|
-
clearChatTooltipTitle?: string;
|
|
17
|
-
clearChatTooltipDescription?: string;
|
|
18
|
-
}
|
|
3
|
+
import type { SuggestionType } from '../../../types/chat';
|
|
4
|
+
import type { DataSource } from '../../../types/dataSource';
|
|
5
|
+
import type { ChatPanelTranslations } from './chatPanel.types';
|
|
19
6
|
interface ChatPanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
20
7
|
dataSource: DataSource;
|
|
21
8
|
className?: string;
|
|
22
9
|
onClose?: () => void;
|
|
23
|
-
onMenuClick?: () => void;
|
|
24
10
|
locale?: 'en' | 'es';
|
|
25
11
|
translations?: ChatPanelTranslations;
|
|
26
12
|
initialSuggestions?: SuggestionType[];
|
|
File without changes
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { ToolCall } from '../../../types/chat';
|
|
2
|
+
export type ErrorMessageKind = 'connection' | 'response';
|
|
3
|
+
export interface ChatPanelTranslations {
|
|
4
|
+
title?: string;
|
|
5
|
+
welcomeTitle?: string;
|
|
6
|
+
welcomeDescription?: string;
|
|
7
|
+
suggestionsTitle?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
placeholderProcessing?: string;
|
|
10
|
+
placeholderDisconnected?: string;
|
|
11
|
+
processingTooltip?: string;
|
|
12
|
+
sendMessageAriaLabel?: string;
|
|
13
|
+
disclaimer?: string;
|
|
14
|
+
clearChatTitle?: string;
|
|
15
|
+
clearChatDescription?: string;
|
|
16
|
+
clearChatConfirm?: string;
|
|
17
|
+
clearChatCancel?: string;
|
|
18
|
+
clearChatTooltipTitle?: string;
|
|
19
|
+
clearChatTooltipDescription?: string;
|
|
20
|
+
suggestionsTooltipTitle?: string;
|
|
21
|
+
suggestionsTooltipDescription?: string;
|
|
22
|
+
footerResponseCopyTooltip?: string;
|
|
23
|
+
footerResponseCopiedTooltip?: string;
|
|
24
|
+
errorFullBodyTitle?: string;
|
|
25
|
+
errorFullBodyDescription?: string;
|
|
26
|
+
errorFullBodyRetry?: string;
|
|
27
|
+
errorFullBodyReconnecting?: string;
|
|
28
|
+
errorConnectionInlineTitle?: string;
|
|
29
|
+
errorConnectionInlineRetry?: string;
|
|
30
|
+
errorResponseTitle?: string;
|
|
31
|
+
errorResponseRetry?: string;
|
|
32
|
+
thinkingStep1?: string;
|
|
33
|
+
thinkingStep2?: string;
|
|
34
|
+
thinkingUsingTool?: string;
|
|
35
|
+
thinkingPreparing?: string;
|
|
36
|
+
reasoningTraceSingular?: string;
|
|
37
|
+
reasoningTracePlural?: string;
|
|
38
|
+
reasoningTraceParameters?: string;
|
|
39
|
+
reasoningTraceResult?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface UserMessage {
|
|
42
|
+
key: string;
|
|
43
|
+
from: 'user';
|
|
44
|
+
generatedAt?: number;
|
|
45
|
+
sources?: {
|
|
46
|
+
href: string;
|
|
47
|
+
title: string;
|
|
48
|
+
}[];
|
|
49
|
+
versions: {
|
|
50
|
+
id: string;
|
|
51
|
+
content: string;
|
|
52
|
+
}[];
|
|
53
|
+
reasoning?: {
|
|
54
|
+
content: string;
|
|
55
|
+
duration: number;
|
|
56
|
+
};
|
|
57
|
+
tools?: ToolCall[];
|
|
58
|
+
}
|
|
59
|
+
export interface AssistantMessage {
|
|
60
|
+
key: string;
|
|
61
|
+
from: 'assistant';
|
|
62
|
+
generatedAt?: number;
|
|
63
|
+
sources?: {
|
|
64
|
+
href: string;
|
|
65
|
+
title: string;
|
|
66
|
+
}[];
|
|
67
|
+
versions: {
|
|
68
|
+
id: string;
|
|
69
|
+
content: string;
|
|
70
|
+
}[];
|
|
71
|
+
reasoning?: {
|
|
72
|
+
content: string;
|
|
73
|
+
duration: number;
|
|
74
|
+
};
|
|
75
|
+
tools?: ToolCall[];
|
|
76
|
+
}
|
|
77
|
+
export interface ErrorMessage {
|
|
78
|
+
key: string;
|
|
79
|
+
from: 'error';
|
|
80
|
+
kind: ErrorMessageKind;
|
|
81
|
+
failedUserMessageKey: string;
|
|
82
|
+
}
|
|
83
|
+
export type MessageType = UserMessage | AssistantMessage | ErrorMessage;
|
|
84
|
+
export declare const isErrorMessage: (message: MessageType) => message is ErrorMessage;
|
package/dist/components/chat-panel/{ChatPanelClearDialog.d.ts → clear-dialog/ClearDialog.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
|
-
interface
|
|
2
|
+
interface ClearDialogProps {
|
|
3
3
|
isOpen: boolean;
|
|
4
4
|
onOpenChange: (open: boolean) => void;
|
|
5
5
|
container: HTMLElement | null;
|
|
@@ -9,5 +9,5 @@ interface ChatPanelClearDialogProps {
|
|
|
9
9
|
cancelLabel: string;
|
|
10
10
|
onConfirm: () => void;
|
|
11
11
|
}
|
|
12
|
-
declare const
|
|
13
|
-
export default
|
|
12
|
+
declare const ClearDialog: FC<ClearDialogProps>;
|
|
13
|
+
export default ClearDialog;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ClearDialog } from './ClearDialog';
|
package/dist/components/chat-panel/error-connection-fullbody/errorConnectionFullBody.type.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ErrorConnectionFullBodyTranslations {
|
|
2
|
+
title?: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
retryLabel?: string;
|
|
5
|
+
reconnectingLabel?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ErrorConnectionFullBodyProps {
|
|
8
|
+
onRetry: () => Promise<void> | void;
|
|
9
|
+
translations?: ErrorConnectionFullBodyTranslations;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ErrorConnectionInlineTranslations {
|
|
2
|
+
title?: string;
|
|
3
|
+
retryLabel?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ErrorConnectionInlineProps {
|
|
6
|
+
failedUserMessageKey: string;
|
|
7
|
+
onRetry: (failedUserMessageKey: string) => Promise<void> | void;
|
|
8
|
+
translations?: ErrorConnectionInlineTranslations;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type FooterState = 'idle' | 'processing' | 'disconnected';
|
|
3
|
+
export interface FooterTranslations {
|
|
4
|
+
placeholderIdle: string;
|
|
5
|
+
placeholderProcessing: string;
|
|
6
|
+
placeholderDisconnected: string;
|
|
7
|
+
processingTooltip: string;
|
|
8
|
+
sendMessageAriaLabel: string;
|
|
9
|
+
}
|
|
10
|
+
export interface FooterProps {
|
|
11
|
+
input: string;
|
|
12
|
+
onInputChange: (value: string) => void;
|
|
13
|
+
onSubmit: (e: React.FormEvent<HTMLFormElement>) => void;
|
|
14
|
+
onKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
15
|
+
state: FooterState;
|
|
16
|
+
disclaimer: string;
|
|
17
|
+
translations: FooterTranslations;
|
|
18
|
+
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
|
-
interface
|
|
1
|
+
import type { FC, ReactNode } from 'react';
|
|
2
|
+
interface HeaderProps {
|
|
3
3
|
title: string;
|
|
4
4
|
isExpanded: boolean;
|
|
5
5
|
onToggleExpand: () => void;
|
|
6
6
|
onClose?: () => void;
|
|
7
|
-
onMenuClick?: () => void;
|
|
8
7
|
onClearChat?: () => void;
|
|
9
8
|
clearChatTooltipTitle?: string;
|
|
10
9
|
clearChatTooltipDescription?: string;
|
|
11
|
-
|
|
10
|
+
headerActionsSlot?: ReactNode;
|
|
12
11
|
}
|
|
13
|
-
declare const
|
|
14
|
-
export default
|
|
12
|
+
declare const Header: FC<HeaderProps>;
|
|
13
|
+
export default Header;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Header } from './Header';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ChatPanel, type ChatPanelTranslations } from './
|
|
1
|
+
export { ChatPanel, type ChatPanelTranslations } from './chat-panel';
|
|
2
2
|
export type { SuggestionType } from '../../types/chat';
|
|
3
3
|
export type { AiAgentTheme, SyntaxAppearance, ResolveSyntaxAppearanceFn, } from '../../context/AiAgentThemeContext';
|
|
@@ -1,16 +1,40 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
"title": "Foris
|
|
2
|
+
"title": "Foris AI",
|
|
3
3
|
"welcomeTitle": "How can I help you?",
|
|
4
4
|
"welcomeDescription": "Choose a suggestion or ask me a question.",
|
|
5
5
|
"suggestionsTitle": "Suggestions",
|
|
6
6
|
"placeholder": "Ask or create something...",
|
|
7
|
+
"placeholderProcessing": "Processing request...",
|
|
8
|
+
"placeholderDisconnected": "Not available",
|
|
9
|
+
"processingTooltip": "You have a request in progress",
|
|
10
|
+
"sendMessageAriaLabel": "Send message",
|
|
7
11
|
"disclaimer": "Foris AI may make mistakes. Verify the responses.",
|
|
8
12
|
"clearChatTitle": "Clear current conversation",
|
|
9
13
|
"clearChatDescription": "All messages will be deleted and the current context will be lost. This action cannot be undone.",
|
|
10
14
|
"clearChatConfirm": "Clear conversation",
|
|
11
15
|
"clearChatCancel": "Cancel",
|
|
12
16
|
"clearChatTooltipTitle": "Clear current conversation",
|
|
13
|
-
"clearChatTooltipDescription": "The current conversation context will be lost."
|
|
17
|
+
"clearChatTooltipDescription": "The current conversation context will be lost.",
|
|
18
|
+
"suggestionsTooltipTitle": "Suggestions",
|
|
19
|
+
"suggestionsTooltipDescription": "Select an option",
|
|
20
|
+
"footerResponseCopyTooltip": "Copy",
|
|
21
|
+
"footerResponseCopiedTooltip": "Copied",
|
|
22
|
+
"errorFullBodyTitle": "We couldn't connect",
|
|
23
|
+
"errorFullBodyDescription": "Please check your internet connection and try again.",
|
|
24
|
+
"errorFullBodyRetry": "Try again",
|
|
25
|
+
"errorFullBodyReconnecting": "Reconnecting...",
|
|
26
|
+
"errorResponseTitle": "We couldn't generate a response. Try again or ask another question.",
|
|
27
|
+
"errorResponseRetry": "Retry",
|
|
28
|
+
"errorConnectionInlineTitle": "We couldn't send your message. Check your connection and try again.",
|
|
29
|
+
"errorConnectionInlineRetry": "Retry",
|
|
30
|
+
"thinkingStep1": "Thinking...",
|
|
31
|
+
"thinkingStep2": "Understanding your request...",
|
|
32
|
+
"thinkingUsingTool": "Using: {tool}",
|
|
33
|
+
"thinkingPreparing": "Preparing response...",
|
|
34
|
+
"reasoningTraceSingular": "Reasoning · 1 tool used",
|
|
35
|
+
"reasoningTracePlural": "Reasoning · {count} tools used",
|
|
36
|
+
"reasoningTraceParameters": "Parameters",
|
|
37
|
+
"reasoningTraceResult": "Result"
|
|
14
38
|
}
|
|
15
39
|
;
|
|
16
40
|
|
|
@@ -1,16 +1,40 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
"title": "Foris
|
|
2
|
+
"title": "Foris AI",
|
|
3
3
|
"welcomeTitle": "¿Cómo puedo ayudarte?",
|
|
4
4
|
"welcomeDescription": "Puedes elegir una sugerencia o hacerme una pregunta.",
|
|
5
5
|
"suggestionsTitle": "Sugerencias",
|
|
6
6
|
"placeholder": "Pregunta o crea algo...",
|
|
7
|
+
"placeholderProcessing": "Procesando solicitud...",
|
|
8
|
+
"placeholderDisconnected": "No disponible",
|
|
9
|
+
"processingTooltip": "Tienes una solicitud en curso",
|
|
10
|
+
"sendMessageAriaLabel": "Enviar mensaje",
|
|
7
11
|
"disclaimer": "Foris AI puede cometer errores. Verifica sus respuestas.",
|
|
8
12
|
"clearChatTitle": "Limpiar conversación actual",
|
|
9
13
|
"clearChatDescription": "Se borrarán todos los mensajes y se perderá el contexto actual. Esta acción no se puede deshacer.",
|
|
10
14
|
"clearChatConfirm": "Limpiar conversación",
|
|
11
15
|
"clearChatCancel": "Cancelar",
|
|
12
16
|
"clearChatTooltipTitle": "Limpiar conversación actual",
|
|
13
|
-
"clearChatTooltipDescription": "Se perderá el contexto actual de la conversación."
|
|
17
|
+
"clearChatTooltipDescription": "Se perderá el contexto actual de la conversación.",
|
|
18
|
+
"suggestionsTooltipTitle": "Sugerencias",
|
|
19
|
+
"suggestionsTooltipDescription": "Selecciona una opción",
|
|
20
|
+
"footerResponseCopyTooltip": "Copiar",
|
|
21
|
+
"footerResponseCopiedTooltip": "Copiado",
|
|
22
|
+
"errorFullBodyTitle": "No pudimos conectarnos",
|
|
23
|
+
"errorFullBodyDescription": "Por favor, verifica tu conexión a internet e intenta nuevamente",
|
|
24
|
+
"errorFullBodyRetry": "Vuelve a intentarlo",
|
|
25
|
+
"errorFullBodyReconnecting": "Reconectando...",
|
|
26
|
+
"errorResponseTitle": "No fue posible generar una respuesta. Intenta de nuevo o haz otra pregunta.",
|
|
27
|
+
"errorResponseRetry": "Reintentar",
|
|
28
|
+
"errorConnectionInlineTitle": "No pudimos enviar tu mensaje. Verifica tu conexión e intenta de nuevo.",
|
|
29
|
+
"errorConnectionInlineRetry": "Reintentar",
|
|
30
|
+
"thinkingStep1": "Pensando...",
|
|
31
|
+
"thinkingStep2": "Entendiendo tu solicitud...",
|
|
32
|
+
"thinkingUsingTool": "Usando: {tool}",
|
|
33
|
+
"thinkingPreparing": "Preparando respuesta...",
|
|
34
|
+
"reasoningTraceSingular": "Razonamiento · 1 herramienta utilizada",
|
|
35
|
+
"reasoningTracePlural": "Razonamiento · {count} herramientas utilizadas",
|
|
36
|
+
"reasoningTraceParameters": "Parámetros",
|
|
37
|
+
"reasoningTraceResult": "Resultado"
|
|
14
38
|
}
|
|
15
39
|
;
|
|
16
40
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FC, ReactNode } from 'react';
|
|
2
|
+
/** Figma time row: lowercase meridiem (e.g. `pm` not `PM`). */
|
|
3
|
+
export declare function formatAssistantGenerationTime(locale: 'en' | 'es', ms: number): string;
|
|
4
|
+
export interface AssistantResponseFooterProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
textToCopy: string;
|
|
7
|
+
generatedAt?: number;
|
|
8
|
+
locale: 'en' | 'es';
|
|
9
|
+
copyTooltip: string;
|
|
10
|
+
copiedTooltip: string;
|
|
11
|
+
regionLabel?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const AssistantResponseFooter: FC<AssistantResponseFooterProps>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { MessageType } from '../chat-panel/chatPanel.types';
|
|
3
|
+
interface MessageItemProps {
|
|
4
|
+
message: MessageType;
|
|
5
|
+
locale?: 'en' | 'es';
|
|
6
|
+
footerResponseCopyTooltip?: string;
|
|
7
|
+
footerResponseCopiedTooltip?: string;
|
|
8
|
+
onRetryMessage?: (key?: string) => Promise<void> | void;
|
|
9
|
+
errorConnectionInlineTitle?: string;
|
|
10
|
+
errorConnectionInlineRetry?: string;
|
|
11
|
+
errorResponseTitle?: string;
|
|
12
|
+
errorResponseRetry?: string;
|
|
13
|
+
reasoningTraceSingular?: string;
|
|
14
|
+
reasoningTracePlural?: string;
|
|
15
|
+
reasoningTraceParameters?: string;
|
|
16
|
+
reasoningTraceResult?: string;
|
|
17
|
+
}
|
|
18
|
+
declare const MessageItem: FC<MessageItemProps>;
|
|
19
|
+
export default MessageItem;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as MessageItem } from './MessageItem';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ToolCall } from '../../../types/chat';
|
|
2
|
+
export interface ReasoningTraceTranslations {
|
|
3
|
+
headerSingular?: string;
|
|
4
|
+
headerPlural?: string;
|
|
5
|
+
parameters?: string;
|
|
6
|
+
result?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ReasoningTraceProps {
|
|
9
|
+
tools: ToolCall[];
|
|
10
|
+
translations?: ReasoningTraceTranslations;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SuggestionType } from '../../../types/chat';
|
|
2
|
+
interface SuggestionsProps {
|
|
3
|
+
suggestion: SuggestionType;
|
|
4
|
+
onClick: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const Suggestions: ({ suggestion, onClick, }: SuggestionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default Suggestions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Suggestions } from './Suggestions';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
import type { ThinkingPhase } from '../../../hooks/useThinkingPhase';
|
|
3
|
+
interface ThinkingIndicatorProps {
|
|
4
|
+
phase: ThinkingPhase;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
declare const ThinkingIndicator: FC<ThinkingIndicatorProps>;
|
|
8
|
+
export { ThinkingIndicator };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ThinkingIndicator } from './ThinkingIndicator';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Typing } from './Typing';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { SuggestionType } from '../../../types/chat';
|
|
3
|
+
interface WelcomeProps {
|
|
4
|
+
welcomeTitle: string;
|
|
5
|
+
welcomeDescription: string;
|
|
6
|
+
suggestions: SuggestionType[];
|
|
7
|
+
onSuggestionClick: (suggestion: SuggestionType) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const Welcome: FC<WelcomeProps>;
|
|
10
|
+
export default Welcome;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Welcome } from './Welcome';
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type CardVariant = 'warning';
|
|
3
|
+
export type CardTypo = 'border' | 'opacity';
|
|
4
|
+
export interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
variant?: CardVariant;
|
|
6
|
+
typo?: CardTypo;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { IconTypes } from '@foris/avocado-icons';
|
|
3
|
+
export interface IconMenuItem {
|
|
4
|
+
key: string;
|
|
5
|
+
icon?: IconTypes;
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface IconMenuProps {
|
|
11
|
+
items: IconMenuItem[];
|
|
12
|
+
triggerIcon: IconTypes;
|
|
13
|
+
triggerAriaLabel: string;
|
|
14
|
+
header?: string;
|
|
15
|
+
listOrigin?: 'left' | 'right';
|
|
16
|
+
triggerTooltipTitle?: string;
|
|
17
|
+
triggerTooltipDescription?: string;
|
|
18
|
+
}
|
|
19
|
+
declare const IconMenu: FC<IconMenuProps>;
|
|
20
|
+
export default IconMenu;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ThinkingText } from './ThinkingText';
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import * as TooltipPrimitive from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
3
3
|
declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
/**
|
|
5
|
+
* Requires a `<TooltipProvider>` ancestor. Unlike the previous version, this
|
|
6
|
+
* component no longer provides its own provider — wrap a shared
|
|
7
|
+
* `<TooltipProvider>` around the subtree that contains tooltips.
|
|
8
|
+
*/
|
|
4
9
|
declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
5
10
|
declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
declare function TooltipContent({
|
|
11
|
+
declare function TooltipContent({ sideOffset, arrowPadding, collisionPadding, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
|
|
7
12
|
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
package/dist/hooks/useChat.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import type { MutableRefObject } from 'react';
|
|
2
1
|
import { ApiManager } from '@foris/mango-core';
|
|
3
2
|
import type { ChatMessage } from '../types/chat';
|
|
3
|
+
import { DEFAULT_CHAT_STREAM_ID } from './chat.constants';
|
|
4
4
|
export interface OnSubmitProps {
|
|
5
|
-
params?:
|
|
5
|
+
params?: Record<string, unknown>;
|
|
6
6
|
input: string;
|
|
7
|
-
abortRef: MutableRefObject<AbortController | null>;
|
|
8
7
|
}
|
|
8
|
+
export { DEFAULT_CHAT_STREAM_ID };
|
|
9
9
|
/** When apiManager is passed, streaming uses mango (fetch or axios depending on delegate). */
|
|
10
10
|
export declare const useChat: (api: string, headers?: Record<string, string>, apiManager?: ApiManager) => {
|
|
11
|
-
onSubmit: ({ params, input
|
|
11
|
+
onSubmit: ({ params, input }: OnSubmitProps) => Promise<void>;
|
|
12
12
|
messages: ChatMessage[];
|
|
13
|
+
isLoading: boolean;
|
|
14
|
+
retryLastMessage: (key?: string) => Promise<void>;
|
|
13
15
|
clearMessages: () => void;
|
|
16
|
+
initialLoadError: boolean;
|
|
17
|
+
retryInitialPing: () => Promise<void>;
|
|
14
18
|
};
|
|
@@ -6,14 +6,14 @@ import { type OnSubmitProps } from './useChat';
|
|
|
6
6
|
interface UseChatSubmitOptions {
|
|
7
7
|
dataSource: DataSource;
|
|
8
8
|
messages: ChatMessage[];
|
|
9
|
+
isLoading: boolean;
|
|
9
10
|
onSubmit: (props: OnSubmitProps) => Promise<void>;
|
|
10
11
|
resetUserScrolling: () => void;
|
|
11
12
|
scrollToBottom: (immediate?: boolean) => void;
|
|
12
13
|
}
|
|
13
|
-
export declare const useChatSubmit: ({ dataSource, messages, onSubmit, resetUserScrolling, scrollToBottom, }: UseChatSubmitOptions) => {
|
|
14
|
+
export declare const useChatSubmit: ({ dataSource, messages, isLoading, onSubmit, resetUserScrolling, scrollToBottom, }: UseChatSubmitOptions) => {
|
|
14
15
|
input: string;
|
|
15
16
|
setInput: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
16
|
-
isLoadingMessage: boolean;
|
|
17
17
|
isChatStarted: boolean;
|
|
18
18
|
handleSubmit: (message: PromptInputMessage) => Promise<void>;
|
|
19
19
|
handleFooterSubmit: (e: React.FormEvent<HTMLFormElement>) => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface UseClickOutsideProps {
|
|
3
|
+
ref?: React.RefObject<HTMLElement | null>;
|
|
4
|
+
shouldIgnore?: boolean;
|
|
5
|
+
onClickOutside?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const useClickOutside: ({ ref, shouldIgnore, onClickOutside, }: UseClickOutsideProps) => void;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Non-empty `message` for the connectivity POST (chat APIs reject empty messages).
|
|
3
|
+
* Backend may treat this sentinel as a no-op until a dedicated ping exists.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CONNECTIVITY_PROBE_MESSAGE = "[connectivity-probe]";
|
|
6
|
+
/**
|
|
7
|
+
* Same JSON shape as `useChat` / `postStream` (`chat_id` + `message`). When the
|
|
8
|
+
* backend exposes a dedicated ping contract, switch the body / URL here.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CONNECTIVITY_PROBE_BODY: string;
|
|
11
|
+
/**
|
|
12
|
+
* Stable string for cache keys so the same logical headers map to the same entry.
|
|
13
|
+
* Exported for tests that reset or assert cache behaviour.
|
|
14
|
+
*/
|
|
15
|
+
export declare function pingHeadersFingerprint(headers?: Record<string, string>): string;
|
|
16
|
+
/** Drop cached probe(s) for `url` (all header variants), or clear the entire cache. */
|
|
17
|
+
export declare const resetConnectivityPingCache: (url?: string) => void;
|
|
18
|
+
export interface UseConnectivityPingResult {
|
|
19
|
+
initialLoadError: boolean;
|
|
20
|
+
retryInitialPing: () => Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Fires a one-shot `POST` connectivity probe per page session for `(pingUrl, headers)`.
|
|
24
|
+
* Body matches the streaming chat payload (`chat_id` + `message`) because many backends
|
|
25
|
+
* reject `HEAD` (405). Replace with a dedicated ping payload when the API supports it.
|
|
26
|
+
*/
|
|
27
|
+
export declare const useConnectivityPing: (pingUrl?: string, headers?: Record<string, string>) => UseConnectivityPingResult;
|