@n8n/chat 0.9.1 → 0.11.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/.eslintignore +2 -0
- package/.eslintrc.cjs +10 -0
- package/.np-config.json +5 -0
- package/.storybook/main.ts +4 -0
- package/.storybook/preview.scss +4 -0
- package/.storybook/preview.ts +15 -0
- package/.vscode/extensions.json +3 -0
- package/build.config.js +21 -0
- package/env.d.ts +1 -0
- package/index.html +13 -0
- package/package.json +2 -35
- package/resources/images/fullscreen.png +0 -0
- package/resources/images/windowed.png +0 -0
- package/resources/workflow-manual.json +238 -0
- package/resources/workflow.json +119 -0
- package/scripts/pack.js +11 -0
- package/scripts/postbuild.js +36 -0
- package/src/__stories__/App.stories.ts +43 -0
- package/src/__tests__/index.spec.ts +218 -0
- package/src/__tests__/utils/create.ts +16 -0
- package/src/__tests__/utils/fetch.ts +18 -0
- package/src/__tests__/utils/selectors.ts +53 -0
- package/src/api/generic.ts +63 -0
- package/src/api/message.ts +37 -0
- package/src/components/Button.vue +41 -0
- package/src/components/ChatWindow.vue +125 -0
- package/{components → src/components}/GetStarted.vue +7 -7
- package/{components → src/components}/GetStartedFooter.vue +2 -2
- package/{components → src/components}/Input.vue +39 -34
- package/{components → src/components}/Layout.vue +42 -26
- package/{components → src/components}/Message.vue +46 -39
- package/src/components/MessageTyping.vue +109 -0
- package/{components → src/components}/MessagesList.vue +4 -4
- package/{components → src/components}/PoweredBy.vue +7 -6
- package/src/composables/useChat.ts +7 -0
- package/src/composables/useI18n.ts +16 -0
- package/src/composables/useOptions.ts +11 -0
- package/src/constants/defaults.ts +29 -0
- package/{constants/localStorage.mjs → src/constants/localStorage.ts} +1 -1
- package/src/constants/symbols.ts +8 -0
- package/src/css/_tokens.scss +36 -0
- package/src/css/index.scss +1 -0
- package/src/event-buses/chatEventBus.ts +3 -0
- package/src/index.ts +42 -0
- package/src/main.scss +5 -0
- package/src/plugins/chat.ts +115 -0
- package/src/types/chat.ts +12 -0
- package/src/types/messages.ts +6 -0
- package/src/types/options.ts +28 -0
- package/src/types/webhook.ts +18 -0
- package/src/utils/event-bus.ts +51 -0
- package/src/utils/mount.ts +16 -0
- package/tsconfig.json +27 -0
- package/vite.config.ts +60 -0
- package/vitest.config.ts +20 -0
- package/__stories__/App.stories.d.ts +0 -16
- package/__stories__/App.stories.js +0 -38
- package/__stories__/App.stories.mjs +0 -32
- package/__tests__/index.spec.d.ts +0 -1
- package/__tests__/index.spec.js +0 -146
- package/__tests__/index.spec.mjs +0 -172
- package/__tests__/setup.js +0 -3
- package/__tests__/setup.mjs +0 -1
- package/__tests__/utils/create.d.ts +0 -5
- package/__tests__/utils/create.js +0 -16
- package/__tests__/utils/create.mjs +0 -10
- package/__tests__/utils/fetch.d.ts +0 -3
- package/__tests__/utils/fetch.js +0 -20
- package/__tests__/utils/fetch.mjs +0 -9
- package/__tests__/utils/index.js +0 -38
- package/__tests__/utils/index.mjs +0 -3
- package/__tests__/utils/selectors.d.ts +0 -12
- package/__tests__/utils/selectors.js +0 -58
- package/__tests__/utils/selectors.mjs +0 -41
- package/api/generic.d.ts +0 -6
- package/api/generic.js +0 -68
- package/api/generic.mjs +0 -54
- package/api/index.js +0 -27
- package/api/index.mjs +0 -2
- package/api/message.d.ts +0 -3
- package/api/message.js +0 -33
- package/api/message.mjs +0 -30
- package/chat.bundle.es.js +0 -10761
- package/chat.bundle.umd.js +0 -18
- package/chat.es.js +0 -6872
- package/chat.umd.js +0 -18
- package/components/Button.vue +0 -34
- package/components/ChatWindow.vue +0 -104
- package/components/MessageTyping.vue +0 -101
- package/components/index.js +0 -76
- package/components/index.mjs +0 -10
- package/composables/index.js +0 -38
- package/composables/index.mjs +0 -3
- package/composables/useChat.d.ts +0 -1
- package/composables/useChat.js +0 -11
- package/composables/useChat.mjs +0 -5
- package/composables/useI18n.d.ts +0 -4
- package/composables/useI18n.js +0 -23
- package/composables/useI18n.mjs +0 -12
- package/composables/useOptions.d.ts +0 -3
- package/composables/useOptions.js +0 -14
- package/composables/useOptions.mjs +0 -8
- package/constants/defaults.d.ts +0 -3
- package/constants/defaults.js +0 -32
- package/constants/defaults.mjs +0 -26
- package/constants/index.js +0 -38
- package/constants/index.mjs +0 -3
- package/constants/localStorage.d.ts +0 -2
- package/constants/localStorage.js +0 -8
- package/constants/symbols.d.ts +0 -3
- package/constants/symbols.js +0 -8
- package/constants/symbols.mjs +0 -2
- package/css/index.css +0 -31
- package/event-buses/chatEventBus.d.ts +0 -1
- package/event-buses/chatEventBus.js +0 -8
- package/event-buses/chatEventBus.mjs +0 -2
- package/event-buses/index.js +0 -16
- package/event-buses/index.mjs +0 -1
- package/index.d.ts +0 -3
- package/index.js +0 -43
- package/index.mjs +0 -36
- package/main.css +0 -151
- package/plugins/chat.d.ts +0 -3
- package/plugins/chat.js +0 -91
- package/plugins/chat.mjs +0 -90
- package/plugins/index.js +0 -16
- package/plugins/index.mjs +0 -1
- package/style.css +0 -1
- package/types/App.vue.d.ts +0 -8
- package/types/__stories__/App.stories.d.ts +0 -17
- package/types/__tests__/index.spec.d.ts +0 -1
- package/types/__tests__/setup.d.ts +0 -0
- package/types/__tests__/utils/create.d.ts +0 -5
- package/types/__tests__/utils/fetch.d.ts +0 -4
- package/types/__tests__/utils/index.d.ts +0 -3
- package/types/__tests__/utils/selectors.d.ts +0 -12
- package/types/api/generic.d.ts +0 -6
- package/types/api/index.d.ts +0 -2
- package/types/api/message.d.ts +0 -3
- package/types/chat.d.ts +0 -11
- package/types/chat.js +0 -1
- package/types/chat.mjs +0 -0
- package/types/components/Button.vue.d.ts +0 -9
- package/types/components/Chat.vue.d.ts +0 -2
- package/types/components/ChatWindow.vue.d.ts +0 -2
- package/types/components/GetStarted.vue.d.ts +0 -2
- package/types/components/GetStartedFooter.vue.d.ts +0 -2
- package/types/components/Input.vue.d.ts +0 -2
- package/types/components/Layout.vue.d.ts +0 -11
- package/types/components/Message.vue.d.ts +0 -21
- package/types/components/MessageTyping.vue.d.ts +0 -15
- package/types/components/MessagesList.vue.d.ts +0 -14
- package/types/components/PoweredBy.vue.d.ts +0 -2
- package/types/components/index.d.ts +0 -10
- package/types/composables/index.d.ts +0 -3
- package/types/composables/useChat.d.ts +0 -2
- package/types/composables/useI18n.d.ts +0 -4
- package/types/composables/useOptions.d.ts +0 -4
- package/types/constants/defaults.d.ts +0 -3
- package/types/constants/index.d.ts +0 -3
- package/types/constants/localStorage.d.ts +0 -2
- package/types/constants/symbols.d.ts +0 -4
- package/types/event-buses/chatEventBus.d.ts +0 -1
- package/types/event-buses/index.d.ts +0 -1
- package/types/index.js +0 -49
- package/types/index.mjs +0 -4
- package/types/messages.d.ts +0 -6
- package/types/messages.js +0 -1
- package/types/messages.mjs +0 -0
- package/types/options.d.ts +0 -25
- package/types/options.js +0 -1
- package/types/options.mjs +0 -0
- package/types/plugins/chat.d.ts +0 -3
- package/types/plugins/index.d.ts +0 -1
- package/types/types/chat.d.ts +0 -11
- package/types/types/index.d.ts +0 -4
- package/types/types/messages.d.ts +0 -6
- package/types/types/options.d.ts +0 -25
- package/types/types/webhook.d.ts +0 -16
- package/types/utils/event-bus.d.ts +0 -8
- package/types/utils/mount.d.ts +0 -1
- package/types/webhook.d.ts +0 -16
- package/types/webhook.js +0 -1
- package/types/webhook.mjs +0 -0
- package/utils/event-bus.d.ts +0 -8
- package/utils/event-bus.js +0 -38
- package/utils/event-bus.mjs +0 -32
- package/utils/index.d.ts +0 -2
- package/utils/index.js +0 -27
- package/utils/index.mjs +0 -2
- package/utils/mount.d.ts +0 -1
- package/utils/mount.js +0 -19
- package/utils/mount.mjs +0 -13
- /package/{favicon.ico → public/favicon.ico} +0 -0
- /package/{App.vue → src/App.vue} +0 -0
- /package/{__tests__/setup.d.ts → src/__tests__/setup.ts} +0 -0
- /package/{__tests__/utils/index.d.ts → src/__tests__/utils/index.ts} +0 -0
- /package/{api/index.d.ts → src/api/index.ts} +0 -0
- /package/{components → src/components}/Chat.vue +0 -0
- /package/{components/index.d.ts → src/components/index.ts} +0 -0
- /package/{composables/index.d.ts → src/composables/index.ts} +0 -0
- /package/{constants/index.d.ts → src/constants/index.ts} +0 -0
- /package/{event-buses/index.d.ts → src/event-buses/index.ts} +0 -0
- /package/{plugins/index.d.ts → src/plugins/index.ts} +0 -0
- /package/{shims.d.ts → src/shims.d.ts} +0 -0
- /package/{types/index.d.ts → src/types/index.ts} +0 -0
- /package/{types/utils/index.d.ts → src/utils/index.ts} +0 -0
package/.eslintignore
ADDED
package/.eslintrc.cjs
ADDED
package/.np-config.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Preview } from '@storybook/vue3';
|
|
2
|
+
import './preview.scss';
|
|
3
|
+
|
|
4
|
+
const preview: Preview = {
|
|
5
|
+
parameters: {
|
|
6
|
+
controls: {
|
|
7
|
+
matchers: {
|
|
8
|
+
color: /(background|color)$/i,
|
|
9
|
+
date: /Date$/,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default preview;
|
package/build.config.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
package/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
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>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n8n/chat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"main": "./chat.umd.js",
|
|
5
5
|
"module": "./chat.es.js",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -18,43 +18,10 @@
|
|
|
18
18
|
"require": "./*"
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"highlight.js": "^11.8.0",
|
|
23
|
-
"uuid": "^8.3.2",
|
|
24
|
-
"vue": "^3.3.4",
|
|
25
|
-
"vue-markdown-render": "^2.0.1"
|
|
26
|
-
},
|
|
27
|
-
"devDependencies": {
|
|
28
|
-
"@iconify-json/mdi": "^1.1.54",
|
|
29
|
-
"shelljs": "^0.8.5",
|
|
30
|
-
"unbuild": "^2.0.0",
|
|
31
|
-
"unplugin-icons": "^0.17.0",
|
|
32
|
-
"vite-plugin-dts": "^3.7.3"
|
|
33
|
-
},
|
|
34
21
|
"repository": {
|
|
35
22
|
"type": "git",
|
|
36
23
|
"url": "git+https://github.com/n8n-io/n8n.git"
|
|
37
24
|
},
|
|
38
25
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
39
|
-
"homepage": "https://n8n.io"
|
|
40
|
-
"scripts": {
|
|
41
|
-
"dev": "pnpm run storybook",
|
|
42
|
-
"build": "pnpm type-check && pnpm build:vite && pnpm run build:individual && npm run build:prepare",
|
|
43
|
-
"build:full": "pnpm type-check && pnpm build:vite && pnpm build:vite:full && pnpm run build:individual && npm run build:prepare",
|
|
44
|
-
"build:vite": "vite build",
|
|
45
|
-
"build:vite:full": "INCLUDE_VUE=true vite build",
|
|
46
|
-
"build:individual": "unbuild",
|
|
47
|
-
"build:prepare": "node scripts/postbuild.js",
|
|
48
|
-
"build:pack": "node scripts/pack.js",
|
|
49
|
-
"preview": "vite preview",
|
|
50
|
-
"test:dev": "vitest",
|
|
51
|
-
"test": "vitest run --coverage",
|
|
52
|
-
"type-check": "vue-tsc --noEmit -p tsconfig.json --composite false",
|
|
53
|
-
"lint": "eslint . --ext .js,.ts,.vue --quiet",
|
|
54
|
-
"lintfix": "eslint . --ext .js,.ts,.vue --fix",
|
|
55
|
-
"format": "prettier --write src/",
|
|
56
|
-
"storybook": "storybook dev -p 6006 --no-open",
|
|
57
|
-
"build:storybook": "storybook build",
|
|
58
|
-
"release": "pnpm run build:full && cd dist && pnpm publish"
|
|
59
|
-
}
|
|
26
|
+
"homepage": "https://n8n.io"
|
|
60
27
|
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,238 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
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');
|
|
@@ -0,0 +1,36 @@
|
|
|
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);
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
};
|