@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.
Files changed (110) hide show
  1. package/README.md +2 -2
  2. package/dist/App.vue.d.ts +8 -0
  3. package/dist/__stories__/App.stories.d.ts +18 -0
  4. package/dist/__tests__/index.spec.d.ts +1 -0
  5. package/dist/__tests__/setup.d.ts +1 -0
  6. package/dist/__tests__/utils/create.d.ts +6 -0
  7. package/dist/__tests__/utils/fetch.d.ts +5 -0
  8. package/dist/__tests__/utils/selectors.d.ts +12 -0
  9. package/dist/api/generic.d.ts +6 -0
  10. package/dist/api/message.d.ts +4 -0
  11. package/dist/chat.bundle.es.js +11029 -0
  12. package/dist/chat.bundle.umd.js +37 -0
  13. package/dist/chat.es.js +6939 -0
  14. package/dist/chat.umd.js +18 -0
  15. package/dist/components/Button.vue.d.ts +11 -0
  16. package/dist/components/Chat.vue.d.ts +2 -0
  17. package/dist/components/ChatWindow.vue.d.ts +2 -0
  18. package/dist/components/GetStarted.vue.d.ts +2 -0
  19. package/dist/components/GetStartedFooter.vue.d.ts +2 -0
  20. package/dist/components/Input.vue.d.ts +2 -0
  21. package/dist/components/Layout.vue.d.ts +13 -0
  22. package/dist/components/Message.vue.d.ts +26 -0
  23. package/dist/components/MessageTyping.vue.d.ts +29 -0
  24. package/dist/components/MessagesList.vue.d.ts +17 -0
  25. package/dist/components/PoweredBy.vue.d.ts +2 -0
  26. package/dist/composables/useChat.d.ts +3 -0
  27. package/dist/composables/useI18n.d.ts +4 -0
  28. package/dist/composables/useOptions.d.ts +5 -0
  29. package/dist/constants/defaults.d.ts +4 -0
  30. package/dist/constants/localStorage.d.ts +2 -0
  31. package/dist/constants/symbols.d.ts +5 -0
  32. package/dist/event-buses/chatEventBus.d.ts +1 -0
  33. package/dist/index.d.ts +3 -0
  34. package/dist/plugins/chat.d.ts +4 -0
  35. package/dist/style.css +1 -0
  36. package/dist/types/chat.d.ts +12 -0
  37. package/{src/types/messages.ts → dist/types/messages.d.ts} +10 -12
  38. package/dist/types/options.d.ts +31 -0
  39. package/dist/types/webhook.d.ts +16 -0
  40. package/dist/utils/event-bus.d.ts +8 -0
  41. package/dist/utils/mount.d.ts +1 -0
  42. package/package.json +45 -9
  43. package/.eslintignore +0 -2
  44. package/.eslintrc.cjs +0 -10
  45. package/.np-config.json +0 -5
  46. package/.storybook/main.ts +0 -4
  47. package/.storybook/preview.scss +0 -4
  48. package/.storybook/preview.ts +0 -15
  49. package/.vscode/extensions.json +0 -3
  50. package/build.config.js +0 -21
  51. package/env.d.ts +0 -1
  52. package/index.html +0 -13
  53. package/resources/images/fullscreen.png +0 -0
  54. package/resources/images/windowed.png +0 -0
  55. package/resources/workflow-manual.json +0 -238
  56. package/resources/workflow.json +0 -119
  57. package/scripts/pack.js +0 -11
  58. package/scripts/postbuild.js +0 -36
  59. package/src/App.vue +0 -23
  60. package/src/__stories__/App.stories.ts +0 -43
  61. package/src/__tests__/index.spec.ts +0 -218
  62. package/src/__tests__/setup.ts +0 -1
  63. package/src/__tests__/utils/create.ts +0 -16
  64. package/src/__tests__/utils/fetch.ts +0 -18
  65. package/src/__tests__/utils/selectors.ts +0 -53
  66. package/src/api/generic.ts +0 -63
  67. package/src/api/message.ts +0 -37
  68. package/src/components/Button.vue +0 -41
  69. package/src/components/Chat.vue +0 -96
  70. package/src/components/ChatWindow.vue +0 -123
  71. package/src/components/GetStarted.vue +0 -24
  72. package/src/components/GetStartedFooter.vue +0 -20
  73. package/src/components/Input.vue +0 -108
  74. package/src/components/Layout.vue +0 -99
  75. package/src/components/Message.vue +0 -137
  76. package/src/components/MessageTyping.vue +0 -110
  77. package/src/components/MessagesList.vue +0 -33
  78. package/src/components/PoweredBy.vue +0 -17
  79. package/src/composables/useChat.ts +0 -7
  80. package/src/composables/useI18n.ts +0 -21
  81. package/src/composables/useOptions.ts +0 -11
  82. package/src/constants/defaults.ts +0 -30
  83. package/src/constants/localStorage.ts +0 -2
  84. package/src/constants/symbols.ts +0 -8
  85. package/src/css/_tokens.scss +0 -38
  86. package/src/css/index.scss +0 -1
  87. package/src/event-buses/chatEventBus.ts +0 -3
  88. package/src/index.ts +0 -42
  89. package/src/main.scss +0 -5
  90. package/src/plugins/chat.ts +0 -115
  91. package/src/shims.d.ts +0 -6
  92. package/src/types/chat.ts +0 -12
  93. package/src/types/icons.d.ts +0 -5
  94. package/src/types/options.ts +0 -33
  95. package/src/types/webhook.ts +0 -18
  96. package/src/utils/event-bus.ts +0 -51
  97. package/src/utils/mount.ts +0 -16
  98. package/tsconfig.json +0 -27
  99. package/vite.config.mts +0 -53
  100. package/vitest.config.mts +0 -30
  101. /package/{src/__tests__/utils/index.ts → dist/__tests__/utils/index.d.ts} +0 -0
  102. /package/{src/api/index.ts → dist/api/index.d.ts} +0 -0
  103. /package/{src/components/index.ts → dist/components/index.d.ts} +0 -0
  104. /package/{src/composables/index.ts → dist/composables/index.d.ts} +0 -0
  105. /package/{src/constants/index.ts → dist/constants/index.d.ts} +0 -0
  106. /package/{src/event-buses/index.ts → dist/event-buses/index.d.ts} +0 -0
  107. /package/{public → dist}/favicon.ico +0 -0
  108. /package/{src/plugins/index.ts → dist/plugins/index.d.ts} +0 -0
  109. /package/{src/types/index.ts → dist/types/index.d.ts} +0 -0
  110. /package/{src/utils/index.ts → dist/utils/index.d.ts} +0 -0
