flowdit-chatbot-library 1.3.4 → 1.3.6

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.
@@ -2,16 +2,23 @@ import { ChatClient, ChatState } from './types';
2
2
 
3
3
  export declare class RealChatClient implements ChatClient {
4
4
  private accessToken;
5
+ private apiBaseUrl;
5
6
  private messages;
6
7
  private currentModel;
7
8
  private currentProvider;
8
9
  private enabledTools;
9
10
  private currentJobId;
10
11
  private pageReadingCallback;
11
- constructor(token: string);
12
+ private customHandlers;
13
+ private libraryTools;
14
+ constructor(token: string, apiBaseUrl?: string);
12
15
  setToken(token: string): void;
13
16
  setModel(model: string | null): void;
14
17
  setEnabledTools(tools: string[]): void;
18
+ setToolHandler(name: string, handler: (args: any) => Promise<string | any>): void;
19
+ enableWebSearch(enabled: boolean): void;
20
+ enablePageContext(enabled: boolean): void;
21
+ private getActiveTools;
15
22
  setPageReadingCallback(callback: (isReading: boolean) => void): void;
16
23
  sendMessage(content: string, onUpdate: (state: ChatState) => void): Promise<void>;
17
24
  reset(onUpdate: (state: ChatState) => void): void;
@@ -9,6 +9,9 @@ export interface ChatClient {
9
9
  reset: (onUpdate: (state: ChatState) => void) => void;
10
10
  setModel: (model: string | null) => void;
11
11
  setEnabledTools: (tools: string[]) => void;
12
+ setToolHandler: (name: string, handler: (args: any) => Promise<string | any>) => void;
13
+ enableWebSearch: (enabled: boolean) => void;
14
+ enablePageContext: (enabled: boolean) => void;
12
15
  sendConfirmResponse?: (toolCallId: string, confirmed: boolean) => Promise<void>;
13
16
  setPageReadingCallback?: (callback: (isReading: boolean) => void) => void;
14
17
  }
@@ -0,0 +1,29 @@
1
+ import { default as React } from 'react';
2
+ import { ChatMode } from '../ChatContainer/ChatContainer';
3
+ import { SidebarItem } from '../NavigationSidebar/NavigationSidebar';
4
+ import { ChatClient } from '../../api/types';
5
+
6
+ export interface ChatbotProps {
7
+ client: ChatClient | null;
8
+ mode?: ChatMode;
9
+ isOpen?: boolean;
10
+ onClose?: () => void;
11
+ onOpen?: () => void;
12
+ embedded?: boolean;
13
+ userName?: string;
14
+ quickActions?: {
15
+ id: string;
16
+ label: string;
17
+ icon: string;
18
+ onClick: () => void;
19
+ }[];
20
+ agents?: SidebarItem[];
21
+ chatHistory?: SidebarItem[];
22
+ onToolCall?: Record<string, (args: any) => Promise<any>>;
23
+ headerActions?: React.ReactNode;
24
+ webSearchEnabled?: boolean;
25
+ onWebSearchChange?: (enabled: boolean) => void;
26
+ pageContextEnabled?: boolean;
27
+ onPageContextChange?: (enabled: boolean) => void;
28
+ }
29
+ export declare const Chatbot: React.FC<ChatbotProps>;
@@ -0,0 +1,17 @@
1
+ import { ChatClient } from '../api/types';
2
+
3
+ export interface UseChatOptions {
4
+ client: ChatClient | null;
5
+ onToolCall?: Record<string, (args: any) => Promise<any>>;
6
+ }
7
+ export declare const useChat: ({ client, onToolCall }: UseChatOptions) => {
8
+ messages: import('..').MessageProps[];
9
+ isThinking: boolean;
10
+ isTyping: boolean;
11
+ messageQueue: string[];
12
+ sendMessage: (text: string) => void;
13
+ removeQueueItem: (index: number) => void;
14
+ handleAnimationComplete: (id: string) => void;
15
+ finishedMessageIds: Set<string>;
16
+ reset: () => void;
17
+ };
package/dist/index.d.ts CHANGED
@@ -13,3 +13,5 @@ export { RealChatClient } from './api/RealChatClient';
13
13
  export { AuthClient } from './api/AuthClient';
14
14
  export type { TokenResponse } from './api/AuthClient';
15
15
  export type { ChatState, ChatClient } from './api/types';
16
+ export * from './components/Chatbot/Chatbot';
17
+ export * from './hooks/useChat';