@n8n/chat 0.8.0 → 0.9.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.
Files changed (207) hide show
  1. package/__stories__/App.stories.d.ts +16 -0
  2. package/__stories__/App.stories.js +38 -0
  3. package/__stories__/App.stories.mjs +32 -0
  4. package/__tests__/index.spec.d.ts +1 -0
  5. package/__tests__/index.spec.js +146 -0
  6. package/__tests__/index.spec.mjs +172 -0
  7. package/__tests__/setup.js +3 -0
  8. package/__tests__/setup.mjs +1 -0
  9. package/__tests__/utils/create.d.ts +5 -0
  10. package/__tests__/utils/create.js +16 -0
  11. package/__tests__/utils/create.mjs +10 -0
  12. package/__tests__/utils/fetch.d.ts +3 -0
  13. package/__tests__/utils/fetch.js +20 -0
  14. package/__tests__/utils/fetch.mjs +9 -0
  15. package/__tests__/utils/index.js +38 -0
  16. package/__tests__/utils/index.mjs +3 -0
  17. package/__tests__/utils/selectors.d.ts +12 -0
  18. package/__tests__/utils/selectors.js +58 -0
  19. package/__tests__/utils/selectors.mjs +41 -0
  20. package/api/generic.d.ts +6 -0
  21. package/api/generic.js +68 -0
  22. package/api/generic.mjs +54 -0
  23. package/api/index.js +27 -0
  24. package/api/index.mjs +2 -0
  25. package/api/message.d.ts +3 -0
  26. package/api/message.js +33 -0
  27. package/api/message.mjs +30 -0
  28. package/chat.bundle.es.js +10761 -0
  29. package/chat.bundle.umd.js +18 -0
  30. package/chat.es.js +6872 -0
  31. package/chat.umd.js +18 -0
  32. package/components/Button.vue +34 -0
  33. package/components/ChatWindow.vue +104 -0
  34. package/{src/components → components}/GetStarted.vue +7 -7
  35. package/{src/components → components}/GetStartedFooter.vue +2 -2
  36. package/{src/components → components}/Input.vue +34 -39
  37. package/{src/components → components}/Layout.vue +26 -42
  38. package/{src/components → components}/Message.vue +39 -46
  39. package/components/MessageTyping.vue +101 -0
  40. package/{src/components → components}/MessagesList.vue +4 -4
  41. package/{src/components → components}/PoweredBy.vue +6 -7
  42. package/components/index.js +76 -0
  43. package/components/index.mjs +10 -0
  44. package/composables/index.js +38 -0
  45. package/composables/index.mjs +3 -0
  46. package/composables/useChat.d.ts +1 -0
  47. package/composables/useChat.js +11 -0
  48. package/composables/useChat.mjs +5 -0
  49. package/composables/useI18n.d.ts +4 -0
  50. package/composables/useI18n.js +23 -0
  51. package/composables/useI18n.mjs +12 -0
  52. package/composables/useOptions.d.ts +3 -0
  53. package/composables/useOptions.js +14 -0
  54. package/composables/useOptions.mjs +8 -0
  55. package/constants/defaults.d.ts +3 -0
  56. package/constants/defaults.js +32 -0
  57. package/constants/defaults.mjs +26 -0
  58. package/constants/index.js +38 -0
  59. package/constants/index.mjs +3 -0
  60. package/constants/localStorage.d.ts +2 -0
  61. package/constants/localStorage.js +8 -0
  62. package/{src/constants/localStorage.ts → constants/localStorage.mjs} +1 -1
  63. package/constants/symbols.d.ts +3 -0
  64. package/constants/symbols.js +8 -0
  65. package/constants/symbols.mjs +2 -0
  66. package/css/index.css +31 -0
  67. package/event-buses/chatEventBus.d.ts +1 -0
  68. package/event-buses/chatEventBus.js +8 -0
  69. package/event-buses/chatEventBus.mjs +2 -0
  70. package/event-buses/index.js +16 -0
  71. package/event-buses/index.mjs +1 -0
  72. package/index.d.ts +3 -0
  73. package/index.js +43 -0
  74. package/index.mjs +36 -0
  75. package/main.css +151 -0
  76. package/package.json +35 -2
  77. package/plugins/chat.d.ts +3 -0
  78. package/plugins/chat.js +91 -0
  79. package/plugins/chat.mjs +90 -0
  80. package/plugins/index.js +16 -0
  81. package/plugins/index.mjs +1 -0
  82. package/style.css +1 -0
  83. package/types/App.vue.d.ts +8 -0
  84. package/types/__stories__/App.stories.d.ts +17 -0
  85. package/types/__tests__/index.spec.d.ts +1 -0
  86. package/types/__tests__/setup.d.ts +0 -0
  87. package/types/__tests__/utils/create.d.ts +5 -0
  88. package/types/__tests__/utils/fetch.d.ts +4 -0
  89. package/types/__tests__/utils/index.d.ts +3 -0
  90. package/types/__tests__/utils/selectors.d.ts +12 -0
  91. package/types/api/generic.d.ts +6 -0
  92. package/types/api/index.d.ts +2 -0
  93. package/types/api/message.d.ts +3 -0
  94. package/types/chat.d.ts +11 -0
  95. package/types/chat.js +1 -0
  96. package/types/chat.mjs +0 -0
  97. package/types/components/Button.vue.d.ts +9 -0
  98. package/types/components/Chat.vue.d.ts +2 -0
  99. package/types/components/ChatWindow.vue.d.ts +2 -0
  100. package/types/components/GetStarted.vue.d.ts +2 -0
  101. package/types/components/GetStartedFooter.vue.d.ts +2 -0
  102. package/types/components/Input.vue.d.ts +2 -0
  103. package/types/components/Layout.vue.d.ts +11 -0
  104. package/types/components/Message.vue.d.ts +21 -0
  105. package/types/components/MessageTyping.vue.d.ts +15 -0
  106. package/types/components/MessagesList.vue.d.ts +14 -0
  107. package/types/components/PoweredBy.vue.d.ts +2 -0
  108. package/types/components/index.d.ts +10 -0
  109. package/types/composables/index.d.ts +3 -0
  110. package/types/composables/useChat.d.ts +2 -0
  111. package/types/composables/useI18n.d.ts +4 -0
  112. package/types/composables/useOptions.d.ts +4 -0
  113. package/types/constants/defaults.d.ts +3 -0
  114. package/types/constants/index.d.ts +3 -0
  115. package/types/constants/localStorage.d.ts +2 -0
  116. package/types/constants/symbols.d.ts +4 -0
  117. package/types/event-buses/chatEventBus.d.ts +1 -0
  118. package/types/event-buses/index.d.ts +1 -0
  119. package/types/index.js +49 -0
  120. package/types/index.mjs +4 -0
  121. package/types/messages.d.ts +6 -0
  122. package/types/messages.js +1 -0
  123. package/types/messages.mjs +0 -0
  124. package/types/options.d.ts +25 -0
  125. package/types/options.js +1 -0
  126. package/types/options.mjs +0 -0
  127. package/types/plugins/chat.d.ts +3 -0
  128. package/types/plugins/index.d.ts +1 -0
  129. package/types/types/chat.d.ts +11 -0
  130. package/types/types/index.d.ts +4 -0
  131. package/types/types/messages.d.ts +6 -0
  132. package/types/types/options.d.ts +25 -0
  133. package/types/types/webhook.d.ts +16 -0
  134. package/types/utils/event-bus.d.ts +8 -0
  135. package/types/utils/mount.d.ts +1 -0
  136. package/types/webhook.d.ts +16 -0
  137. package/types/webhook.js +1 -0
  138. package/types/webhook.mjs +0 -0
  139. package/utils/event-bus.d.ts +8 -0
  140. package/utils/event-bus.js +38 -0
  141. package/utils/event-bus.mjs +32 -0
  142. package/utils/index.d.ts +2 -0
  143. package/utils/index.js +27 -0
  144. package/utils/index.mjs +2 -0
  145. package/utils/mount.d.ts +1 -0
  146. package/utils/mount.js +19 -0
  147. package/utils/mount.mjs +13 -0
  148. package/.eslintignore +0 -2
  149. package/.eslintrc.cjs +0 -10
  150. package/.np-config.json +0 -5
  151. package/.storybook/main.ts +0 -27
  152. package/.storybook/preview.scss +0 -4
  153. package/.storybook/preview.ts +0 -16
  154. package/.vscode/extensions.json +0 -3
  155. package/build.config.js +0 -21
  156. package/env.d.ts +0 -1
  157. package/index.html +0 -13
  158. package/resources/images/fullscreen.png +0 -0
  159. package/resources/images/windowed.png +0 -0
  160. package/resources/workflow-manual.json +0 -238
  161. package/resources/workflow.json +0 -119
  162. package/scripts/pack.js +0 -11
  163. package/scripts/postbuild.js +0 -36
  164. package/src/__stories__/App.stories.ts +0 -43
  165. package/src/__tests__/index.spec.ts +0 -218
  166. package/src/__tests__/utils/create.ts +0 -16
  167. package/src/__tests__/utils/fetch.ts +0 -18
  168. package/src/__tests__/utils/selectors.ts +0 -53
  169. package/src/api/generic.ts +0 -63
  170. package/src/api/message.ts +0 -37
  171. package/src/components/Button.vue +0 -41
  172. package/src/components/ChatWindow.vue +0 -125
  173. package/src/components/MessageTyping.vue +0 -109
  174. package/src/composables/useChat.ts +0 -7
  175. package/src/composables/useI18n.ts +0 -16
  176. package/src/composables/useOptions.ts +0 -11
  177. package/src/constants/defaults.ts +0 -29
  178. package/src/constants/symbols.ts +0 -8
  179. package/src/css/_tokens.scss +0 -36
  180. package/src/css/index.scss +0 -1
  181. package/src/event-buses/chatEventBus.ts +0 -3
  182. package/src/index.ts +0 -42
  183. package/src/main.scss +0 -5
  184. package/src/plugins/chat.ts +0 -105
  185. package/src/types/chat.ts +0 -12
  186. package/src/types/messages.ts +0 -6
  187. package/src/types/options.ts +0 -28
  188. package/src/types/webhook.ts +0 -17
  189. package/src/utils/event-bus.ts +0 -51
  190. package/src/utils/mount.ts +0 -16
  191. package/tsconfig.json +0 -27
  192. package/vite.config.ts +0 -53
  193. package/vitest.config.ts +0 -20
  194. /package/{src/App.vue → App.vue} +0 -0
  195. /package/{src/__tests__/setup.ts → __tests__/setup.d.ts} +0 -0
  196. /package/{src/__tests__/utils/index.ts → __tests__/utils/index.d.ts} +0 -0
  197. /package/{src/api/index.ts → api/index.d.ts} +0 -0
  198. /package/{src/components → components}/Chat.vue +0 -0
  199. /package/{src/components/index.ts → components/index.d.ts} +0 -0
  200. /package/{src/composables/index.ts → composables/index.d.ts} +0 -0
  201. /package/{src/constants/index.ts → constants/index.d.ts} +0 -0
  202. /package/{src/event-buses/index.ts → event-buses/index.d.ts} +0 -0
  203. /package/{public/favicon.ico → favicon.ico} +0 -0
  204. /package/{src/plugins/index.ts → plugins/index.d.ts} +0 -0
  205. /package/{src/shims.d.ts → shims.d.ts} +0 -0
  206. /package/{src/types/index.ts → types/index.d.ts} +0 -0
  207. /package/{src/utils/index.ts → types/utils/index.d.ts} +0 -0
