@n8n/chat 0.18.0 → 0.19.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 +2 -2
- package/dist/App.vue.d.ts +8 -0
- package/dist/__stories__/App.stories.d.ts +18 -0
- package/dist/__tests__/index.spec.d.ts +1 -0
- package/dist/__tests__/setup.d.ts +1 -0
- package/dist/__tests__/utils/create.d.ts +6 -0
- package/dist/__tests__/utils/fetch.d.ts +5 -0
- package/dist/__tests__/utils/selectors.d.ts +12 -0
- package/dist/api/generic.d.ts +6 -0
- package/dist/api/message.d.ts +4 -0
- package/dist/chat.bundle.es.js +11029 -0
- package/dist/chat.bundle.umd.js +37 -0
- package/dist/chat.es.js +6939 -0
- package/dist/chat.umd.js +18 -0
- package/dist/components/Button.vue.d.ts +11 -0
- package/dist/components/Chat.vue.d.ts +2 -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 +2 -0
- package/dist/components/Layout.vue.d.ts +13 -0
- package/dist/components/Message.vue.d.ts +26 -0
- package/dist/components/MessageTyping.vue.d.ts +29 -0
- package/dist/components/MessagesList.vue.d.ts +17 -0
- package/dist/components/PoweredBy.vue.d.ts +2 -0
- package/dist/composables/useChat.d.ts +3 -0
- package/dist/composables/useI18n.d.ts +4 -0
- package/dist/composables/useOptions.d.ts +5 -0
- package/dist/constants/defaults.d.ts +4 -0
- package/dist/constants/localStorage.d.ts +2 -0
- package/dist/constants/symbols.d.ts +5 -0
- package/dist/event-buses/chatEventBus.d.ts +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/plugins/chat.d.ts +4 -0
- package/dist/style.css +1 -0
- package/dist/types/chat.d.ts +12 -0
- package/{src/types/messages.ts → dist/types/messages.d.ts} +10 -12
- package/dist/types/options.d.ts +31 -0
- package/dist/types/webhook.d.ts +16 -0
- package/dist/utils/event-bus.d.ts +8 -0
- package/dist/utils/mount.d.ts +1 -0
- package/package.json +45 -9
- package/.eslintignore +0 -2
- package/.eslintrc.cjs +0 -10
- package/.np-config.json +0 -5
- package/.storybook/main.ts +0 -4
- package/.storybook/preview.scss +0 -4
- package/.storybook/preview.ts +0 -15
- package/.vscode/extensions.json +0 -3
- package/build.config.js +0 -21
- package/env.d.ts +0 -1
- package/index.html +0 -13
- package/resources/images/fullscreen.png +0 -0
- package/resources/images/windowed.png +0 -0
- package/resources/workflow-manual.json +0 -238
- package/resources/workflow.json +0 -119
- package/scripts/pack.js +0 -11
- package/scripts/postbuild.js +0 -36
- package/src/App.vue +0 -23
- package/src/__stories__/App.stories.ts +0 -43
- package/src/__tests__/index.spec.ts +0 -218
- 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 -63
- package/src/api/message.ts +0 -37
- package/src/components/Button.vue +0 -41
- package/src/components/Chat.vue +0 -96
- package/src/components/ChatWindow.vue +0 -123
- package/src/components/GetStarted.vue +0 -24
- package/src/components/GetStartedFooter.vue +0 -20
- package/src/components/Input.vue +0 -108
- package/src/components/Layout.vue +0 -99
- package/src/components/Message.vue +0 -137
- package/src/components/MessageTyping.vue +0 -110
- package/src/components/MessagesList.vue +0 -33
- package/src/components/PoweredBy.vue +0 -17
- package/src/composables/useChat.ts +0 -7
- package/src/composables/useI18n.ts +0 -21
- package/src/composables/useOptions.ts +0 -11
- package/src/constants/defaults.ts +0 -30
- package/src/constants/localStorage.ts +0 -2
- package/src/constants/symbols.ts +0 -8
- package/src/css/_tokens.scss +0 -38
- package/src/css/index.scss +0 -1
- package/src/event-buses/chatEventBus.ts +0 -3
- package/src/index.ts +0 -42
- package/src/main.scss +0 -5
- package/src/plugins/chat.ts +0 -115
- package/src/shims.d.ts +0 -6
- package/src/types/chat.ts +0 -12
- package/src/types/icons.d.ts +0 -5
- package/src/types/options.ts +0 -33
- package/src/types/webhook.ts +0 -18
- package/src/utils/event-bus.ts +0 -51
- package/src/utils/mount.ts +0 -16
- package/tsconfig.json +0 -27
- package/vite.config.mts +0 -53
- package/vitest.config.mts +0 -30
- /package/{src/__tests__/utils/index.ts → dist/__tests__/utils/index.d.ts} +0 -0
- /package/{src/api/index.ts → dist/api/index.d.ts} +0 -0
- /package/{src/components/index.ts → dist/components/index.d.ts} +0 -0
- /package/{src/composables/index.ts → dist/composables/index.d.ts} +0 -0
- /package/{src/constants/index.ts → dist/constants/index.d.ts} +0 -0
- /package/{src/event-buses/index.ts → dist/event-buses/index.d.ts} +0 -0
- /package/{public → dist}/favicon.ico +0 -0
- /package/{src/plugins/index.ts → dist/plugins/index.d.ts} +0 -0
- /package/{src/types/index.ts → dist/types/index.d.ts} +0 -0
- /package/{src/utils/index.ts → dist/utils/index.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const chatEventBus: import('../utils').EventBus;
|
package/dist/index.d.ts
ADDED
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.n8n-chat pre code.hljs{display:block;overflow-x:auto;padding:1em}.n8n-chat code.hljs{padding:3px 5px}.n8n-chat .hljs{color:#24292e;background:#fff}.n8n-chat .hljs-doctag,.n8n-chat .hljs-keyword,.n8n-chat .hljs-meta .hljs-keyword,.n8n-chat .hljs-template-tag,.n8n-chat .hljs-template-variable,.n8n-chat .hljs-type,.n8n-chat .hljs-variable.language_{color:#d73a49}.n8n-chat .hljs-title,.n8n-chat .hljs-title.class_,.n8n-chat .hljs-title.class_.inherited__,.n8n-chat .hljs-title.function_{color:#6f42c1}.n8n-chat .hljs-attr,.n8n-chat .hljs-attribute,.n8n-chat .hljs-literal,.n8n-chat .hljs-meta,.n8n-chat .hljs-number,.n8n-chat .hljs-operator,.n8n-chat .hljs-variable,.n8n-chat .hljs-selector-attr,.n8n-chat .hljs-selector-class,.n8n-chat .hljs-selector-id{color:#005cc5}.n8n-chat .hljs-regexp,.n8n-chat .hljs-string,.n8n-chat .hljs-meta .hljs-string{color:#032f62}.n8n-chat .hljs-built_in,.n8n-chat .hljs-symbol{color:#e36209}.n8n-chat .hljs-comment,.n8n-chat .hljs-code,.n8n-chat .hljs-formula{color:#6a737d}.n8n-chat .hljs-name,.n8n-chat .hljs-quote,.n8n-chat .hljs-selector-tag,.n8n-chat .hljs-selector-pseudo{color:#22863a}.n8n-chat .hljs-subst{color:#24292e}.n8n-chat .hljs-section{color:#005cc5;font-weight:700}.n8n-chat .hljs-bullet{color:#735c0f}.n8n-chat .hljs-emphasis{color:#24292e;font-style:italic}.n8n-chat .hljs-strong{color:#24292e;font-weight:700}.n8n-chat .hljs-addition{color:#22863a;background-color:#f0fff4}.n8n-chat .hljs-deletion{color:#b31d28;background-color:#ffeef0}:root{--chat--color-primary: #e74266;--chat--color-primary-shade-50: #db4061;--chat--color-primary-shade-100: #cf3c5c;--chat--color-secondary: #20b69e;--chat--color-secondary-shade-50: #1ca08a;--chat--color-white: #ffffff;--chat--color-light: #f2f4f8;--chat--color-light-shade-50: #e6e9f1;--chat--color-light-shade-100: #c2c5cc;--chat--color-medium: #d2d4d9;--chat--color-dark: #101330;--chat--color-disabled: #777980;--chat--color-typing: #404040;--chat--spacing: 1rem;--chat--border-radius: .25rem;--chat--transition-duration: .15s;--chat--window--width: 400px;--chat--window--height: 600px;--chat--textarea--height: 50px;--chat--message--bot--background: var(--chat--color-white);--chat--message--bot--color: var(--chat--color-dark);--chat--message--user--background: var(--chat--color-secondary);--chat--message--user--color: var(--chat--color-white);--chat--message--pre--background: rgba(0, 0, 0, .05);--chat--toggle--background: var(--chat--color-primary);--chat--toggle--hover--background: var(--chat--color-primary-shade-50);--chat--toggle--active--background: var(--chat--color-primary-shade-100);--chat--toggle--color: var(--chat--color-white);--chat--toggle--size: 64px;--chat--heading--font-size: 2em}.chat-button{display:inline-flex;text-align:center;vertical-align:middle;-webkit-user-select:none;user-select:none;color:var(--chat--button--color, var(--chat--color-light));background-color:var(--chat--button--background, var(--chat--color-primary));border:1px solid transparent;padding:var(--chat--button--padding, calc(var(--chat--spacing) * 1 / 2) var(--chat--spacing));font-size:1rem;line-height:1.5;border-radius:var(--chat--button--border-radius, var(--chat--border-radius));transition:color var(--chat--transition-duration) ease-in-out,background-color var(--chat--transition-duration) ease-in-out,border-color var(--chat--transition-duration) ease-in-out,box-shadow var(--chat--transition-duration) ease-in-out;cursor:pointer}.chat-button:hover{color:var(--chat--button--hover--color, var(--chat--color-light));background-color:var(--chat--button--hover--background, var(--chat--color-primary-shade-50));text-decoration:none}.chat-button:focus{outline:0;box-shadow:0 0 0 .2rem #007bff40}.chat-button:disabled{opacity:.65}.chat-layout{width:100%;height:100%;display:flex;overflow-y:auto;flex-direction:column;font-family:var(--chat--font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif)}.chat-layout .chat-header{display:flex;flex-direction:column;justify-content:center;gap:1em;height:var(--chat--header-height, auto);padding:var(--chat--header--padding, var(--chat--spacing));background:var(--chat--header--background, var(--chat--color-dark));color:var(--chat--header--color, var(--chat--color-light));border-top:var(--chat--header--border-top, none);border-bottom:var(--chat--header--border-bottom, none);border-left:var(--chat--header--border-left, none);border-right:var(--chat--header--border-right, none)}.chat-layout .chat-header h1{font-size:var(--chat--heading--font-size);color:var(--chat--header--color, var(--chat--color-light))}.chat-layout .chat-header p{font-size:var(--chat--subtitle--font-size, inherit);line-height:var(--chat--subtitle--line-height, 1.8)}.chat-layout .chat-body{background:var(--chat--body--background, var(--chat--color-light));flex:1;display:flex;flex-direction:column;overflow-y:auto;position:relative;min-height:100px}.chat-layout .chat-footer{border-top:1px solid var(--chat--color-light-shade-100);background:var(--chat--footer--background, var(--chat--color-light));color:var(--chat--footer--color, var(--chat--color-dark))}.chat-get-started{padding-top:var(--chat--spacing);padding-bottom:var(--chat--spacing);display:flex;justify-content:center;align-items:center;height:100%}.chat-powered-by{text-align:center}.chat-powered-by a{color:var(--chat--color-primary);text-decoration:none}.chat-get-started-footer{padding:var(--chat--spacing)}.chat-message{display:block;max-width:80%;font-size:var(--chat--message--font-size, 1rem);padding:var(--chat--message--padding, var(--chat--spacing));border-radius:var(--chat--message--border-radius, var(--chat--border-radius))}.chat-message p{line-height:var(--chat--message-line-height, 1.8);word-wrap:break-word}.chat-message+.chat-message{margin-top:var(--chat--message--margin-bottom, calc(var(--chat--spacing) * .5))}.chat-message.chat-message-from-user+.chat-message.chat-message-from-bot,.chat-message.chat-message-from-bot+.chat-message.chat-message-from-user{margin-top:var(--chat--spacing)}.chat-message.chat-message-from-bot{color:var(--chat--message--bot--color);border-bottom-left-radius:0}.chat-message.chat-message-from-bot:not(.chat-message-transparent){background-color:var(--chat--message--bot--background);border:var(--chat--message--bot--border, none)}.chat-message.chat-message-from-user{color:var(--chat--message--user--color);margin-left:auto;border-bottom-right-radius:0}.chat-message.chat-message-from-user:not(.chat-message-transparent){background-color:var(--chat--message--user--background);border:var(--chat--message--user--border, none)}.chat-message>.chat-message-markdown{display:block;box-sizing:border-box}.chat-message>.chat-message-markdown>*:first-child{margin-top:0}.chat-message>.chat-message-markdown>*:last-child{margin-bottom:0}.chat-message>.chat-message-markdown pre{font-family:inherit;font-size:inherit;margin:0;white-space:pre-wrap;box-sizing:border-box;padding:var(--chat--spacing);background:var(--chat--message--pre--background);border-radius:var(--chat--border-radius)}.chat-message-typing{max-width:80px}.chat-message-typing.chat-message-typing-animation-scaling .chat-message-typing-circle{animation:chat-message-typing-animation-scaling .8s ease-in-out infinite;animation-delay:3.6s}.chat-message-typing.chat-message-typing-animation-bouncing .chat-message-typing-circle{animation:chat-message-typing-animation-bouncing .8s ease-in-out infinite;animation-delay:3.6s}.chat-message-typing .chat-message-typing-body{display:flex;justify-content:center;align-items:center}.chat-message-typing .chat-message-typing-circle{display:block;height:10px;width:10px;border-radius:50%;background-color:var(--chat--color-typing);margin:3px}.chat-message-typing .chat-message-typing-circle:nth-child(1){animation-delay:0ms}.chat-message-typing .chat-message-typing-circle:nth-child(2){animation-delay:333ms}.chat-message-typing .chat-message-typing-circle:nth-child(3){animation-delay:666ms}@keyframes chat-message-typing-animation-scaling{0%{transform:scale(1)}33%{transform:scale(1)}50%{transform:scale(1.4)}to{transform:scale(1)}}@keyframes chat-message-typing-animation-bouncing{0%{transform:translateY(0)}33%{transform:translateY(0)}50%{transform:translateY(-10px)}to{transform:translateY(0)}}.chat-messages-list{margin-top:auto;display:block;padding:var(--chat--messages-list--padding, var(--chat--spacing))}.chat-input{display:flex;justify-content:center;align-items:center;width:100%;background:#fff}.chat-input textarea{font-family:inherit;font-size:var(--chat--input--font-size, inherit);width:100%;border:0;padding:var(--chat--spacing);max-height:var(--chat--textarea--height);resize:none}.chat-input .chat-input-send-button{height:var(--chat--textarea--height);width:var(--chat--textarea--height);background:#fff;cursor:pointer;color:var(--chat--input--send--button--color, var(--chat--color-secondary));border:0;font-size:24px;display:inline-flex;align-items:center;justify-content:center;transition:color var(--chat--transition-duration) ease}.chat-input .chat-input-send-button:hover,.chat-input .chat-input-send-button:focus{color:var(--chat--color-secondary-shade-50)}.chat-input .chat-input-send-button[disabled]{cursor:default;color:var(--chat--color-disabled)}.chat-heading{display:flex;justify-content:space-between;align-items:center}.chat-close-button{display:flex;border:none;background:none;cursor:pointer}.chat-close-button:hover{color:var(--chat--close--button--color-hover, var(--chat--color-primary))}.chat-window-wrapper{position:fixed;display:flex;flex-direction:column;bottom:var(--chat--window--bottom, var(--chat--spacing));right:var(--chat--window--right, var(--chat--spacing));z-index:var(--chat--window--z-index, 9999);max-width:calc(100% - var(--chat--window--right, var(--chat--spacing)) * 2);max-height:calc(100% - var(--chat--window--bottom, var(--chat--spacing)) * 2)}.chat-window-wrapper .chat-window{display:flex;width:var(--chat--window--width);height:var(--chat--window--height);max-width:100%;max-height:100%;border:var(--chat--window--border, 1px solid var(--chat--color-light-shade-100));border-radius:var(--chat--window--border-radius, var(--chat--border-radius));margin-bottom:var(--chat--window--margin-bottom, var(--chat--spacing));overflow:hidden;transform-origin:bottom right}.chat-window-wrapper .chat-window .chat-layout{width:auto;height:auto;flex:1}.chat-window-wrapper .chat-window-toggle{flex:0 0 auto;background:var(--chat--toggle--background);color:var(--chat--toggle--color);cursor:pointer;width:var(--chat--toggle--width, var(--chat--toggle--size));height:var(--chat--toggle--height, var(--chat--toggle--size));border-radius:var(--chat--toggle--border-radius, 50%);display:inline-flex;align-items:center;justify-content:center;margin-left:auto;transition:transform var(--chat--transition-duration) ease,background var(--chat--transition-duration) ease}.chat-window-wrapper .chat-window-toggle:hover,.chat-window-wrapper .chat-window-toggle:focus{transform:scale(1.05);background:var(--chat--toggle--hover--background)}.chat-window-wrapper .chat-window-toggle:active{transform:scale(.95);background:var(--chat--toggle--active--background)}.chat-window-transition-enter-active,.chat-window-transition-leave-active{transition:transform var(--chat--transition-duration) ease,opacity var(--chat--transition-duration) ease}.chat-window-transition-enter-from,.chat-window-transition-leave-to{transform:scale(0);opacity:0}.chat-window-toggle-transition-enter-active,.chat-window-toggle-transition-leave-active{transition:opacity var(--chat--transition-duration) ease}.chat-window-toggle-transition-enter-from,.chat-window-toggle-transition-leave-to{opacity:0}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { ChatMessage } from './messages';
|
|
3
|
+
|
|
4
|
+
export interface Chat {
|
|
5
|
+
initialMessages: Ref<ChatMessage[]>;
|
|
6
|
+
messages: Ref<ChatMessage[]>;
|
|
7
|
+
currentSessionId: Ref<string | null>;
|
|
8
|
+
waitingForResponse: Ref<boolean>;
|
|
9
|
+
loadPreviousSession?: () => Promise<string | undefined>;
|
|
10
|
+
startNewSession?: () => Promise<void>;
|
|
11
|
+
sendMessage: (text: string) => Promise<void>;
|
|
12
|
+
}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
export type ChatMessage<T = Record<string, unknown>> = ChatMessageComponent<T> | ChatMessageText;
|
|
2
|
-
|
|
3
2
|
export interface ChatMessageComponent<T = Record<string, unknown>> extends ChatMessageBase {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
type: 'component';
|
|
4
|
+
key: string;
|
|
5
|
+
arguments: T;
|
|
7
6
|
}
|
|
8
|
-
|
|
9
7
|
export interface ChatMessageText extends ChatMessageBase {
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
type?: 'text';
|
|
9
|
+
text: string;
|
|
12
10
|
}
|
|
13
|
-
|
|
14
11
|
interface ChatMessageBase {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
id: string;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
transparent?: boolean;
|
|
15
|
+
sender: 'user' | 'bot';
|
|
19
16
|
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Component, Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
export interface ChatOptions {
|
|
4
|
+
webhookUrl: string;
|
|
5
|
+
webhookConfig?: {
|
|
6
|
+
method?: 'GET' | 'POST';
|
|
7
|
+
headers?: Record<string, string>;
|
|
8
|
+
};
|
|
9
|
+
target?: string | Element;
|
|
10
|
+
mode?: 'window' | 'fullscreen';
|
|
11
|
+
showWindowCloseButton?: boolean;
|
|
12
|
+
showWelcomeScreen?: boolean;
|
|
13
|
+
loadPreviousSession?: boolean;
|
|
14
|
+
chatInputKey?: string;
|
|
15
|
+
chatSessionKey?: string;
|
|
16
|
+
defaultLanguage?: 'en';
|
|
17
|
+
initialMessages?: string[];
|
|
18
|
+
metadata?: Record<string, unknown>;
|
|
19
|
+
i18n: Record<string, {
|
|
20
|
+
title: string;
|
|
21
|
+
subtitle: string;
|
|
22
|
+
footer: string;
|
|
23
|
+
getStarted: string;
|
|
24
|
+
inputPlaceholder: string;
|
|
25
|
+
closeButtonTooltip: string;
|
|
26
|
+
[message: string]: string;
|
|
27
|
+
}>;
|
|
28
|
+
theme?: {};
|
|
29
|
+
messageComponents?: Record<string, Component>;
|
|
30
|
+
disabled?: Ref<boolean>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
text?: string;
|
|
16
|
+
}
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,27 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n8n/chat",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
"version": "0.19.1",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"dev": "pnpm run storybook",
|
|
6
|
+
"build": "pnpm build:vite && pnpm build:bundle",
|
|
7
|
+
"build:vite": "vite build",
|
|
8
|
+
"build:bundle": "INCLUDE_VUE=true vite build",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"test:dev": "vitest",
|
|
11
|
+
"test": "vitest run --coverage",
|
|
12
|
+
"typecheck": "vue-tsc --noEmit",
|
|
13
|
+
"lint": "eslint . --ext .js,.ts,.vue --quiet",
|
|
14
|
+
"lintfix": "eslint . --ext .js,.ts,.vue --fix",
|
|
15
|
+
"format": "prettier --write src/",
|
|
16
|
+
"storybook": "storybook dev -p 6006 --no-open",
|
|
17
|
+
"build:storybook": "storybook build",
|
|
18
|
+
"release": "pnpm run build:full && cd dist && pnpm publish"
|
|
19
|
+
},
|
|
20
|
+
"main": "./dist/chat.umd.js",
|
|
21
|
+
"module": "./dist/chat.es.js",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
7
23
|
"exports": {
|
|
8
24
|
".": {
|
|
9
|
-
"import": "./
|
|
10
|
-
"require": "./
|
|
25
|
+
"import": "./dist/chat.es.js",
|
|
26
|
+
"require": "./dist/chat.umd.js",
|
|
27
|
+
"types": "./dist/index.d.ts"
|
|
11
28
|
},
|
|
12
29
|
"./style.css": {
|
|
13
|
-
"import": "./style.css",
|
|
14
|
-
"require": "./style.css"
|
|
30
|
+
"import": "./dist/style.css",
|
|
31
|
+
"require": "./dist/style.css"
|
|
15
32
|
},
|
|
16
33
|
"./*": {
|
|
17
34
|
"import": "./*",
|
|
18
35
|
"require": "./*"
|
|
19
36
|
}
|
|
20
37
|
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"highlight.js": "^11.8.0",
|
|
40
|
+
"markdown-it-link-attributes": "^4.0.1",
|
|
41
|
+
"uuid": "^8.3.2",
|
|
42
|
+
"vue": "^3.4.21",
|
|
43
|
+
"vue-markdown-render": "^2.1.1"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@iconify-json/mdi": "^1.1.54",
|
|
47
|
+
"@n8n/storybook": "workspace:*",
|
|
48
|
+
"@types/markdown-it": "^12.2.3",
|
|
49
|
+
"unplugin-icons": "^0.17.0",
|
|
50
|
+
"vite-plugin-dts": "^3.9.1"
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"README.md",
|
|
54
|
+
"LICENSE.md",
|
|
55
|
+
"dist"
|
|
56
|
+
],
|
|
21
57
|
"repository": {
|
|
22
58
|
"type": "git",
|
|
23
59
|
"url": "git+https://github.com/n8n-io/n8n.git"
|
|
24
60
|
},
|
|
25
61
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
26
62
|
"homepage": "https://n8n.io"
|
|
27
|
-
}
|
|
63
|
+
}
|
package/.eslintignore
DELETED
package/.eslintrc.cjs
DELETED
package/.np-config.json
DELETED
package/.storybook/main.ts
DELETED
package/.storybook/preview.scss
DELETED
package/.storybook/preview.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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/.vscode/extensions.json
DELETED
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
|
-
}
|