@atom8n/chat 1.2.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/README.md +289 -0
- package/dist/App.vue.d.ts +2 -0
- package/dist/__stories__/App.stories.d.ts +18 -0
- package/dist/__tests__/Input.spec.d.ts +1 -0
- package/dist/__tests__/api/generic.spec.d.ts +1 -0
- package/dist/__tests__/api/message.spec.d.ts +1 -0
- package/dist/__tests__/index.spec.d.ts +1 -0
- package/dist/__tests__/plugins/chat.spec.d.ts +1 -0
- package/dist/__tests__/plugins/chat.test.d.ts +1 -0
- package/dist/__tests__/setup.d.ts +0 -0
- package/dist/__tests__/utils/create.d.ts +5 -0
- package/dist/__tests__/utils/fetch.d.ts +13 -0
- package/dist/__tests__/utils/index.d.ts +3 -0
- package/dist/__tests__/utils/selectors.d.ts +12 -0
- package/dist/__tests__/utils/streaming.spec.d.ts +1 -0
- package/dist/__tests__/utils/streamingHandlers.spec.d.ts +1 -0
- package/dist/api/generic.d.ts +7 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/message.d.ts +11 -0
- package/dist/chat.bundle.es.js +30125 -0
- package/dist/chat.bundle.umd.js +42 -0
- package/dist/chat.es.js +28207 -0
- package/dist/chat.umd.js +34 -0
- package/dist/components/Button.vue.d.ts +17 -0
- package/dist/components/Chat.vue.d.ts +2 -0
- package/dist/components/ChatFile.vue.d.ts +12 -0
- package/dist/components/ChatWindow.vue.d.ts +2 -0
- package/dist/components/GetStarted.vue.d.ts +2 -0
- package/dist/components/GetStartedFooter.vue.d.ts +2 -0
- package/dist/components/Input.vue.d.ts +39 -0
- package/dist/components/Layout.vue.d.ts +23 -0
- package/dist/components/Message.vue.d.ts +39 -0
- package/dist/components/MessageTyping.vue.d.ts +76 -0
- package/dist/components/MessagesList.vue.d.ts +164 -0
- package/dist/components/PoweredBy.vue.d.ts +2 -0
- package/dist/components/index.d.ts +10 -0
- package/dist/composables/index.d.ts +3 -0
- package/dist/composables/useChat.d.ts +2 -0
- package/dist/composables/useI18n.d.ts +4 -0
- package/dist/composables/useOptions.d.ts +4 -0
- package/dist/constants/defaults.d.ts +3 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/localStorage.d.ts +2 -0
- package/dist/constants/symbols.d.ts +4 -0
- package/dist/event-buses/chatEventBus.d.ts +1 -0
- package/dist/event-buses/index.d.ts +1 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.d.ts +2 -0
- package/dist/plugins/chat.d.ts +3 -0
- package/dist/plugins/index.d.ts +1 -0
- package/dist/style.css +5 -0
- package/dist/types/chat.d.ts +13 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/messages.d.ts +17 -0
- package/dist/types/options.d.ts +33 -0
- package/dist/types/streaming.d.ts +18 -0
- package/dist/types/webhook.d.ts +19 -0
- package/dist/utils/event-bus.d.ts +8 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/mount.d.ts +1 -0
- package/dist/utils/streaming.d.ts +26 -0
- package/dist/utils/streamingHandlers.d.ts +6 -0
- package/dist/utils/utils.d.ts +1 -0
- package/package.json +68 -0
package/README.md
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
# n8n Chat
|
|
2
|
+
This is an embeddable Chat widget for n8n. It allows the execution of AI-Powered Workflows through a Chat window.
|
|
3
|
+
|
|
4
|
+
**Windowed Example**
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
**Fullscreen Example**
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
Create a n8n workflow which you want to execute via chat. The workflow has to be triggered using a **Chat Trigger** node.
|
|
12
|
+
|
|
13
|
+
Open the **Chat Trigger** node and add your domain to the **Allowed Origins (CORS)** field. This makes sure that only requests from your domain are accepted.
|
|
14
|
+
|
|
15
|
+
[See example workflow](https://github.com/n8n-io/n8n/blob/master/packages/%40n8n/chat/resources/workflow.json)
|
|
16
|
+
|
|
17
|
+
To use streaming responses, you need to enable the **Streaming response** response mode in the **Chat Trigger** node.
|
|
18
|
+
[See example workflow with streaming](https://github.com/n8n-io/n8n/blob/master/packages/%40n8n/chat/resources/workflow-streaming.json)
|
|
19
|
+
|
|
20
|
+
> Make sure the workflow is **Active.**
|
|
21
|
+
|
|
22
|
+
### How it works
|
|
23
|
+
Each Chat request is sent to the n8n Webhook endpoint, which then sends back a response.
|
|
24
|
+
|
|
25
|
+
Each request is accompanied by an `action` query parameter, where `action` can be one of:
|
|
26
|
+
- `loadPreviousSession` - When the user opens the Chatbot again and the previous chat session should be loaded
|
|
27
|
+
- `sendMessage` - When the user sends a message
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
Open the **Webhook** node and replace `YOUR_PRODUCTION_WEBHOOK_URL` with your production URL. This is the URL that the Chat widget will use to send requests to.
|
|
32
|
+
|
|
33
|
+
### a. CDN Embed
|
|
34
|
+
Add the following code to your HTML page.
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<link href="https://cdn.jsdelivr.net/npm/@n8n/chat/dist/style.css" rel="stylesheet" />
|
|
38
|
+
<script type="module">
|
|
39
|
+
import { createChat } from 'https://cdn.jsdelivr.net/npm/@n8n/chat/dist/chat.bundle.es.js';
|
|
40
|
+
|
|
41
|
+
createChat({
|
|
42
|
+
webhookUrl: 'YOUR_PRODUCTION_WEBHOOK_URL'
|
|
43
|
+
});
|
|
44
|
+
</script>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### b. Import Embed
|
|
48
|
+
Install and save n8n Chat as a production dependency.
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
npm install @n8n/chat
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Import the CSS and use the `createChat` function to initialize your Chat window.
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import '@n8n/chat/style.css';
|
|
58
|
+
import { createChat } from '@n8n/chat';
|
|
59
|
+
|
|
60
|
+
createChat({
|
|
61
|
+
webhookUrl: 'YOUR_PRODUCTION_WEBHOOK_URL'
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
##### Vue.js
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<script lang="ts" setup>
|
|
69
|
+
// App.vue
|
|
70
|
+
import { onMounted } from 'vue';
|
|
71
|
+
import '@n8n/chat/style.css';
|
|
72
|
+
import { createChat } from '@n8n/chat';
|
|
73
|
+
|
|
74
|
+
onMounted(() => {
|
|
75
|
+
createChat({
|
|
76
|
+
webhookUrl: 'YOUR_PRODUCTION_WEBHOOK_URL'
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
</script>
|
|
80
|
+
<template>
|
|
81
|
+
<div></div>
|
|
82
|
+
</template>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
##### React
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
// App.tsx
|
|
89
|
+
import { useEffect } from 'react';
|
|
90
|
+
import '@n8n/chat/style.css';
|
|
91
|
+
import { createChat } from '@n8n/chat';
|
|
92
|
+
|
|
93
|
+
export const App = () => {
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
createChat({
|
|
96
|
+
webhookUrl: 'YOUR_PRODUCTION_WEBHOOK_URL'
|
|
97
|
+
});
|
|
98
|
+
}, []);
|
|
99
|
+
|
|
100
|
+
return (<div></div>);
|
|
101
|
+
};
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Options
|
|
105
|
+
The default options are:
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
createChat({
|
|
109
|
+
webhookUrl: '',
|
|
110
|
+
webhookConfig: {
|
|
111
|
+
method: 'POST',
|
|
112
|
+
headers: {}
|
|
113
|
+
},
|
|
114
|
+
target: '#n8n-chat',
|
|
115
|
+
mode: 'window',
|
|
116
|
+
chatInputKey: 'chatInput',
|
|
117
|
+
chatSessionKey: 'sessionId',
|
|
118
|
+
loadPreviousSession: true,
|
|
119
|
+
metadata: {},
|
|
120
|
+
showWelcomeScreen: false,
|
|
121
|
+
defaultLanguage: 'en',
|
|
122
|
+
initialMessages: [
|
|
123
|
+
'Hi there! 👋',
|
|
124
|
+
'My name is Nathan. How can I assist you today?'
|
|
125
|
+
],
|
|
126
|
+
i18n: {
|
|
127
|
+
en: {
|
|
128
|
+
title: 'Hi there! 👋',
|
|
129
|
+
subtitle: "Start a chat. We're here to help you 24/7.",
|
|
130
|
+
footer: '',
|
|
131
|
+
getStarted: 'New Conversation',
|
|
132
|
+
inputPlaceholder: 'Type your question..',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
enableStreaming: false,
|
|
136
|
+
});
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### `webhookUrl`
|
|
140
|
+
- **Type**: `string`
|
|
141
|
+
- **Required**: `true`
|
|
142
|
+
- **Examples**:
|
|
143
|
+
- `https://yourname.app.n8n.cloud/webhook/513107b3-6f3a-4a1e-af21-659f0ed14183`
|
|
144
|
+
- `http://localhost:5678/webhook/513107b3-6f3a-4a1e-af21-659f0ed14183`
|
|
145
|
+
- **Description**: The URL of the n8n Webhook endpoint. Should be the production URL.
|
|
146
|
+
|
|
147
|
+
### `webhookConfig`
|
|
148
|
+
- **Type**: `{ method: string, headers: Record<string, string> }`
|
|
149
|
+
- **Default**: `{ method: 'POST', headers: {} }`
|
|
150
|
+
- **Description**: The configuration for the Webhook request.
|
|
151
|
+
|
|
152
|
+
### `target`
|
|
153
|
+
- **Type**: `string`
|
|
154
|
+
- **Default**: `'#n8n-chat'`
|
|
155
|
+
- **Description**: The CSS selector of the element where the Chat window should be embedded.
|
|
156
|
+
|
|
157
|
+
### `mode`
|
|
158
|
+
- **Type**: `'window' | 'fullscreen'`
|
|
159
|
+
- **Default**: `'window'`
|
|
160
|
+
- **Description**: The render mode of the Chat window.
|
|
161
|
+
- In `window` mode, the Chat window will be embedded in the target element as a chat toggle button and a fixed size chat window.
|
|
162
|
+
- In `fullscreen` mode, the Chat will take up the entire width and height of its target container.
|
|
163
|
+
|
|
164
|
+
### `showWelcomeScreen`
|
|
165
|
+
- **Type**: `boolean`
|
|
166
|
+
- **Default**: `false`
|
|
167
|
+
- **Description**: Whether to show the welcome screen when the Chat window is opened.
|
|
168
|
+
|
|
169
|
+
### `chatInputKey`
|
|
170
|
+
- **Type**: `string`
|
|
171
|
+
- **Default**: `'chatInput'`
|
|
172
|
+
- **Description**: The key to use for sending the chat input for the AI Agent node.
|
|
173
|
+
|
|
174
|
+
### `chatSessionKey`
|
|
175
|
+
- **Type**: `string`
|
|
176
|
+
- **Default**: `'sessionId'`
|
|
177
|
+
- **Description**: The key to use for sending the chat history session ID for the AI Memory node.
|
|
178
|
+
|
|
179
|
+
### `loadPreviousSession`
|
|
180
|
+
- **Type**: `boolean`
|
|
181
|
+
- **Default**: `true`
|
|
182
|
+
- **Description**: Whether to load previous messages (chat context).
|
|
183
|
+
|
|
184
|
+
### `defaultLanguage`
|
|
185
|
+
- **Type**: `string`
|
|
186
|
+
- **Default**: `'en'`
|
|
187
|
+
- **Description**: The default language of the Chat window. Currently only `en` is supported.
|
|
188
|
+
|
|
189
|
+
### `i18n`
|
|
190
|
+
- **Type**: `{ [key: string]: Record<string, string> }`
|
|
191
|
+
- **Description**: The i18n configuration for the Chat window. Currently only `en` is supported.
|
|
192
|
+
|
|
193
|
+
### `initialMessages`
|
|
194
|
+
- **Type**: `string[]`
|
|
195
|
+
- **Description**: The initial messages to be displayed in the Chat window.
|
|
196
|
+
|
|
197
|
+
### `allowFileUploads`
|
|
198
|
+
- **Type**: `Ref<boolean> | boolean`
|
|
199
|
+
- **Default**: `false`
|
|
200
|
+
- **Description**: Whether to allow file uploads in the chat. If set to `true`, users will be able to upload files through the chat interface.
|
|
201
|
+
|
|
202
|
+
### `allowedFilesMimeTypes`
|
|
203
|
+
- **Type**: `Ref<string> | string`
|
|
204
|
+
- **Default**: `''`
|
|
205
|
+
- **Description**: A comma-separated list of allowed MIME types for file uploads. Only applicable if `allowFileUploads` is set to `true`. If left empty, all file types are allowed. For example: `'image/*,application/pdf'`.
|
|
206
|
+
|
|
207
|
+
### enableStreaming
|
|
208
|
+
- Type: boolean
|
|
209
|
+
- Default: false
|
|
210
|
+
- Description: Whether to enable streaming responses from the n8n workflow. If set to `true`, the chat will display responses as they are being generated, providing a more interactive experience. For this to work the workflow must be configured as well to return streaming responses.
|
|
211
|
+
|
|
212
|
+
## Customization
|
|
213
|
+
The Chat window is entirely customizable using CSS variables.
|
|
214
|
+
|
|
215
|
+
```css
|
|
216
|
+
:root {
|
|
217
|
+
--chat--color--primary: #e74266;
|
|
218
|
+
--chat--color--primary-shade-50: #db4061;
|
|
219
|
+
--chat--color--primary--shade-100: #cf3c5c;
|
|
220
|
+
--chat--color--secondary: #20b69e;
|
|
221
|
+
--chat--color-secondary-shade-50: #1ca08a;
|
|
222
|
+
--chat--color-white: #ffffff;
|
|
223
|
+
--chat--color-light: #f2f4f8;
|
|
224
|
+
--chat--color-light-shade-50: #e6e9f1;
|
|
225
|
+
--chat--color-light-shade-100: #c2c5cc;
|
|
226
|
+
--chat--color-medium: #d2d4d9;
|
|
227
|
+
--chat--color-dark: #101330;
|
|
228
|
+
--chat--color-disabled: #777980;
|
|
229
|
+
--chat--color-typing: #404040;
|
|
230
|
+
|
|
231
|
+
--chat--spacing: 1rem;
|
|
232
|
+
--chat--border-radius: 0.25rem;
|
|
233
|
+
--chat--transition-duration: 0.15s;
|
|
234
|
+
|
|
235
|
+
--chat--window--width: 400px;
|
|
236
|
+
--chat--window--height: 600px;
|
|
237
|
+
|
|
238
|
+
--chat--header-height: auto;
|
|
239
|
+
--chat--header--padding: var(--chat--spacing);
|
|
240
|
+
--chat--header--background: var(--chat--color-dark);
|
|
241
|
+
--chat--header--color: var(--chat--color-light);
|
|
242
|
+
--chat--header--border-top: none;
|
|
243
|
+
--chat--header--border-bottom: none;
|
|
244
|
+
--chat--header--border-bottom: none;
|
|
245
|
+
--chat--header--border-bottom: none;
|
|
246
|
+
--chat--heading--font-size: 2em;
|
|
247
|
+
--chat--header--color: var(--chat--color-light);
|
|
248
|
+
--chat--subtitle--font-size: inherit;
|
|
249
|
+
--chat--subtitle--line-height: 1.8;
|
|
250
|
+
|
|
251
|
+
--chat--textarea--height: 50px;
|
|
252
|
+
|
|
253
|
+
--chat--message--font-size: 1rem;
|
|
254
|
+
--chat--message--padding: var(--chat--spacing);
|
|
255
|
+
--chat--message--border-radius: var(--chat--border-radius);
|
|
256
|
+
--chat--message-line-height: 1.8;
|
|
257
|
+
--chat--message--bot--background: var(--chat--color-white);
|
|
258
|
+
--chat--message--bot--color: var(--chat--color-dark);
|
|
259
|
+
--chat--message--bot--border: none;
|
|
260
|
+
--chat--message--user--background: var(--chat--color--secondary);
|
|
261
|
+
--chat--message--user--color: var(--chat--color-white);
|
|
262
|
+
--chat--message--user--border: none;
|
|
263
|
+
--chat--message--pre--background: rgba(0, 0, 0, 0.05);
|
|
264
|
+
|
|
265
|
+
--chat--toggle--background: var(--chat--color--primary);
|
|
266
|
+
--chat--toggle--hover--background: var(--chat--color--primary-shade-50);
|
|
267
|
+
--chat--toggle--active--background: var(--chat--color--primary--shade-100);
|
|
268
|
+
--chat--toggle--color: var(--chat--color-white);
|
|
269
|
+
--chat--toggle--size: 64px;
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Caveats
|
|
274
|
+
|
|
275
|
+
### Fullscreen mode
|
|
276
|
+
In fullscreen mode, the Chat window will take up the entire width and height of its target container. Make sure that the container has a set width and height.
|
|
277
|
+
|
|
278
|
+
```css
|
|
279
|
+
html,
|
|
280
|
+
body,
|
|
281
|
+
#n8n-chat {
|
|
282
|
+
width: 100%;
|
|
283
|
+
height: 100%;
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## License
|
|
288
|
+
|
|
289
|
+
You can find the license information [here](https://github.com/n8n-io/n8n/blob/master/README.md#license)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/vue3';
|
|
2
|
+
import { ChatOptions } from '../types';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
render: (args: Partial<ChatOptions>) => {
|
|
6
|
+
setup(): {};
|
|
7
|
+
template: string;
|
|
8
|
+
};
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: string;
|
|
11
|
+
};
|
|
12
|
+
tags: string[];
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
export declare const Fullscreen: Story;
|
|
17
|
+
export declare const Windowed: Story;
|
|
18
|
+
export declare const WorkflowChat: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LoadPreviousSessionResponse, SendMessageResponse } from '../../types';
|
|
2
|
+
export declare function createFetchResponse<T>(data: T): () => Promise<Response>;
|
|
3
|
+
export declare const createGetLatestMessagesResponse: (data?: LoadPreviousSessionResponse["data"]) => LoadPreviousSessionResponse;
|
|
4
|
+
export declare const createSendMessageResponse: (output: SendMessageResponse["output"]) => SendMessageResponse;
|
|
5
|
+
export declare function createMockStreamingFetchResponse(chunks: Array<{
|
|
6
|
+
type: string;
|
|
7
|
+
content?: string;
|
|
8
|
+
metadata?: {
|
|
9
|
+
nodeId: string;
|
|
10
|
+
nodeName: string;
|
|
11
|
+
timestamp: number;
|
|
12
|
+
};
|
|
13
|
+
}>): () => Promise<Response>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function getMountingTarget(target?: string): Element | null;
|
|
2
|
+
export declare function getChatWindowWrapper(): Element | null;
|
|
3
|
+
export declare function getChatWindowToggle(): Element | null;
|
|
4
|
+
export declare function getChatWrapper(): Element | null;
|
|
5
|
+
export declare function getChatMessages(): NodeListOf<Element>;
|
|
6
|
+
export declare function getChatMessage(index: number): Element;
|
|
7
|
+
export declare function getChatMessageByText(text: string): HTMLElement | null;
|
|
8
|
+
export declare function getChatMessageTyping(): Element | null;
|
|
9
|
+
export declare function getGetStartedButton(): Element | null;
|
|
10
|
+
export declare function getChatInput(): Element | null;
|
|
11
|
+
export declare function getChatInputTextarea(): Element | null;
|
|
12
|
+
export declare function getChatInputSendButton(): Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function authenticatedFetch<T>(...args: Parameters<typeof fetch>): Promise<T>;
|
|
2
|
+
export declare function get<T>(url: string, query?: object, options?: RequestInit): Promise<T>;
|
|
3
|
+
export declare function post<T>(url: string, body?: object, options?: RequestInit): Promise<T>;
|
|
4
|
+
export declare function postWithFiles<T>(url: string, body?: Record<string, string | object>, files?: File[], options?: RequestInit): Promise<T>;
|
|
5
|
+
export declare function put<T>(url: string, body?: object, options?: RequestInit): Promise<T>;
|
|
6
|
+
export declare function patch<T>(url: string, body?: object, options?: RequestInit): Promise<T>;
|
|
7
|
+
export declare function del<T>(url: string, body?: object, options?: RequestInit): Promise<T>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChatOptions, LoadPreviousSessionResponse, SendMessageResponse } from '../types';
|
|
2
|
+
export declare function loadPreviousSession(sessionId: string, options: ChatOptions): Promise<LoadPreviousSessionResponse>;
|
|
3
|
+
export declare function sendMessage(message: string, files: File[], sessionId: string, options: ChatOptions): Promise<SendMessageResponse>;
|
|
4
|
+
export interface StreamingEventHandlers {
|
|
5
|
+
onBeginMessage: (nodeId: string, runIndex?: number) => void;
|
|
6
|
+
onChunk: (chunk: string, nodeId?: string, runIndex?: number) => void;
|
|
7
|
+
onEndMessage: (nodeId: string, runIndex?: number) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function sendMessageStreaming(message: string, files: File[], sessionId: string, options: ChatOptions, handlers: StreamingEventHandlers): Promise<{
|
|
10
|
+
hasReceivedChunks: boolean;
|
|
11
|
+
}>;
|