@foris/ai-agent 0.11.1 → 1.0.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/ai-agent.es.js +12042 -11852
- package/dist/ai-agent.umd.js +60 -60
- package/dist/ai-sparkles-icon/AiSparklesIcon.d.ts +1 -0
- package/dist/components/ai-elements/message-code-block.d.ts +8 -4
- package/dist/components/chat-panel/ChatMessageItem.d.ts +7 -0
- package/dist/components/chat-panel/ChatPanel.d.ts +20 -0
- package/dist/components/chat-panel/ChatPanelFooter.d.ts +11 -0
- package/dist/components/chat-panel/ChatPanelHeader.d.ts +9 -0
- package/dist/components/chat-panel/ChatPanelWelcome.d.ts +10 -0
- package/dist/components/chat-panel/ChatSuggestionMessage.d.ts +7 -0
- package/dist/components/chat-panel/ChatTypingIndicator.d.ts +3 -0
- package/dist/{ai-chat-panel/chatPanel.constants.d.ts → components/chat-panel/chatPanel.types.d.ts} +1 -12
- package/dist/components/chat-panel/index.d.ts +2 -0
- package/dist/components/chat-panel/locale/en.json.d.ts +10 -0
- package/dist/components/chat-panel/locale/es.json.d.ts +10 -0
- package/dist/components/ui/input-group.d.ts +1 -1
- package/dist/hooks/useChat.d.ts +6 -12
- package/dist/hooks/useChatSubmit.d.ts +20 -0
- package/dist/hooks/useCodeTransform.d.ts +2 -1
- package/dist/hooks/useMessageProcessor.d.ts +11 -0
- package/dist/hooks/useSummary.d.ts +3 -2
- package/dist/index.d.ts +1 -1
- package/dist/style.css +1 -1
- package/package.json +6 -2
- package/dist/ai-chat-panel/ChatPanel.d.ts +0 -10
- package/dist/ai-chat-panel/index.d.ts +0 -1
- package/dist/services/fetch-api/FetchApi.d.ts +0 -7
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
export declare const PreWrapper: ({ children }: {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
2
5
|
/** Props from react-markdown for the code component */
|
|
3
|
-
export type MessageCodeBlockProps = React.ComponentProps<'code'
|
|
4
|
-
inline?: boolean;
|
|
5
|
-
};
|
|
6
|
+
export type MessageCodeBlockProps = React.ComponentProps<'code'>;
|
|
6
7
|
/**
|
|
7
8
|
* Code component for react-markdown that uses our fine-grained Shiki
|
|
8
9
|
* highlighter (2 themes, 14 languages — no extra chunks).
|
|
10
|
+
*
|
|
11
|
+
* react-markdown v10 removed the `inline` prop. We use a Context set by
|
|
12
|
+
* PreWrapper to distinguish block code (inside <pre>) from inline code.
|
|
9
13
|
*/
|
|
10
|
-
export declare const MessageCodeBlock: import("react").MemoExoticComponent<({
|
|
14
|
+
export declare const MessageCodeBlock: import("react").MemoExoticComponent<({ className, children, ...props }: MessageCodeBlockProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { SuggestionType } from '../../types/chat';
|
|
3
|
+
import type { DataSource } from '../../types/dataSource';
|
|
4
|
+
export interface ChatPanelTranslations {
|
|
5
|
+
title?: string;
|
|
6
|
+
welcomeTitle?: string;
|
|
7
|
+
welcomeDescription?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
disclaimer?: string;
|
|
10
|
+
}
|
|
11
|
+
interface ChatPanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
dataSource: DataSource;
|
|
13
|
+
className?: string;
|
|
14
|
+
onClose?: () => void;
|
|
15
|
+
locale?: 'en' | 'es';
|
|
16
|
+
translations?: ChatPanelTranslations;
|
|
17
|
+
initialSuggestions?: SuggestionType[];
|
|
18
|
+
}
|
|
19
|
+
export declare const ChatPanel: FC<ChatPanelProps>;
|
|
20
|
+
export default ChatPanel;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
interface ChatPanelFooterProps {
|
|
3
|
+
input: string;
|
|
4
|
+
onInputChange: (value: string) => void;
|
|
5
|
+
onSubmit: (e: React.FormEvent<HTMLFormElement>) => void;
|
|
6
|
+
onKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
7
|
+
placeholder: string;
|
|
8
|
+
disclaimer: string;
|
|
9
|
+
}
|
|
10
|
+
declare const ChatPanelFooter: FC<ChatPanelFooterProps>;
|
|
11
|
+
export default ChatPanelFooter;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { SuggestionType } from '../../types/chat';
|
|
3
|
+
interface ChatPanelWelcomeProps {
|
|
4
|
+
welcomeTitle: string;
|
|
5
|
+
welcomeDescription: string;
|
|
6
|
+
suggestions: SuggestionType[];
|
|
7
|
+
onSuggestionClick: (suggestion: SuggestionType) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const ChatPanelWelcome: FC<ChatPanelWelcomeProps>;
|
|
10
|
+
export default ChatPanelWelcome;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SuggestionType } from '../../types/chat';
|
|
2
|
+
interface ChatSuggestionMessageProps {
|
|
3
|
+
suggestion: SuggestionType;
|
|
4
|
+
onClick: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const ChatSuggestionMessage: ({ suggestion, onClick, }: ChatSuggestionMessageProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default ChatSuggestionMessage;
|
package/dist/{ai-chat-panel/chatPanel.constants.d.ts → components/chat-panel/chatPanel.types.d.ts}
RENAMED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
tool: string;
|
|
3
|
-
input?: any;
|
|
4
|
-
result?: any;
|
|
5
|
-
}
|
|
1
|
+
import type { ToolCall } from '../../types/chat';
|
|
6
2
|
export type MessageType = {
|
|
7
3
|
key: string;
|
|
8
4
|
from: 'user' | 'assistant';
|
|
@@ -20,10 +16,3 @@ export type MessageType = {
|
|
|
20
16
|
};
|
|
21
17
|
tool?: ToolCall;
|
|
22
18
|
};
|
|
23
|
-
export type SuggestionType = {
|
|
24
|
-
key: string;
|
|
25
|
-
title: string;
|
|
26
|
-
description: string;
|
|
27
|
-
};
|
|
28
|
-
export declare const INITIAL_MESSAGES: MessageType[];
|
|
29
|
-
export declare const INITIAL_SUGGESTIONS: SuggestionType[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"title": "Foris Agent",
|
|
3
|
+
"welcomeTitle": "How can I help you?",
|
|
4
|
+
"welcomeDescription": "Choose a suggestion or ask me a question.",
|
|
5
|
+
"placeholder": "Ask or create something...",
|
|
6
|
+
"disclaimer": "Foris AI may make mistakes. Verify the responses."
|
|
7
|
+
}
|
|
8
|
+
;
|
|
9
|
+
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"title": "Foris Agent",
|
|
3
|
+
"welcomeTitle": "¿Cómo puedo ayudarte?",
|
|
4
|
+
"welcomeDescription": "Puedes elegir una sugerencia o hacerme una pregunta.",
|
|
5
|
+
"placeholder": "Pregunta o crea algo...",
|
|
6
|
+
"disclaimer": "Foris AI puede cometer errores. Verifica sus respuestas."
|
|
7
|
+
}
|
|
8
|
+
;
|
|
9
|
+
|
|
10
|
+
export default _default;
|
|
@@ -3,7 +3,7 @@ import { type VariantProps } from 'class-variance-authority';
|
|
|
3
3
|
import { Button } from './button';
|
|
4
4
|
declare function InputGroup({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
declare const inputGroupAddonVariants: (props?: ({
|
|
6
|
-
align?: "inline-
|
|
6
|
+
align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
declare function InputGroupAddon({ className, align, ...props }: React.ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
declare const inputGroupButtonVariants: (props?: ({
|
package/dist/hooks/useChat.d.ts
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
import type { MutableRefObject } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
type
|
|
4
|
-
interface
|
|
5
|
-
role: Role;
|
|
6
|
-
content: string;
|
|
7
|
-
tool?: ToolCall;
|
|
8
|
-
}
|
|
9
|
-
interface OnSubmitProps {
|
|
2
|
+
import { ApiManager } from '@foris/mango-core';
|
|
3
|
+
import type { ChatMessage } from '../types/chat';
|
|
4
|
+
export interface OnSubmitProps {
|
|
10
5
|
params?: any;
|
|
11
6
|
input: string;
|
|
12
|
-
setInput: (input: string) => void;
|
|
13
7
|
abortRef: MutableRefObject<AbortController | null>;
|
|
14
8
|
}
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
/** When apiManager is passed, streaming uses mango (fetch or axios depending on delegate). */
|
|
10
|
+
export declare const useChat: (api: string, headers?: Record<string, string>, apiManager?: ApiManager) => {
|
|
11
|
+
onSubmit: ({ params, input, abortRef }: OnSubmitProps) => Promise<void>;
|
|
17
12
|
messages: ChatMessage[];
|
|
18
13
|
};
|
|
19
|
-
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type PromptInputMessage } from '../components/ai-elements/prompt-input';
|
|
3
|
+
import { type OnSubmitProps } from './useChat';
|
|
4
|
+
import type { DataSource } from '../types/dataSource';
|
|
5
|
+
interface UseChatSubmitOptions {
|
|
6
|
+
dataSource: DataSource;
|
|
7
|
+
onSubmit: (props: OnSubmitProps) => Promise<void>;
|
|
8
|
+
resetUserScrolling: () => void;
|
|
9
|
+
scrollToBottom: (immediate?: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const useChatSubmit: ({ dataSource, onSubmit, resetUserScrolling, scrollToBottom, }: UseChatSubmitOptions) => {
|
|
12
|
+
input: string;
|
|
13
|
+
setInput: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
14
|
+
isLoadingMessage: boolean;
|
|
15
|
+
isChatStarted: boolean;
|
|
16
|
+
handleSubmit: (message: PromptInputMessage) => Promise<void>;
|
|
17
|
+
handleFooterSubmit: (e: React.FormEvent<HTMLFormElement>) => void;
|
|
18
|
+
handleFooterKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { ApiManager } from '@foris/mango-core';
|
|
1
2
|
import { RequestConfig } from '../ai-prompt-code-editor/PromptCodeEditor';
|
|
2
3
|
export interface CodeTransformResponse {
|
|
3
4
|
codeWithAnnotations: string;
|
|
4
5
|
modifiedCode: string;
|
|
5
6
|
}
|
|
6
|
-
export declare const useCodeTransform: (requestConfig: RequestConfig) => {
|
|
7
|
+
export declare const useCodeTransform: (requestConfig: RequestConfig, apiManager?: ApiManager) => {
|
|
7
8
|
onSubmit: (componentBody: {
|
|
8
9
|
code: string;
|
|
9
10
|
prompt: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ChatMessage } from '../types/chat';
|
|
2
|
+
import type { MessageType } from '../components/chat-panel/chatPanel.types';
|
|
3
|
+
interface UseMessageProcessorOptions {
|
|
4
|
+
messages: ChatMessage[];
|
|
5
|
+
isAtBottom: () => boolean;
|
|
6
|
+
resetUserScrolling: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const useMessageProcessor: ({ messages, isAtBottom, resetUserScrolling, }: UseMessageProcessorOptions) => {
|
|
9
|
+
processedMessages: MessageType[];
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ApiManager } from '@foris/mango-core';
|
|
2
|
+
import type { ChatMessage } from '../types/chat';
|
|
3
|
+
export declare const useSummary: (api: string, headers?: Record<string, string>, apiManager?: ApiManager) => {
|
|
3
4
|
onSubmit: (body: unknown) => Promise<void>;
|
|
4
5
|
loading: boolean;
|
|
5
6
|
summary: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ChatPanel } from './
|
|
1
|
+
export { ChatPanel, type ChatPanelTranslations, type SuggestionType, } from './components/chat-panel';
|
|
2
2
|
export { ChatPanelMenu } from './ai-chat-panel-menu';
|
|
3
3
|
export { SummaryCard, type SummaryCardProps, type SummaryCardTranslations, type SupportedLocale, } from './components/summary-card';
|
|
4
4
|
export { PromptCodeEditor } from './ai-prompt-code-editor';
|