package/utils/mount.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createDefaultMountingTarget = createDefaultMountingTarget;
7
+ function createDefaultMountingTarget(mountingTarget) {
8
+ const mountingTargetNode = document.querySelector(mountingTarget);
9
+ if (!mountingTargetNode) {
10
+ const generatedMountingTargetNode = document.createElement("div");
11
+ if (mountingTarget.startsWith("#")) {
12
+ generatedMountingTargetNode.id = mountingTarget.replace("#", "");
13
+ }
14
+ if (mountingTarget.startsWith(".")) {
15
+ generatedMountingTargetNode.classList.add(mountingTarget.replace(".", ""));
16
+ }
17
+ document.body.appendChild(generatedMountingTargetNode);
18
+ }
19
+ }
@@ -0,0 +1,13 @@
1
+ export function createDefaultMountingTarget(mountingTarget) {
2
+ const mountingTargetNode = document.querySelector(mountingTarget);
3
+ if (!mountingTargetNode) {
4
+ const generatedMountingTargetNode = document.createElement("div");
5
+ if (mountingTarget.startsWith("#")) {
6
+ generatedMountingTargetNode.id = mountingTarget.replace("#", "");
7
+ }
8
+ if (mountingTarget.startsWith(".")) {
9
+ generatedMountingTargetNode.classList.add(mountingTarget.replace(".", ""));
10
+ }
11
+ document.body.appendChild(generatedMountingTargetNode);
12
+ }
13
+ }
package/.eslintignore DELETED
@@ -1,2 +0,0 @@
1
- .eslintrc.cjs
2
- vitest.config.ts
package/.eslintrc.cjs DELETED
@@ -1,10 +0,0 @@
1
- const sharedOptions = require('@n8n_io/eslint-config/shared');
2
-
3
- /**
4
- * @type {import('@types/eslint').ESLint.ConfigData}
5
- */
6
- module.exports = {
7
- extends: ['@n8n_io/eslint-config/frontend'],
8
-
9
- ...sharedOptions(__dirname, 'frontend'),
10
- };
package/.np-config.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "yarn": false,
3
- "tests": false,
4
- "contents": "./dist"
5
- }
@@ -1,27 +0,0 @@
1
- import type { StorybookConfig } from '@storybook/vue3-vite';
2
-
3
- import { join, dirname } from 'path';
4
-
5
- /**
6
- * This function is used to resolve the absolute path of a package.
7
- * It is needed in projects that use Yarn PnP or are set up within a monorepo.
8
- */
9
- function getAbsolutePath(value: string): any {
10
- return dirname(require.resolve(join(value, 'package.json')));
11
- }
12
- const config: StorybookConfig = {
13
- stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
14
- addons: [
15
- getAbsolutePath('@storybook/addon-links'),
16
- getAbsolutePath('@storybook/addon-essentials'),
17
- getAbsolutePath('@storybook/addon-interactions'),
18
- ],
19
- framework: {
20
- name: getAbsolutePath('@storybook/vue3-vite'),
21
- options: {},
22
- },
23
- docs: {
24
- autodocs: 'tag',
25
- },
26
- };
27
- export default config;
@@ -1,4 +0,0 @@
1
- html, body, #storybook-root, #n8n-chat {
2
- width: 100%;
3
- height: 100%;
4
- }
@@ -1,16 +0,0 @@
1
- import type { Preview } from '@storybook/vue3';
2
- import './preview.scss';
3
-
4
- const preview: Preview = {
5
- parameters: {
6
- actions: { argTypesRegex: '^on[A-Z].*' },
7
- controls: {
8
- matchers: {
9
- color: /(background|color)$/i,
10
- date: /Date$/,
11
- },
12
- },
13
- },
14
- };
15
-
16
- export default preview;
@@ -1,3 +0,0 @@
1
- {
2
- "recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
3
- }
package/build.config.js DELETED
@@ -1,21 +0,0 @@
1
- import { defineBuildConfig } from 'unbuild';
2
-
3
- export default defineBuildConfig({
4
- entries: [
5
- {
6
- builder: 'mkdist',
7
- format: 'esm',
8
- input: './src',
9
- outDir: './tmp/lib',
10
- },
11
- {
12
- builder: 'mkdist',
13
- format: 'cjs',
14
- input: './src',
15
- outDir: './tmp/cjs',
16
- },
17
- ],
18
- clean: true,
19
- declaration: true,
20
- failOnWarn: false,
21
- });
package/env.d.ts DELETED
@@ -1 +0,0 @@
1
- /// <reference types="vite/client" />
package/index.html DELETED
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <link rel="icon" href="/favicon.ico">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>Vite App</title>
8
- </head>
9
- <body>
10
- <div id="app"></div>
11
- <script type="module" src="/src/main.ts"></script>
12
- </body>
13
- </html>
Binary file
Binary file
@@ -1,238 +0,0 @@
1
- {
2
- "name": "Hosted n8n AI Chat Manual",
3
- "nodes": [
4
- {
5
- "parameters": {
6
- "options": {}
7
- },
8
- "id": "e6043748-44fc-4019-9301-5690fe26c614",
9
- "name": "OpenAI Chat Model",
10
- "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
11
- "typeVersion": 1,
12
- "position": [
13
- 860,
14
- 540
15
- ],
16
- "credentials": {
17
- "openAiApi": {
18
- "id": "cIIkOhl7tUX1KsL6",
19
- "name": "OpenAi account"
20
- }
21
- }
22
- },
23
- {
24
- "parameters": {
25
- "sessionKey": "={{ $json.sessionId }}"
26
- },
27
- "id": "0a68a59a-8ab6-4fa5-a1ea-b7f99a93109b",
28
- "name": "Window Buffer Memory",
29
- "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
30
- "typeVersion": 1,
31
- "position": [
32
- 640,
33
- 540
34
- ]
35
- },
36
- {
37
- "parameters": {
38
- "text": "={{ $json.chatInput }}",
39
- "options": {}
40
- },
41
- "id": "3d4e0fbf-d761-4569-b02e-f5c1eeb830c8",
42
- "name": "AI Agent",
43
- "type": "@n8n/n8n-nodes-langchain.agent",
44
- "typeVersion": 1.1,
45
- "position": [
46
- 840,
47
- 300
48
- ]
49
- },
50
- {
51
- "parameters": {
52
- "dataType": "string",
53
- "value1": "={{ $json.action }}",
54
- "rules": {
55
- "rules": [
56
- {
57
- "value2": "loadPreviousSession",
58
- "outputKey": "loadPreviousSession"
59
- },
60
- {
61
- "value2": "sendMessage",
62
- "outputKey": "sendMessage"
63
- }
64
- ]
65
- }
66
- },
67
- "id": "84213c7b-abc7-4f40-9567-cd3484a4ae6b",
68
- "name": "Switch",
69
- "type": "n8n-nodes-base.switch",
70
- "typeVersion": 2,
71
- "position": [
72
- 300,
73
- 280
74
- ]
75
- },
76
- {
77
- "parameters": {
78
- "simplifyOutput": false
79
- },
80
- "id": "3be7f076-98ed-472a-80b6-bf8d9538ac87",
81
- "name": "Chat Messages Retriever",
82
- "type": "@n8n/n8n-nodes-langchain.memoryChatRetriever",
83
- "typeVersion": 1,
84
- "position": [
85
- 620,
86
- 140
87
- ]
88
- },
89
- {
90
- "parameters": {
91
- "options": {}
92
- },
93
- "id": "3417c644-8a91-4524-974a-45b4a46d0e2e",
94
- "name": "Respond to Webhook",
95
- "type": "n8n-nodes-base.respondToWebhook",
96
- "typeVersion": 1,
97
- "position": [
98
- 1240,
99
- 140
100
- ]
101
- },
102
- {
103
- "parameters": {
104
- "public": true,
105
- "authentication": "n8nUserAuth",
106
- "options": {
107
- "loadPreviousSession": "manually",
108
- "responseMode": "responseNode"
109
- }
110
- },
111
- "id": "1b30c239-a819-45b4-b0ae-bdd5b92a5424",
112
- "name": "Chat Trigger",
113
- "type": "@n8n/n8n-nodes-langchain.chatTrigger",
114
- "typeVersion": 1,
115
- "position": [
116
- 80,
117
- 280
118
- ],
119
- "webhookId": "ed3dea26-7d68-42b3-9032-98fe967d441d"
120
- },
121
- {
122
- "parameters": {
123
- "aggregate": "aggregateAllItemData",
124
- "options": {}
125
- },
126
- "id": "79672cf0-686b-41eb-90ae-fd31b6da837d",
127
- "name": "Aggregate",
128
- "type": "n8n-nodes-base.aggregate",
129
- "typeVersion": 1,
130
- "position": [
131
- 1000,
132
- 140
133
- ]
134
- }
135
- ],
136
- "pinData": {},
137
- "connections": {
138
- "OpenAI Chat Model": {
139
- "ai_languageModel": [
140
- [
141
- {
142
- "node": "AI Agent",
143
- "type": "ai_languageModel",
144
- "index": 0
145
- }
146
- ]
147
- ]
148
- },
149
- "Window Buffer Memory": {
150
- "ai_memory": [
151
- [
152
- {
153
- "node": "AI Agent",
154
- "type": "ai_memory",
155
- "index": 0
156
- },
157
- {
158
- "node": "Chat Messages Retriever",
159
- "type": "ai_memory",
160
- "index": 0
161
- }
162
- ]
163
- ]
164
- },
165
- "Switch": {
166
- "main": [
167
- [
168
- {
169
- "node": "Chat Messages Retriever",
170
- "type": "main",
171
- "index": 0
172
- }
173
- ],
174
- [
175
- {
176
- "node": "AI Agent",
177
- "type": "main",
178
- "index": 0
179
- }
180
- ]
181
- ]
182
- },
183
- "Chat Messages Retriever": {
184
- "main": [
185
- [
186
- {
187
- "node": "Aggregate",
188
- "type": "main",
189
- "index": 0
190
- }
191
- ]
192
- ]
193
- },
194
- "AI Agent": {
195
- "main": [
196
- [
197
- {
198
- "node": "Respond to Webhook",
199
- "type": "main",
200
- "index": 0
201
- }
202
- ]
203
- ]
204
- },
205
- "Chat Trigger": {
206
- "main": [
207
- [
208
- {
209
- "node": "Switch",
210
- "type": "main",
211
- "index": 0
212
- }
213
- ]
214
- ]
215
- },
216
- "Aggregate": {
217
- "main": [
218
- [
219
- {
220
- "node": "Respond to Webhook",
221
- "type": "main",
222
- "index": 0
223
- }
224
- ]
225
- ]
226
- }
227
- },
228
- "active": true,
229
- "settings": {
230
- "executionOrder": "v1"
231
- },
232
- "versionId": "425c0efe-3aa0-4e0e-8c06-abe12234b1fd",
233
- "id": "1569HF92Y02EUtsU",
234
- "meta": {
235
- "instanceId": "374b43d8b8d6299cc777811a4ad220fc688ee2d54a308cfb0de4450a5233ca9e"
236
- },
237
- "tags": []
238
- }
@@ -1,119 +0,0 @@
1
- {
2
- "name": "Hosted n8n AI Chat",
3
- "nodes": [
4
- {
5
- "parameters": {
6
- "options": {}
7
- },
8
- "id": "4c109d13-62a2-4e23-9979-e50201db743d",
9
- "name": "OpenAI Chat Model",
10
- "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
11
- "typeVersion": 1,
12
- "position": [
13
- 640,
14
- 540
15
- ],
16
- "credentials": {
17
- "openAiApi": {
18
- "id": "cIIkOhl7tUX1KsL6",
19
- "name": "OpenAi account"
20
- }
21
- }
22
- },
23
- {
24
- "parameters": {
25
- "sessionKey": "={{ $json.sessionId }}"
26
- },
27
- "id": "b416df7b-4802-462f-8f74-f0a71dc4c0be",
28
- "name": "Window Buffer Memory",
29
- "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
30
- "typeVersion": 1,
31
- "position": [
32
- 340,
33
- 540
34
- ]
35
- },
36
- {
37
- "parameters": {
38
- "text": "={{ $json.chatInput }}",
39
- "options": {}
40
- },
41
- "id": "4de25807-a2ef-4453-900e-e00e0021ecdc",
42
- "name": "AI Agent",
43
- "type": "@n8n/n8n-nodes-langchain.agent",
44
- "typeVersion": 1.1,
45
- "position": [
46
- 620,
47
- 300
48
- ]
49
- },
50
- {
51
- "parameters": {
52
- "public": true,
53
- "options": {
54
- "loadPreviousSession": "memory"
55
- }
56
- },
57
- "id": "5a9612ae-51c1-4be2-bd8b-8556872d1149",
58
- "name": "Chat Trigger",
59
- "type": "@n8n/n8n-nodes-langchain.chatTrigger",
60
- "typeVersion": 1,
61
- "position": [
62
- 340,
63
- 300
64
- ],
65
- "webhookId": "f406671e-c954-4691-b39a-66c90aa2f103"
66
- }
67
- ],
68
- "pinData": {},
69
- "connections": {
70
- "OpenAI Chat Model": {
71
- "ai_languageModel": [
72
- [
73
- {
74
- "node": "AI Agent",
75
- "type": "ai_languageModel",
76
- "index": 0
77
- }
78
- ]
79
- ]
80
- },
81
- "Window Buffer Memory": {
82
- "ai_memory": [
83
- [
84
- {
85
- "node": "AI Agent",
86
- "type": "ai_memory",
87
- "index": 0
88
- },
89
- {
90
- "node": "Chat Trigger",
91
- "type": "ai_memory",
92
- "index": 0
93
- }
94
- ]
95
- ]
96
- },
97
- "Chat Trigger": {
98
- "main": [
99
- [
100
- {
101
- "node": "AI Agent",
102
- "type": "main",
103
- "index": 0
104
- }
105
- ]
106
- ]
107
- }
108
- },
109
- "active": true,
110
- "settings": {
111
- "executionOrder": "v1"
112
- },
113
- "versionId": "6076136f-fdb4-48d9-b483-d1c24c95ef9e",
114
- "id": "zaBHnDtj22BzEQ6K",
115
- "meta": {
116
- "instanceId": "374b43d8b8d6299cc777811a4ad220fc688ee2d54a308cfb0de4450a5233ca9e"
117
- },
118
- "tags": []
119
- }
package/scripts/pack.js DELETED
@@ -1,11 +0,0 @@
1
- const path = require('path');
2
- const shelljs = require('shelljs');
3
-
4
- const rootDirPath = path.resolve(__dirname, '..');
5
- const distDirPath = path.resolve(rootDirPath, 'dist');
6
-
7
- shelljs.cd(rootDirPath);
8
- shelljs.exec('npm run build');
9
-
10
- shelljs.cd(distDirPath);
11
- shelljs.exec('npm pack');
@@ -1,36 +0,0 @@
1
- const path = require('path');
2
- const shelljs = require('shelljs');
3
- const glob = require('fast-glob');
4
-
5
- const rootDirPath = path.resolve(__dirname, '..');
6
- const n8nRootDirPath = path.resolve(rootDirPath, '..', '..', '..');
7
- const distDirPath = path.resolve(rootDirPath, 'dist');
8
- const srcDirPath = path.resolve(rootDirPath, 'src');
9
- const libDirPath = path.resolve(rootDirPath, 'tmp', 'lib');
10
- const cjsDirPath = path.resolve(rootDirPath, 'tmp', 'cjs');
11
-
12
- const packageJsonFilePath = path.resolve(rootDirPath, 'package.json');
13
- const readmeFilePath = path.resolve(rootDirPath, 'README.md');
14
- const licenseFilePath = path.resolve(n8nRootDirPath, 'LICENSE.md');
15
-
16
- shelljs.cp(packageJsonFilePath, distDirPath);
17
- shelljs.cp(readmeFilePath, distDirPath);
18
- shelljs.cp(licenseFilePath, distDirPath);
19
-
20
- shelljs.mv(path.resolve(distDirPath, 'src'), path.resolve(distDirPath, 'types'));
21
-
22
- function moveFiles(files, from, to) {
23
- files.forEach((file) => {
24
- const toFile = file.replace(from, to);
25
- shelljs.mkdir('-p', path.dirname(toFile));
26
- shelljs.mv(file, toFile);
27
- });
28
- }
29
-
30
- const cjsFiles = glob.sync(path.resolve(cjsDirPath, '**', '*'));
31
- moveFiles(cjsFiles, 'tmp/cjs', 'dist');
32
- shelljs.rm('-rf', cjsDirPath);
33
-
34
- const libFiles = glob.sync(path.resolve(libDirPath, '**/*'));
35
- moveFiles(libFiles, 'tmp/lib', 'dist');
36
- shelljs.rm('-rf', libDirPath);
@@ -1,43 +0,0 @@
1
- /* eslint-disable @typescript-eslint/naming-convention */
2
- import type { StoryObj } from '@storybook/vue3';
3
- import { onMounted } from 'vue';
4
- import type { ChatOptions } from '@n8n/chat/types';
5
- import { createChat } from '@n8n/chat/index';
6
-
7
- const webhookUrl = 'http://localhost:5678/webhook/f406671e-c954-4691-b39a-66c90aa2f103/chat';
8
-
9
- const meta = {
10
- title: 'Chat',
11
- render: (args: Partial<ChatOptions>) => ({
12
- setup() {
13
- onMounted(() => {
14
- createChat(args);
15
- });
16
-
17
- return {};
18
- },
19
- template: '<div id="n8n-chat" />',
20
- }),
21
- parameters: {
22
- layout: 'fullscreen',
23
- },
24
- tags: ['autodocs'],
25
- };
26
-
27
- // eslint-disable-next-line import/no-default-export
28
- export default meta;
29
- type Story = StoryObj<typeof meta>;
30
-
31
- export const Fullscreen: Story = {
32
- args: {
33
- webhookUrl,
34
- mode: 'fullscreen',
35
- } satisfies Partial<ChatOptions>,
36
- };
37
-
38
- export const Windowed: Story = {
39
- args: {
40
- webhookUrl,
41
- mode: 'window',
42
- } satisfies Partial<ChatOptions>,
43
- };