@@ -0,0 +1,5 @@
1
+ import { InjectionKey } from 'vue';
2
+ import { Chat, ChatOptions } from '../types';
3
+
4
+ export declare const ChatSymbol: InjectionKey<Chat>;
5
+ export declare const ChatOptionsSymbol: InjectionKey<ChatOptions>;
@@ -0,0 +1 @@
1
+ export declare const chatEventBus: import('../utils').EventBus;
@@ -0,0 +1,3 @@
1
+ import { ChatOptions } from './types';
2
+
3
+ export declare function createChat(options?: Partial<ChatOptions>): import('vue').App<Element>;
@@ -0,0 +1,4 @@
1
+ import { Plugin } from 'vue';
2
+ import { ChatOptions } from '../types';
3
+
4
+ export declare const ChatPlugin: Plugin<ChatOptions>;
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
- type: 'component';
5
- key: string;
6
- arguments: T;
3
+ type: 'component';
4
+ key: string;
5
+ arguments: T;
7
6
  }
8
-
9
7
  export interface ChatMessageText extends ChatMessageBase {
10
- type?: 'text';
11
- text: string;
8
+ type?: 'text';
9
+ text: string;
12
10
  }
13
-
14
11
  interface ChatMessageBase {
15
- id: string;
16
- createdAt: string;
17
- transparent?: boolean;
18
- sender: 'user' | 'bot';
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.18.0",
4
- "main": "./chat.umd.js",
5
- "module": "./chat.es.js",
6
- "types": "./types/index.d.ts",
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": "./index.mjs",
10
- "require": "./index.js"
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
@@ -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,4 +0,0 @@
1
- import { sharedConfig } from '@n8n/storybook/main';
2
-
3
- const config = { ...sharedConfig };
4
- export default config;
@@ -1,4 +0,0 @@
1
- html, body, #storybook-root, #n8n-chat {
2
- width: 100%;
3
- height: 100%;
4
- }
@@ -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;
@@ -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
- }