@n8n/chat 0.3.0 → 0.4.1
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 +22 -5
- package/chat.bundle.es.js +10757 -0
- package/chat.bundle.umd.js +18 -0
- package/chat.es.js +6867 -0
- package/chat.umd.js +18 -0
- package/package.json +62 -2
- package/style.css +1 -0
- package/types/App.vue.d.ts +8 -0
- package/types/__stories__/App.stories.d.ts +17 -0
- package/types/__tests__/index.spec.d.ts +1 -0
- package/types/__tests__/setup.d.ts +0 -0
- package/types/__tests__/utils/create.d.ts +5 -0
- package/types/__tests__/utils/fetch.d.ts +4 -0
- package/types/__tests__/utils/selectors.d.ts +12 -0
- package/types/api/generic.d.ts +6 -0
- package/types/api/message.d.ts +3 -0
- package/types/components/Button.vue.d.ts +9 -0
- package/types/components/Chat.vue.d.ts +2 -0
- package/types/components/ChatWindow.vue.d.ts +2 -0
- package/types/components/GetStarted.vue.d.ts +2 -0
- package/types/components/GetStartedFooter.vue.d.ts +2 -0
- package/types/components/Input.vue.d.ts +2 -0
- package/types/components/Layout.vue.d.ts +11 -0
- package/types/components/Message.vue.d.ts +21 -0
- package/types/components/MessageTyping.vue.d.ts +15 -0
- package/types/components/MessagesList.vue.d.ts +14 -0
- package/types/components/PoweredBy.vue.d.ts +2 -0
- package/types/composables/useChat.d.ts +2 -0
- package/types/composables/useI18n.d.ts +4 -0
- package/types/composables/useOptions.d.ts +4 -0
- package/types/constants/defaults.d.ts +3 -0
- package/types/constants/localStorage.d.ts +2 -0
- package/types/constants/symbols.d.ts +4 -0
- package/types/event-buses/chatEventBus.d.ts +1 -0
- package/types/index.d.ts +2 -0
- package/types/plugins/chat.d.ts +3 -0
- package/types/types/chat.d.ts +11 -0
- package/types/types/messages.d.ts +6 -0
- package/types/types/options.d.ts +24 -0
- package/types/types/webhook.d.ts +15 -0
- package/types/utils/event-bus.d.ts +8 -0
- package/types/utils/mount.d.ts +1 -0
- package/.eslintignore +0 -2
- package/.eslintrc.cjs +0 -52
- package/.np-config.json +0 -5
- package/.storybook/main.ts +0 -27
- package/.storybook/preview.scss +0 -4
- package/.storybook/preview.ts +0 -16
- package/.vscode/extensions.json +0 -3
- package/env.d.ts +0 -1
- package/index.html +0 -13
- package/resources/workflow.json +0 -293
- package/scripts/pack.js +0 -11
- package/scripts/postbuild.js +0 -16
- package/src/App.vue +0 -23
- package/src/__stories__/App.stories.ts +0 -43
- package/src/__tests__/index.spec.ts +0 -223
- package/src/__tests__/setup.ts +0 -1
- package/src/__tests__/utils/create.ts +0 -16
- package/src/__tests__/utils/fetch.ts +0 -18
- package/src/__tests__/utils/selectors.ts +0 -53
- package/src/api/generic.ts +0 -64
- package/src/api/message.ts +0 -31
- package/src/components/Button.vue +0 -41
- package/src/components/Chat.vue +0 -48
- package/src/components/ChatWindow.vue +0 -125
- package/src/components/GetStarted.vue +0 -24
- package/src/components/GetStartedFooter.vue +0 -20
- package/src/components/Input.vue +0 -93
- package/src/components/Layout.vue +0 -82
- package/src/components/Message.vue +0 -97
- package/src/components/MessageTyping.vue +0 -109
- package/src/components/MessagesList.vue +0 -37
- package/src/components/PoweredBy.vue +0 -17
- package/src/composables/useChat.ts +0 -7
- package/src/composables/useI18n.ts +0 -16
- package/src/composables/useOptions.ts +0 -11
- package/src/constants/defaults.ts +0 -25
- package/src/constants/localStorage.ts +0 -2
- package/src/constants/symbols.ts +0 -8
- package/src/event-buses/chatEventBus.ts +0 -3
- package/src/index.ts +0 -42
- package/src/main.scss +0 -40
- package/src/plugins/chat.ts +0 -101
- package/src/shims.d.ts +0 -6
- package/src/types/chat.ts +0 -12
- package/src/types/messages.ts +0 -6
- package/src/types/options.ts +0 -23
- package/src/types/webhook.ts +0 -17
- package/src/utils/event-bus.ts +0 -51
- package/src/utils/mount.ts +0 -16
- package/tsconfig.json +0 -27
- package/vite.config.ts +0 -51
- package/vitest.config.ts +0 -20
- /package/{public/favicon.ico → favicon.ico} +0 -0
- /package/{src/__tests__/utils/index.ts → types/__tests__/utils/index.d.ts} +0 -0
- /package/{src/api/index.ts → types/api/index.d.ts} +0 -0
- /package/{src/components/index.ts → types/components/index.d.ts} +0 -0
- /package/{src/composables/index.ts → types/composables/index.d.ts} +0 -0
- /package/{src/constants/index.ts → types/constants/index.d.ts} +0 -0
- /package/{src/event-buses/index.ts → types/event-buses/index.d.ts} +0 -0
- /package/{src/plugins/index.ts → types/plugins/index.d.ts} +0 -0
- /package/{src/types/index.ts → types/types/index.d.ts} +0 -0
- /package/{src/utils/index.ts → types/utils/index.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
This is an embeddable Chat widget for n8n. It allows the execution of AI-Powered Workflows through a Chat window.
|
|
3
3
|
|
|
4
4
|
## Prerequisites
|
|
5
|
-
Create a n8n workflow which you want to execute via chat. The workflow has to be triggered using a **
|
|
5
|
+
Create a n8n workflow which you want to execute via chat. The workflow has to be triggered using a **Chat Trigger** node.
|
|
6
6
|
|
|
7
|
-
Open the **
|
|
7
|
+
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.
|
|
8
8
|
|
|
9
|
-
[See example workflow](https://github.com/n8n-io/n8n/blob/
|
|
9
|
+
[See example workflow](https://github.com/n8n-io/n8n/blob/master/packages/%40n8n/chat/resources/workflow.json)
|
|
10
10
|
|
|
11
11
|
> Make sure the workflow is **Active.**
|
|
12
12
|
|
|
@@ -17,8 +17,6 @@ Each request is accompanied by an `action` query parameter, where `action` can b
|
|
|
17
17
|
- `loadPreviousSession` - When the user opens the Chatbot again and the previous chat session should be loaded
|
|
18
18
|
- `sendMessage` - When the user sends a message
|
|
19
19
|
|
|
20
|
-
We use the `Switch` node to handle the different actions.
|
|
21
|
-
|
|
22
20
|
## Installation
|
|
23
21
|
|
|
24
22
|
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.
|
|
@@ -106,6 +104,10 @@ createChat({
|
|
|
106
104
|
},
|
|
107
105
|
target: '#n8n-chat',
|
|
108
106
|
mode: 'window',
|
|
107
|
+
chatHistoryKey: 'chat_history',
|
|
108
|
+
chatInputKey: 'chat_input',
|
|
109
|
+
metadata: {},
|
|
110
|
+
showWelcomeScreen: false,
|
|
109
111
|
defaultLanguage: 'en',
|
|
110
112
|
initialMessages: [
|
|
111
113
|
'Hi there! 👋',
|
|
@@ -148,6 +150,21 @@ createChat({
|
|
|
148
150
|
- In `window` mode, the Chat window will be embedded in the target element as a chat toggle button and a fixed size chat window.
|
|
149
151
|
- In `fullscreen` mode, the Chat will take up the entire width and height of its target container.
|
|
150
152
|
|
|
153
|
+
### `showWelcomeScreen`
|
|
154
|
+
- **Type**: `boolean`
|
|
155
|
+
- **Default**: `false`
|
|
156
|
+
- **Description**: Whether to show the welcome screen when the Chat window is opened.
|
|
157
|
+
|
|
158
|
+
### `chatHistoryKey`
|
|
159
|
+
- **Type**: `string`
|
|
160
|
+
- **Default**: `'chat_history'`
|
|
161
|
+
- **Description**: The key to use for sending the chat history session ID for the AI Memory node.
|
|
162
|
+
|
|
163
|
+
### `chatInputKey`
|
|
164
|
+
- **Type**: `string`
|
|
165
|
+
- **Default**: `'chat_input'`
|
|
166
|
+
- **Description**: The key to use for sending the chat input for the AI Agent node.
|
|
167
|
+
|
|
151
168
|
### `defaultLanguage`
|
|
152
169
|
- **Type**: `string`
|
|
153
170
|
- **Default**: `'en'`
|