@n8n/chat 0.6.0 → 0.6.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/{src/App.vue → App.vue} +2 -2
- package/README.md +27 -4
- package/__stories__/App.stories.d.ts +16 -0
- package/__stories__/App.stories.js +38 -0
- package/__stories__/App.stories.mjs +32 -0
- package/__tests__/index.spec.d.ts +1 -0
- package/__tests__/index.spec.js +146 -0
- package/__tests__/index.spec.mjs +172 -0
- package/__tests__/setup.js +3 -0
- package/__tests__/setup.mjs +1 -0
- package/__tests__/utils/create.d.ts +5 -0
- package/__tests__/utils/create.js +16 -0
- package/__tests__/utils/create.mjs +10 -0
- package/__tests__/utils/fetch.d.ts +3 -0
- package/__tests__/utils/fetch.js +20 -0
- package/__tests__/utils/fetch.mjs +9 -0
- package/__tests__/utils/index.js +38 -0
- package/__tests__/utils/index.mjs +3 -0
- package/__tests__/utils/selectors.d.ts +12 -0
- package/__tests__/utils/selectors.js +58 -0
- package/__tests__/utils/selectors.mjs +41 -0
- package/api/generic.d.ts +6 -0
- package/api/generic.js +68 -0
- package/api/generic.mjs +54 -0
- package/api/index.js +27 -0
- package/api/index.mjs +2 -0
- package/api/message.d.ts +3 -0
- package/api/message.js +33 -0
- package/api/message.mjs +30 -0
- package/chat.bundle.es.js +10753 -0
- package/chat.bundle.umd.js +18 -0
- package/chat.es.js +6864 -0
- package/chat.umd.js +18 -0
- package/components/Button.vue +34 -0
- package/{src/components → components}/Chat.vue +19 -15
- package/components/ChatWindow.vue +104 -0
- package/components/GetStarted.vue +24 -0
- package/{src/components → components}/GetStartedFooter.vue +4 -4
- package/{src/components → components}/Input.vue +35 -40
- package/components/Layout.vue +66 -0
- package/components/Message.vue +94 -0
- package/components/MessageTyping.vue +101 -0
- package/{src/components → components}/MessagesList.vue +8 -8
- package/{src/components → components}/PoweredBy.vue +6 -7
- package/components/index.js +76 -0
- package/components/index.mjs +10 -0
- package/composables/index.js +38 -0
- package/composables/index.mjs +3 -0
- package/composables/useChat.d.ts +1 -0
- package/composables/useChat.js +11 -0
- package/composables/useChat.mjs +5 -0
- package/composables/useI18n.d.ts +4 -0
- package/composables/useI18n.js +23 -0
- package/composables/useI18n.mjs +12 -0
- package/composables/useOptions.d.ts +3 -0
- package/composables/useOptions.js +14 -0
- package/composables/useOptions.mjs +8 -0
- package/constants/defaults.d.ts +3 -0
- package/constants/defaults.js +32 -0
- package/constants/defaults.mjs +26 -0
- package/constants/index.js +38 -0
- package/constants/index.mjs +3 -0
- package/constants/localStorage.d.ts +2 -0
- package/constants/localStorage.js +8 -0
- package/{src/constants/localStorage.ts → constants/localStorage.mjs} +1 -1
- package/constants/symbols.d.ts +3 -0
- package/constants/symbols.js +8 -0
- package/constants/symbols.mjs +2 -0
- package/css/index.css +31 -0
- package/event-buses/chatEventBus.d.ts +1 -0
- package/event-buses/chatEventBus.js +8 -0
- package/event-buses/chatEventBus.mjs +2 -0
- package/event-buses/index.js +16 -0
- package/event-buses/index.mjs +1 -0
- package/index.d.ts +3 -0
- package/index.js +43 -0
- package/index.mjs +36 -0
- package/main.css +151 -0
- package/package.json +41 -5
- package/plugins/chat.d.ts +3 -0
- package/plugins/chat.js +85 -0
- package/plugins/chat.mjs +83 -0
- package/plugins/index.js +16 -0
- package/plugins/index.mjs +1 -0
- 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/index.d.ts +3 -0
- package/types/__tests__/utils/selectors.d.ts +12 -0
- package/types/api/generic.d.ts +6 -0
- package/types/api/index.d.ts +2 -0
- package/types/api/message.d.ts +3 -0
- package/types/chat.d.ts +11 -0
- package/types/chat.js +1 -0
- package/types/chat.mjs +0 -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/components/index.d.ts +10 -0
- package/types/composables/index.d.ts +3 -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/index.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/event-buses/index.d.ts +1 -0
- package/types/index.js +49 -0
- package/types/index.mjs +4 -0
- package/types/messages.d.ts +6 -0
- package/types/messages.js +1 -0
- package/types/messages.mjs +0 -0
- package/types/options.d.ts +25 -0
- package/types/options.js +1 -0
- package/types/options.mjs +0 -0
- package/types/plugins/chat.d.ts +3 -0
- package/types/plugins/index.d.ts +1 -0
- package/types/types/chat.d.ts +11 -0
- package/types/types/index.d.ts +4 -0
- package/types/types/messages.d.ts +6 -0
- package/types/types/options.d.ts +25 -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/types/webhook.d.ts +15 -0
- package/types/webhook.js +1 -0
- package/types/webhook.mjs +0 -0
- package/utils/event-bus.d.ts +8 -0
- package/utils/event-bus.js +38 -0
- package/utils/event-bus.mjs +32 -0
- package/utils/index.d.ts +2 -0
- package/utils/index.js +27 -0
- package/utils/index.mjs +2 -0
- package/utils/mount.d.ts +1 -0
- package/utils/mount.js +19 -0
- package/utils/mount.mjs +13 -0
- package/.eslintignore +0 -2
- package/.eslintrc.cjs +0 -51
- 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/__stories__/App.stories.ts +0 -43
- package/src/__tests__/index.spec.ts +0 -223
- 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/ChatWindow.vue +0 -125
- package/src/components/GetStarted.vue +0 -24
- package/src/components/Layout.vue +0 -82
- package/src/components/Message.vue +0 -97
- package/src/components/MessageTyping.vue +0 -109
- 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/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/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/{src/__tests__/setup.ts → __tests__/setup.d.ts} +0 -0
- /package/{src/__tests__/utils/index.ts → __tests__/utils/index.d.ts} +0 -0
- /package/{src/api/index.ts → api/index.d.ts} +0 -0
- /package/{src/components/index.ts → components/index.d.ts} +0 -0
- /package/{src/composables/index.ts → composables/index.d.ts} +0 -0
- /package/{src/constants/index.ts → constants/index.d.ts} +0 -0
- /package/{src/event-buses/index.ts → event-buses/index.d.ts} +0 -0
- /package/{public/favicon.ico → favicon.ico} +0 -0
- /package/{src/plugins/index.ts → plugins/index.d.ts} +0 -0
- /package/{src/shims.d.ts → shims.d.ts} +0 -0
- /package/{src/types/index.ts → types/index.d.ts} +0 -0
- /package/{src/utils/index.ts → types/utils/index.d.ts} +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface ChatOptions {
|
|
2
|
+
webhookUrl: string;
|
|
3
|
+
webhookConfig?: {
|
|
4
|
+
method?: 'GET' | 'POST';
|
|
5
|
+
headers?: Record<string, string>;
|
|
6
|
+
};
|
|
7
|
+
target?: string | Element;
|
|
8
|
+
mode?: 'window' | 'fullscreen';
|
|
9
|
+
showWelcomeScreen?: boolean;
|
|
10
|
+
loadPreviousSession?: boolean;
|
|
11
|
+
chatInputKey?: string;
|
|
12
|
+
chatSessionKey?: string;
|
|
13
|
+
defaultLanguage?: 'en';
|
|
14
|
+
initialMessages?: string[];
|
|
15
|
+
metadata?: Record<string, unknown>;
|
|
16
|
+
i18n: Record<string, {
|
|
17
|
+
title: string;
|
|
18
|
+
subtitle: string;
|
|
19
|
+
footer: string;
|
|
20
|
+
getStarted: string;
|
|
21
|
+
inputPlaceholder: string;
|
|
22
|
+
[message: string]: string;
|
|
23
|
+
}>;
|
|
24
|
+
theme?: {};
|
|
25
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface LoadPreviousSessionResponseItem {
|
|
2
|
+
id: string[];
|
|
3
|
+
kwargs: {
|
|
4
|
+
content: string;
|
|
5
|
+
additional_kwargs: Record<string, unknown>;
|
|
6
|
+
};
|
|
7
|
+
lc: number;
|
|
8
|
+
type: string;
|
|
9
|
+
}
|
|
10
|
+
export interface LoadPreviousSessionResponse {
|
|
11
|
+
data: LoadPreviousSessionResponseItem[];
|
|
12
|
+
}
|
|
13
|
+
export interface SendMessageResponse {
|
|
14
|
+
output: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type CallbackFn = Function;
|
|
2
|
+
export type UnregisterFn = () => void;
|
|
3
|
+
export interface EventBus {
|
|
4
|
+
on: (eventName: string, fn: CallbackFn) => UnregisterFn;
|
|
5
|
+
off: (eventName: string, fn: CallbackFn) => void;
|
|
6
|
+
emit: <T = Event>(eventName: string, event?: T) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function createEventBus(): EventBus;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createDefaultMountingTarget(mountingTarget: string): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface LoadPreviousSessionResponseItem {
|
|
2
|
+
id: string[];
|
|
3
|
+
kwargs: {
|
|
4
|
+
content: string;
|
|
5
|
+
additional_kwargs: Record<string, unknown>;
|
|
6
|
+
};
|
|
7
|
+
lc: number;
|
|
8
|
+
type: string;
|
|
9
|
+
}
|
|
10
|
+
export interface LoadPreviousSessionResponse {
|
|
11
|
+
data: LoadPreviousSessionResponseItem[];
|
|
12
|
+
}
|
|
13
|
+
export interface SendMessageResponse {
|
|
14
|
+
output: string;
|
|
15
|
+
}
|
package/types/webhook.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type CallbackFn = Function;
|
|
2
|
+
export type UnregisterFn = () => void;
|
|
3
|
+
export interface EventBus {
|
|
4
|
+
on: (eventName: string, fn: CallbackFn) => UnregisterFn;
|
|
5
|
+
off: (eventName: string, fn: CallbackFn) => void;
|
|
6
|
+
emit: <T = Event>(eventName: string, event?: T) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function createEventBus(): EventBus;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createEventBus = createEventBus;
|
|
7
|
+
function createEventBus() {
|
|
8
|
+
const handlers = /* @__PURE__ */new Map();
|
|
9
|
+
function off(eventName, fn) {
|
|
10
|
+
const eventFns = handlers.get(eventName);
|
|
11
|
+
if (eventFns) {
|
|
12
|
+
eventFns.splice(eventFns.indexOf(fn) >>> 0, 1);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function on(eventName, fn) {
|
|
16
|
+
let eventFns = handlers.get(eventName);
|
|
17
|
+
if (!eventFns) {
|
|
18
|
+
eventFns = [fn];
|
|
19
|
+
} else {
|
|
20
|
+
eventFns.push(fn);
|
|
21
|
+
}
|
|
22
|
+
handlers.set(eventName, eventFns);
|
|
23
|
+
return () => off(eventName, fn);
|
|
24
|
+
}
|
|
25
|
+
function emit(eventName, event) {
|
|
26
|
+
const eventFns = handlers.get(eventName);
|
|
27
|
+
if (eventFns) {
|
|
28
|
+
eventFns.slice().forEach(async handler => {
|
|
29
|
+
await handler(event);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
on,
|
|
35
|
+
off,
|
|
36
|
+
emit
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function createEventBus() {
|
|
2
|
+
const handlers = /* @__PURE__ */ new Map();
|
|
3
|
+
function off(eventName, fn) {
|
|
4
|
+
const eventFns = handlers.get(eventName);
|
|
5
|
+
if (eventFns) {
|
|
6
|
+
eventFns.splice(eventFns.indexOf(fn) >>> 0, 1);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function on(eventName, fn) {
|
|
10
|
+
let eventFns = handlers.get(eventName);
|
|
11
|
+
if (!eventFns) {
|
|
12
|
+
eventFns = [fn];
|
|
13
|
+
} else {
|
|
14
|
+
eventFns.push(fn);
|
|
15
|
+
}
|
|
16
|
+
handlers.set(eventName, eventFns);
|
|
17
|
+
return () => off(eventName, fn);
|
|
18
|
+
}
|
|
19
|
+
function emit(eventName, event) {
|
|
20
|
+
const eventFns = handlers.get(eventName);
|
|
21
|
+
if (eventFns) {
|
|
22
|
+
eventFns.slice().forEach(async (handler) => {
|
|
23
|
+
await handler(event);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
on,
|
|
29
|
+
off,
|
|
30
|
+
emit
|
|
31
|
+
};
|
|
32
|
+
}
|
package/utils/index.d.ts
ADDED
package/utils/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _eventBus = require("./event-bus");
|
|
7
|
+
Object.keys(_eventBus).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _eventBus[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _eventBus[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _mount = require("./mount");
|
|
18
|
+
Object.keys(_mount).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _mount[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _mount[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
package/utils/index.mjs
ADDED
package/utils/mount.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createDefaultMountingTarget(mountingTarget: string): void;
|
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
|
+
}
|
package/utils/mount.mjs
ADDED
|
@@ -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
package/.eslintrc.cjs
DELETED
|
@@ -1,51 +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
|
-
|
|
11
|
-
rules: {
|
|
12
|
-
'n8n-local-rules/dangerously-use-html-string-missing': 'off',
|
|
13
|
-
|
|
14
|
-
// TODO: Remove these
|
|
15
|
-
'id-denylist': 'warn',
|
|
16
|
-
'import/extensions': 'warn',
|
|
17
|
-
'import/no-default-export': 'warn',
|
|
18
|
-
'import/order': 'off',
|
|
19
|
-
'import/no-cycle': 'warn',
|
|
20
|
-
'import/no-duplicates': 'warn',
|
|
21
|
-
'@typescript-eslint/ban-types': 'warn',
|
|
22
|
-
'@typescript-eslint/dot-notation': 'warn',
|
|
23
|
-
'@typescript-eslint/lines-between-class-members': 'warn',
|
|
24
|
-
'@typescript-eslint/member-delimiter-style': 'warn',
|
|
25
|
-
'@typescript-eslint/naming-convention': 'warn',
|
|
26
|
-
'@typescript-eslint/no-empty-interface': 'warn',
|
|
27
|
-
'@typescript-eslint/no-for-in-array': 'warn',
|
|
28
|
-
'@typescript-eslint/no-loop-func': 'warn',
|
|
29
|
-
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
30
|
-
'@typescript-eslint/no-shadow': 'warn',
|
|
31
|
-
'@typescript-eslint/no-this-alias': 'warn',
|
|
32
|
-
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'warn',
|
|
33
|
-
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
|
|
34
|
-
'@typescript-eslint/no-unsafe-argument': 'warn',
|
|
35
|
-
'@typescript-eslint/no-unsafe-call': 'warn',
|
|
36
|
-
'@typescript-eslint/no-unsafe-return': 'warn',
|
|
37
|
-
'@typescript-eslint/no-unused-expressions': 'warn',
|
|
38
|
-
'@typescript-eslint/no-unused-vars': 'warn',
|
|
39
|
-
'@typescript-eslint/no-use-before-define': 'warn',
|
|
40
|
-
'@typescript-eslint/no-var-requires': 'warn',
|
|
41
|
-
'@typescript-eslint/prefer-nullish-coalescing': 'warn',
|
|
42
|
-
'@typescript-eslint/prefer-optional-chain': 'warn',
|
|
43
|
-
'@typescript-eslint/restrict-plus-operands': 'warn',
|
|
44
|
-
'@typescript-eslint/unbound-method': 'warn',
|
|
45
|
-
'@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': true }],
|
|
46
|
-
'@typescript-eslint/no-redundant-type-constituents': 'warn',
|
|
47
|
-
'@typescript-eslint/no-base-to-string': 'warn',
|
|
48
|
-
'@typescript-eslint/no-explicit-any': 'warn',
|
|
49
|
-
'@typescript-eslint/no-unsafe-enum-comparison': 'warn',
|
|
50
|
-
},
|
|
51
|
-
};
|
package/.np-config.json
DELETED
package/.storybook/main.ts
DELETED
|
@@ -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;
|
package/.storybook/preview.scss
DELETED
package/.storybook/preview.ts
DELETED
|
@@ -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;
|
package/.vscode/extensions.json
DELETED
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>
|
package/resources/workflow.json
DELETED
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "AI Webhook Chat",
|
|
3
|
-
"nodes": [
|
|
4
|
-
{
|
|
5
|
-
"parameters": {
|
|
6
|
-
"httpMethod": "POST",
|
|
7
|
-
"path": "513107b3-6f3a-4a1e-af21-659f0ed14183",
|
|
8
|
-
"responseMode": "responseNode",
|
|
9
|
-
"options": {
|
|
10
|
-
"domainAllowlist": "*.localhost"
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
"id": "51ab2689-647d-4cff-9d6f-0ba4df45e904",
|
|
14
|
-
"name": "Webhook",
|
|
15
|
-
"type": "n8n-nodes-base.webhook",
|
|
16
|
-
"typeVersion": 1,
|
|
17
|
-
"position": [
|
|
18
|
-
900,
|
|
19
|
-
200
|
|
20
|
-
],
|
|
21
|
-
"webhookId": "513107b3-6f3a-4a1e-af21-659f0ed14183"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"parameters": {
|
|
25
|
-
"options": {}
|
|
26
|
-
},
|
|
27
|
-
"id": "3c7fd563-f610-41fa-b198-7fcf100e2815",
|
|
28
|
-
"name": "Chat OpenAI",
|
|
29
|
-
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
|
30
|
-
"typeVersion": 1,
|
|
31
|
-
"position": [
|
|
32
|
-
1720,
|
|
33
|
-
620
|
|
34
|
-
],
|
|
35
|
-
"credentials": {
|
|
36
|
-
"openAiApi": {
|
|
37
|
-
"id": "B5Fiv70Adfg6htxn",
|
|
38
|
-
"name": "Alex's OpenAI Account"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"parameters": {
|
|
44
|
-
"sessionKey": "={{ $json.body.sessionId }}"
|
|
45
|
-
},
|
|
46
|
-
"id": "ebc23ffa-3bcf-494f-bcb8-51a5fff91885",
|
|
47
|
-
"name": "Window Buffer Memory",
|
|
48
|
-
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
|
|
49
|
-
"typeVersion": 1,
|
|
50
|
-
"position": [
|
|
51
|
-
1920,
|
|
52
|
-
620
|
|
53
|
-
]
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"parameters": {
|
|
57
|
-
"simplifyOutput": false
|
|
58
|
-
},
|
|
59
|
-
"id": "d6721a60-159b-4a93-ac6b-b81e16d9f16f",
|
|
60
|
-
"name": "Memory Chat Retriever",
|
|
61
|
-
"type": "@n8n/n8n-nodes-langchain.memoryChatRetriever",
|
|
62
|
-
"typeVersion": 1,
|
|
63
|
-
"position": [
|
|
64
|
-
1780,
|
|
65
|
-
-40
|
|
66
|
-
]
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"parameters": {
|
|
70
|
-
"sessionKey": "={{ $json.body.sessionId }}"
|
|
71
|
-
},
|
|
72
|
-
"id": "347edc3a-1dda-4996-b778-dcdc447ecfd8",
|
|
73
|
-
"name": "Memory Chat Retriever Window Buffer Memory",
|
|
74
|
-
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
|
|
75
|
-
"typeVersion": 1,
|
|
76
|
-
"position": [
|
|
77
|
-
1800,
|
|
78
|
-
160
|
|
79
|
-
]
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"parameters": {
|
|
83
|
-
"options": {
|
|
84
|
-
"responseCode": 200,
|
|
85
|
-
"responseHeaders": {
|
|
86
|
-
"entries": [
|
|
87
|
-
{
|
|
88
|
-
"name": "sessionId",
|
|
89
|
-
"value": "={{ $json.body.sessionId }}"
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"name": "Access-Control-Allow-Headers",
|
|
93
|
-
"value": "*"
|
|
94
|
-
}
|
|
95
|
-
]
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
"id": "d229963e-e2f1-4381-87d2-47043bd6ccc7",
|
|
100
|
-
"name": "Respond to Webhook",
|
|
101
|
-
"type": "n8n-nodes-base.respondToWebhook",
|
|
102
|
-
"typeVersion": 1,
|
|
103
|
-
"position": [
|
|
104
|
-
2460,
|
|
105
|
-
220
|
|
106
|
-
]
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
"parameters": {
|
|
110
|
-
"dataType": "string",
|
|
111
|
-
"value1": "={{ $json.body.action }}",
|
|
112
|
-
"rules": {
|
|
113
|
-
"rules": [
|
|
114
|
-
{
|
|
115
|
-
"value2": "loadPreviousSession"
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
"value2": "sendMessage",
|
|
119
|
-
"output": 1
|
|
120
|
-
}
|
|
121
|
-
]
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
"id": "fc4ad994-5f38-4dce-b1e5-397acc512687",
|
|
125
|
-
"name": "Chatbot Action",
|
|
126
|
-
"type": "n8n-nodes-base.switch",
|
|
127
|
-
"typeVersion": 1,
|
|
128
|
-
"position": [
|
|
129
|
-
1320,
|
|
130
|
-
200
|
|
131
|
-
]
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
"parameters": {
|
|
135
|
-
"jsCode": "const response = { data: [] };\n\nfor (const item of $input.all()) {\n response.data.push(item.json);\n}\n\nreturn {\n json: response,\n pairedItem: 0\n};"
|
|
136
|
-
},
|
|
137
|
-
"id": "e1a80bdc-411a-42df-88dd-36915b1ae8f4",
|
|
138
|
-
"name": "Code",
|
|
139
|
-
"type": "n8n-nodes-base.code",
|
|
140
|
-
"typeVersion": 2,
|
|
141
|
-
"position": [
|
|
142
|
-
2160,
|
|
143
|
-
-40
|
|
144
|
-
]
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
"parameters": {
|
|
148
|
-
"text": "={{ $json.body.message }}",
|
|
149
|
-
"options": {}
|
|
150
|
-
},
|
|
151
|
-
"id": "f28f5c00-c742-41d5-8ddb-f0f59ab111a3",
|
|
152
|
-
"name": "Agent",
|
|
153
|
-
"type": "@n8n/n8n-nodes-langchain.agent",
|
|
154
|
-
"typeVersion": 1,
|
|
155
|
-
"position": [
|
|
156
|
-
1780,
|
|
157
|
-
340
|
|
158
|
-
]
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
"parameters": {
|
|
162
|
-
"jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n item.json.body = JSON.parse(item.json.body);\n}\n\nreturn $input.all();"
|
|
163
|
-
},
|
|
164
|
-
"id": "415c071b-18b2-4ac5-8634-e3d939bf36ac",
|
|
165
|
-
"name": "Transform request body",
|
|
166
|
-
"type": "n8n-nodes-base.code",
|
|
167
|
-
"typeVersion": 2,
|
|
168
|
-
"position": [
|
|
169
|
-
1120,
|
|
170
|
-
200
|
|
171
|
-
]
|
|
172
|
-
}
|
|
173
|
-
],
|
|
174
|
-
"pinData": {},
|
|
175
|
-
"connections": {
|
|
176
|
-
"Webhook": {
|
|
177
|
-
"main": [
|
|
178
|
-
[
|
|
179
|
-
{
|
|
180
|
-
"node": "Transform request body",
|
|
181
|
-
"type": "main",
|
|
182
|
-
"index": 0
|
|
183
|
-
}
|
|
184
|
-
]
|
|
185
|
-
]
|
|
186
|
-
},
|
|
187
|
-
"Memory Chat Retriever": {
|
|
188
|
-
"main": [
|
|
189
|
-
[
|
|
190
|
-
{
|
|
191
|
-
"node": "Code",
|
|
192
|
-
"type": "main",
|
|
193
|
-
"index": 0
|
|
194
|
-
}
|
|
195
|
-
]
|
|
196
|
-
]
|
|
197
|
-
},
|
|
198
|
-
"Memory Chat Retriever Window Buffer Memory": {
|
|
199
|
-
"ai_memory": [
|
|
200
|
-
[
|
|
201
|
-
{
|
|
202
|
-
"node": "Memory Chat Retriever",
|
|
203
|
-
"type": "ai_memory",
|
|
204
|
-
"index": 0
|
|
205
|
-
}
|
|
206
|
-
]
|
|
207
|
-
]
|
|
208
|
-
},
|
|
209
|
-
"Chatbot Action": {
|
|
210
|
-
"main": [
|
|
211
|
-
[
|
|
212
|
-
{
|
|
213
|
-
"node": "Memory Chat Retriever",
|
|
214
|
-
"type": "main",
|
|
215
|
-
"index": 0
|
|
216
|
-
}
|
|
217
|
-
],
|
|
218
|
-
[
|
|
219
|
-
{
|
|
220
|
-
"node": "Agent",
|
|
221
|
-
"type": "main",
|
|
222
|
-
"index": 0
|
|
223
|
-
}
|
|
224
|
-
]
|
|
225
|
-
]
|
|
226
|
-
},
|
|
227
|
-
"Code": {
|
|
228
|
-
"main": [
|
|
229
|
-
[
|
|
230
|
-
{
|
|
231
|
-
"node": "Respond to Webhook",
|
|
232
|
-
"type": "main",
|
|
233
|
-
"index": 0
|
|
234
|
-
}
|
|
235
|
-
]
|
|
236
|
-
]
|
|
237
|
-
},
|
|
238
|
-
"Chat OpenAI": {
|
|
239
|
-
"ai_languageModel": [
|
|
240
|
-
[
|
|
241
|
-
{
|
|
242
|
-
"node": "Agent",
|
|
243
|
-
"type": "ai_languageModel",
|
|
244
|
-
"index": 0
|
|
245
|
-
}
|
|
246
|
-
]
|
|
247
|
-
]
|
|
248
|
-
},
|
|
249
|
-
"Window Buffer Memory": {
|
|
250
|
-
"ai_memory": [
|
|
251
|
-
[
|
|
252
|
-
{
|
|
253
|
-
"node": "Agent",
|
|
254
|
-
"type": "ai_memory",
|
|
255
|
-
"index": 0
|
|
256
|
-
}
|
|
257
|
-
]
|
|
258
|
-
]
|
|
259
|
-
},
|
|
260
|
-
"Agent": {
|
|
261
|
-
"main": [
|
|
262
|
-
[
|
|
263
|
-
{
|
|
264
|
-
"node": "Respond to Webhook",
|
|
265
|
-
"type": "main",
|
|
266
|
-
"index": 0
|
|
267
|
-
}
|
|
268
|
-
]
|
|
269
|
-
]
|
|
270
|
-
},
|
|
271
|
-
"Transform request body": {
|
|
272
|
-
"main": [
|
|
273
|
-
[
|
|
274
|
-
{
|
|
275
|
-
"node": "Chatbot Action",
|
|
276
|
-
"type": "main",
|
|
277
|
-
"index": 0
|
|
278
|
-
}
|
|
279
|
-
]
|
|
280
|
-
]
|
|
281
|
-
}
|
|
282
|
-
},
|
|
283
|
-
"active": true,
|
|
284
|
-
"settings": {
|
|
285
|
-
"executionOrder": "v1"
|
|
286
|
-
},
|
|
287
|
-
"versionId": "12c145a2-74bf-48b5-a87a-ba707949eaed",
|
|
288
|
-
"id": "L3FlJuFOxZcHtoFT",
|
|
289
|
-
"meta": {
|
|
290
|
-
"instanceId": "374b43d8b8d6299cc777811a4ad220fc688ee2d54a308cfb0de4450a5233ca9e"
|
|
291
|
-
},
|
|
292
|
-
"tags": []
|
|
293
|
-
}
|
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');
|