@n8n/chat 0.5.2 → 0.6.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 +51 -0
- package/.np-config.json +5 -0
- package/.storybook/main.ts +27 -0
- package/.storybook/preview.scss +4 -0
- package/.storybook/preview.ts +16 -0
- package/.vscode/extensions.json +3 -0
- package/README.md +4 -21
- package/env.d.ts +1 -0
- package/index.html +13 -0
- package/package.json +2 -69
- package/resources/workflow.json +293 -0
- package/scripts/pack.js +11 -0
- package/scripts/postbuild.js +16 -0
- package/{App.vue → src/App.vue} +2 -2
- package/src/__stories__/App.stories.ts +43 -0
- package/src/__tests__/index.spec.ts +223 -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 +64 -0
- package/src/api/message.ts +31 -0
- package/src/components/Button.vue +41 -0
- package/{components → src/components}/Chat.vue +15 -19
- package/src/components/ChatWindow.vue +125 -0
- package/src/components/GetStarted.vue +24 -0
- package/{components → src/components}/GetStartedFooter.vue +4 -4
- package/{components → src/components}/Input.vue +40 -35
- package/src/components/Layout.vue +82 -0
- package/src/components/Message.vue +97 -0
- package/src/components/MessageTyping.vue +109 -0
- package/{components → src/components}/MessagesList.vue +8 -8
- 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 +25 -0
- package/{constants/localStorage.mjs → src/constants/localStorage.ts} +1 -1
- package/src/constants/symbols.ts +8 -0
- package/src/event-buses/chatEventBus.ts +3 -0
- package/src/index.ts +42 -0
- package/src/main.scss +40 -0
- package/src/plugins/chat.ts +101 -0
- package/src/types/chat.ts +12 -0
- package/src/types/messages.ts +6 -0
- package/src/types/options.ts +23 -0
- package/src/types/webhook.ts +17 -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 +51 -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 -10760
- package/chat.bundle.umd.js +0 -18
- package/components/Button.vue +0 -34
- package/components/ChatWindow.vue +0 -104
- package/components/GetStarted.vue +0 -24
- package/components/Layout.vue +0 -66
- package/components/Message.vue +0 -94
- 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 -85
- package/plugins/chat.mjs +0 -83
- 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/src/App.vue.d.ts +0 -8
- package/types/src/__stories__/App.stories.d.ts +0 -17
- package/types/src/__tests__/index.spec.d.ts +0 -1
- package/types/src/__tests__/setup.d.ts +0 -0
- package/types/src/__tests__/utils/create.d.ts +0 -5
- package/types/src/__tests__/utils/fetch.d.ts +0 -4
- package/types/src/__tests__/utils/index.d.ts +0 -3
- package/types/src/__tests__/utils/selectors.d.ts +0 -12
- package/types/src/api/generic.d.ts +0 -6
- package/types/src/api/index.d.ts +0 -2
- package/types/src/api/message.d.ts +0 -3
- package/types/src/components/Button.vue.d.ts +0 -9
- package/types/src/components/Chat.vue.d.ts +0 -2
- package/types/src/components/ChatWindow.vue.d.ts +0 -2
- package/types/src/components/GetStarted.vue.d.ts +0 -2
- package/types/src/components/GetStartedFooter.vue.d.ts +0 -2
- package/types/src/components/Input.vue.d.ts +0 -2
- package/types/src/components/Layout.vue.d.ts +0 -11
- package/types/src/components/Message.vue.d.ts +0 -21
- package/types/src/components/MessageTyping.vue.d.ts +0 -15
- package/types/src/components/MessagesList.vue.d.ts +0 -14
- package/types/src/components/PoweredBy.vue.d.ts +0 -2
- package/types/src/components/index.d.ts +0 -10
- package/types/src/composables/index.d.ts +0 -3
- package/types/src/composables/useChat.d.ts +0 -2
- package/types/src/composables/useI18n.d.ts +0 -4
- package/types/src/composables/useOptions.d.ts +0 -4
- package/types/src/constants/defaults.d.ts +0 -3
- package/types/src/constants/index.d.ts +0 -3
- package/types/src/constants/localStorage.d.ts +0 -2
- package/types/src/constants/symbols.d.ts +0 -4
- package/types/src/event-buses/chatEventBus.d.ts +0 -1
- package/types/src/event-buses/index.d.ts +0 -1
- package/types/src/index.d.ts +0 -2
- package/types/src/plugins/chat.d.ts +0 -3
- package/types/src/plugins/index.d.ts +0 -1
- package/types/src/types/chat.d.ts +0 -11
- package/types/src/types/index.d.ts +0 -4
- package/types/src/types/messages.d.ts +0 -6
- package/types/src/types/options.d.ts +0 -25
- package/types/src/types/webhook.d.ts +0 -15
- package/types/src/utils/event-bus.d.ts +0 -8
- package/types/src/utils/mount.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 -15
- package/types/utils/event-bus.d.ts +0 -8
- package/types/utils/index.d.ts +0 -2
- package/types/utils/mount.d.ts +0 -1
- package/types/webhook.d.ts +0 -15
- 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/{__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/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/src/utils/index.d.ts → src/utils/index.ts} +0 -0
package/constants/defaults.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.defaultOptions = exports.defaultMountingTarget = void 0;
|
|
7
|
-
const defaultOptions = exports.defaultOptions = {
|
|
8
|
-
webhookUrl: "http://localhost:5678",
|
|
9
|
-
webhookConfig: {
|
|
10
|
-
method: "POST",
|
|
11
|
-
headers: {}
|
|
12
|
-
},
|
|
13
|
-
target: "#n8n-chat",
|
|
14
|
-
mode: "window",
|
|
15
|
-
loadPreviousSession: true,
|
|
16
|
-
chatInputKey: "chatInput",
|
|
17
|
-
chatSessionKey: "sessionId",
|
|
18
|
-
defaultLanguage: "en",
|
|
19
|
-
showWelcomeScreen: false,
|
|
20
|
-
initialMessages: ["Hi there! \u{1F44B}", "My name is Nathan. How can I assist you today?"],
|
|
21
|
-
i18n: {
|
|
22
|
-
en: {
|
|
23
|
-
title: "Hi there! \u{1F44B}",
|
|
24
|
-
subtitle: "Start a chat. We're here to help you 24/7.",
|
|
25
|
-
footer: "",
|
|
26
|
-
getStarted: "New Conversation",
|
|
27
|
-
inputPlaceholder: "Type your question.."
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
theme: {}
|
|
31
|
-
};
|
|
32
|
-
const defaultMountingTarget = exports.defaultMountingTarget = "#n8n-chat";
|
package/constants/defaults.mjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export const defaultOptions = {
|
|
2
|
-
webhookUrl: "http://localhost:5678",
|
|
3
|
-
webhookConfig: {
|
|
4
|
-
method: "POST",
|
|
5
|
-
headers: {}
|
|
6
|
-
},
|
|
7
|
-
target: "#n8n-chat",
|
|
8
|
-
mode: "window",
|
|
9
|
-
loadPreviousSession: true,
|
|
10
|
-
chatInputKey: "chatInput",
|
|
11
|
-
chatSessionKey: "sessionId",
|
|
12
|
-
defaultLanguage: "en",
|
|
13
|
-
showWelcomeScreen: false,
|
|
14
|
-
initialMessages: ["Hi there! \u{1F44B}", "My name is Nathan. How can I assist you today?"],
|
|
15
|
-
i18n: {
|
|
16
|
-
en: {
|
|
17
|
-
title: "Hi there! \u{1F44B}",
|
|
18
|
-
subtitle: "Start a chat. We're here to help you 24/7.",
|
|
19
|
-
footer: "",
|
|
20
|
-
getStarted: "New Conversation",
|
|
21
|
-
inputPlaceholder: "Type your question.."
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
theme: {}
|
|
25
|
-
};
|
|
26
|
-
export const defaultMountingTarget = "#n8n-chat";
|
package/constants/index.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _defaults = require("./defaults");
|
|
7
|
-
Object.keys(_defaults).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _defaults[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _defaults[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _localStorage = require("./localStorage");
|
|
18
|
-
Object.keys(_localStorage).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _localStorage[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _localStorage[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _symbols = require("./symbols");
|
|
29
|
-
Object.keys(_symbols).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _symbols[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _symbols[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
package/constants/index.mjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.localStorageSessionIdKey = exports.localStorageNamespace = void 0;
|
|
7
|
-
const localStorageNamespace = exports.localStorageNamespace = "n8n-chat";
|
|
8
|
-
const localStorageSessionIdKey = exports.localStorageSessionIdKey = `${localStorageNamespace}/sessionId`;
|
package/constants/symbols.d.ts
DELETED
package/constants/symbols.js
DELETED
package/constants/symbols.mjs
DELETED
package/css/index.css
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--chat--color-primary: #e74266;
|
|
3
|
-
--chat--color-primary-shade-50: #db4061;
|
|
4
|
-
--chat--color-primary-shade-100: #cf3c5c;
|
|
5
|
-
--chat--color-secondary: #20b69e;
|
|
6
|
-
--chat--color-secondary-shade-50: #1ca08a;
|
|
7
|
-
--chat--color-white: #ffffff;
|
|
8
|
-
--chat--color-light: #f2f4f8;
|
|
9
|
-
--chat--color-light-shade-50: #e6e9f1;
|
|
10
|
-
--chat--color-light-shade-100: #c2c5cc;
|
|
11
|
-
--chat--color-medium: #d2d4d9;
|
|
12
|
-
--chat--color-dark: #101330;
|
|
13
|
-
--chat--color-disabled: #777980;
|
|
14
|
-
--chat--color-typing: #404040;
|
|
15
|
-
--chat--spacing: 1rem;
|
|
16
|
-
--chat--border-radius: 0.25rem;
|
|
17
|
-
--chat--transition-duration: 0.15s;
|
|
18
|
-
--chat--window--width: 400px;
|
|
19
|
-
--chat--window--height: 600px;
|
|
20
|
-
--chat--textarea--height: 50px;
|
|
21
|
-
--chat--message--bot--background: var(--chat--color-white);
|
|
22
|
-
--chat--message--bot--color: var(--chat--color-dark);
|
|
23
|
-
--chat--message--user--background: var(--chat--color-secondary);
|
|
24
|
-
--chat--message--user--color: var(--chat--color-white);
|
|
25
|
-
--chat--message--pre--background: rgba(0, 0, 0, 0.05);
|
|
26
|
-
--chat--toggle--background: var(--chat--color-primary);
|
|
27
|
-
--chat--toggle--hover--background: var(--chat--color-primary-shade-50);
|
|
28
|
-
--chat--toggle--active--background: var(--chat--color-primary-shade-100);
|
|
29
|
-
--chat--toggle--color: var(--chat--color-white);
|
|
30
|
-
--chat--toggle--size: 64px;
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const chatEventBus: any;
|
package/event-buses/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _chatEventBus = require("./chatEventBus");
|
|
7
|
-
Object.keys(_chatEventBus).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _chatEventBus[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _chatEventBus[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
package/event-buses/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./chatEventBus.mjs";
|
package/index.d.ts
DELETED
package/index.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createChat = createChat;
|
|
7
|
-
require("./main.scss");
|
|
8
|
-
var _vue = require("vue");
|
|
9
|
-
var _App = _interopRequireDefault(require("./App.vue"));
|
|
10
|
-
var _constants = require("@n8n/chat/constants");
|
|
11
|
-
var _utils = require("@n8n/chat/utils");
|
|
12
|
-
var _plugins = require("@n8n/chat/plugins");
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
function createChat(options) {
|
|
15
|
-
const resolvedOptions = {
|
|
16
|
-
..._constants.defaultOptions,
|
|
17
|
-
...options,
|
|
18
|
-
webhookConfig: {
|
|
19
|
-
..._constants.defaultOptions.webhookConfig,
|
|
20
|
-
...options?.webhookConfig
|
|
21
|
-
},
|
|
22
|
-
i18n: {
|
|
23
|
-
..._constants.defaultOptions.i18n,
|
|
24
|
-
...options?.i18n,
|
|
25
|
-
en: {
|
|
26
|
-
..._constants.defaultOptions.i18n?.en,
|
|
27
|
-
...options?.i18n?.en
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
theme: {
|
|
31
|
-
..._constants.defaultOptions.theme,
|
|
32
|
-
...options?.theme
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const mountingTarget = resolvedOptions.target ?? _constants.defaultMountingTarget;
|
|
36
|
-
if (typeof mountingTarget === "string") {
|
|
37
|
-
(0, _utils.createDefaultMountingTarget)(mountingTarget);
|
|
38
|
-
}
|
|
39
|
-
const app = (0, _vue.createApp)(_App.default);
|
|
40
|
-
app.use(_plugins.ChatPlugin, resolvedOptions);
|
|
41
|
-
app.mount(mountingTarget);
|
|
42
|
-
return app;
|
|
43
|
-
}
|
package/index.mjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import "./main.scss";
|
|
2
|
-
import { createApp } from "vue";
|
|
3
|
-
import App from "./App.vue";
|
|
4
|
-
import { defaultMountingTarget, defaultOptions } from "@n8n/chat/constants";
|
|
5
|
-
import { createDefaultMountingTarget } from "@n8n/chat/utils";
|
|
6
|
-
import { ChatPlugin } from "@n8n/chat/plugins";
|
|
7
|
-
export function createChat(options) {
|
|
8
|
-
const resolvedOptions = {
|
|
9
|
-
...defaultOptions,
|
|
10
|
-
...options,
|
|
11
|
-
webhookConfig: {
|
|
12
|
-
...defaultOptions.webhookConfig,
|
|
13
|
-
...options?.webhookConfig
|
|
14
|
-
},
|
|
15
|
-
i18n: {
|
|
16
|
-
...defaultOptions.i18n,
|
|
17
|
-
...options?.i18n,
|
|
18
|
-
en: {
|
|
19
|
-
...defaultOptions.i18n?.en,
|
|
20
|
-
...options?.i18n?.en
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
theme: {
|
|
24
|
-
...defaultOptions.theme,
|
|
25
|
-
...options?.theme
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const mountingTarget = resolvedOptions.target ?? defaultMountingTarget;
|
|
29
|
-
if (typeof mountingTarget === "string") {
|
|
30
|
-
createDefaultMountingTarget(mountingTarget);
|
|
31
|
-
}
|
|
32
|
-
const app = createApp(App);
|
|
33
|
-
app.use(ChatPlugin, resolvedOptions);
|
|
34
|
-
app.mount(mountingTarget);
|
|
35
|
-
return app;
|
|
36
|
-
}
|
package/main.css
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
.n8n-chat {
|
|
2
|
-
/*!
|
|
3
|
-
Theme: GitHub
|
|
4
|
-
Description: Light theme as seen on github.com
|
|
5
|
-
Author: github.com
|
|
6
|
-
Maintainer: @Hirse
|
|
7
|
-
Updated: 2021-05-15
|
|
8
|
-
|
|
9
|
-
Outdated base version: https://github.com/primer/github-syntax-light
|
|
10
|
-
Current colors taken from GitHub's CSS
|
|
11
|
-
*/
|
|
12
|
-
}
|
|
13
|
-
.n8n-chat pre code.hljs {
|
|
14
|
-
display: block;
|
|
15
|
-
overflow-x: auto;
|
|
16
|
-
padding: 1em;
|
|
17
|
-
}
|
|
18
|
-
.n8n-chat code.hljs {
|
|
19
|
-
padding: 3px 5px;
|
|
20
|
-
}
|
|
21
|
-
.n8n-chat .hljs {
|
|
22
|
-
color: #24292e;
|
|
23
|
-
background: #ffffff;
|
|
24
|
-
}
|
|
25
|
-
.n8n-chat .hljs-doctag,
|
|
26
|
-
.n8n-chat .hljs-keyword,
|
|
27
|
-
.n8n-chat .hljs-meta .hljs-keyword,
|
|
28
|
-
.n8n-chat .hljs-template-tag,
|
|
29
|
-
.n8n-chat .hljs-template-variable,
|
|
30
|
-
.n8n-chat .hljs-type,
|
|
31
|
-
.n8n-chat .hljs-variable.language_ {
|
|
32
|
-
/* prettylights-syntax-keyword */
|
|
33
|
-
color: #d73a49;
|
|
34
|
-
}
|
|
35
|
-
.n8n-chat .hljs-title,
|
|
36
|
-
.n8n-chat .hljs-title.class_,
|
|
37
|
-
.n8n-chat .hljs-title.class_.inherited__,
|
|
38
|
-
.n8n-chat .hljs-title.function_ {
|
|
39
|
-
/* prettylights-syntax-entity */
|
|
40
|
-
color: #6f42c1;
|
|
41
|
-
}
|
|
42
|
-
.n8n-chat .hljs-attr,
|
|
43
|
-
.n8n-chat .hljs-attribute,
|
|
44
|
-
.n8n-chat .hljs-literal,
|
|
45
|
-
.n8n-chat .hljs-meta,
|
|
46
|
-
.n8n-chat .hljs-number,
|
|
47
|
-
.n8n-chat .hljs-operator,
|
|
48
|
-
.n8n-chat .hljs-variable,
|
|
49
|
-
.n8n-chat .hljs-selector-attr,
|
|
50
|
-
.n8n-chat .hljs-selector-class,
|
|
51
|
-
.n8n-chat .hljs-selector-id {
|
|
52
|
-
/* prettylights-syntax-constant */
|
|
53
|
-
color: #005cc5;
|
|
54
|
-
}
|
|
55
|
-
.n8n-chat .hljs-regexp,
|
|
56
|
-
.n8n-chat .hljs-string,
|
|
57
|
-
.n8n-chat .hljs-meta .hljs-string {
|
|
58
|
-
/* prettylights-syntax-string */
|
|
59
|
-
color: #032f62;
|
|
60
|
-
}
|
|
61
|
-
.n8n-chat .hljs-built_in,
|
|
62
|
-
.n8n-chat .hljs-symbol {
|
|
63
|
-
/* prettylights-syntax-variable */
|
|
64
|
-
color: #e36209;
|
|
65
|
-
}
|
|
66
|
-
.n8n-chat .hljs-comment,
|
|
67
|
-
.n8n-chat .hljs-code,
|
|
68
|
-
.n8n-chat .hljs-formula {
|
|
69
|
-
/* prettylights-syntax-comment */
|
|
70
|
-
color: #6a737d;
|
|
71
|
-
}
|
|
72
|
-
.n8n-chat .hljs-name,
|
|
73
|
-
.n8n-chat .hljs-quote,
|
|
74
|
-
.n8n-chat .hljs-selector-tag,
|
|
75
|
-
.n8n-chat .hljs-selector-pseudo {
|
|
76
|
-
/* prettylights-syntax-entity-tag */
|
|
77
|
-
color: #22863a;
|
|
78
|
-
}
|
|
79
|
-
.n8n-chat .hljs-subst {
|
|
80
|
-
/* prettylights-syntax-storage-modifier-import */
|
|
81
|
-
color: #24292e;
|
|
82
|
-
}
|
|
83
|
-
.n8n-chat .hljs-section {
|
|
84
|
-
/* prettylights-syntax-markup-heading */
|
|
85
|
-
color: #005cc5;
|
|
86
|
-
font-weight: bold;
|
|
87
|
-
}
|
|
88
|
-
.n8n-chat .hljs-bullet {
|
|
89
|
-
/* prettylights-syntax-markup-list */
|
|
90
|
-
color: #735c0f;
|
|
91
|
-
}
|
|
92
|
-
.n8n-chat .hljs-emphasis {
|
|
93
|
-
/* prettylights-syntax-markup-italic */
|
|
94
|
-
color: #24292e;
|
|
95
|
-
font-style: italic;
|
|
96
|
-
}
|
|
97
|
-
.n8n-chat .hljs-strong {
|
|
98
|
-
/* prettylights-syntax-markup-bold */
|
|
99
|
-
color: #24292e;
|
|
100
|
-
font-weight: bold;
|
|
101
|
-
}
|
|
102
|
-
.n8n-chat .hljs-addition {
|
|
103
|
-
/* prettylights-syntax-markup-inserted */
|
|
104
|
-
color: #22863a;
|
|
105
|
-
background-color: #f0fff4;
|
|
106
|
-
}
|
|
107
|
-
.n8n-chat .hljs-deletion {
|
|
108
|
-
/* prettylights-syntax-markup-deleted */
|
|
109
|
-
color: #b31d28;
|
|
110
|
-
background-color: #ffeef0;
|
|
111
|
-
}
|
|
112
|
-
.n8n-chat .hljs-char.escape_,
|
|
113
|
-
.n8n-chat .hljs-link,
|
|
114
|
-
.n8n-chat .hljs-params,
|
|
115
|
-
.n8n-chat .hljs-property,
|
|
116
|
-
.n8n-chat .hljs-punctuation,
|
|
117
|
-
.n8n-chat .hljs-tag {
|
|
118
|
-
/* purposely ignored */
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
:root {
|
|
122
|
-
--chat--color-primary: #e74266;
|
|
123
|
-
--chat--color-primary-shade-50: #db4061;
|
|
124
|
-
--chat--color-primary-shade-100: #cf3c5c;
|
|
125
|
-
--chat--color-secondary: #20b69e;
|
|
126
|
-
--chat--color-secondary-shade-50: #1ca08a;
|
|
127
|
-
--chat--color-white: #ffffff;
|
|
128
|
-
--chat--color-light: #f2f4f8;
|
|
129
|
-
--chat--color-light-shade-50: #e6e9f1;
|
|
130
|
-
--chat--color-light-shade-100: #c2c5cc;
|
|
131
|
-
--chat--color-medium: #d2d4d9;
|
|
132
|
-
--chat--color-dark: #101330;
|
|
133
|
-
--chat--color-disabled: #777980;
|
|
134
|
-
--chat--color-typing: #404040;
|
|
135
|
-
--chat--spacing: 1rem;
|
|
136
|
-
--chat--border-radius: 0.25rem;
|
|
137
|
-
--chat--transition-duration: 0.15s;
|
|
138
|
-
--chat--window--width: 400px;
|
|
139
|
-
--chat--window--height: 600px;
|
|
140
|
-
--chat--textarea--height: 50px;
|
|
141
|
-
--chat--message--bot--background: var(--chat--color-white);
|
|
142
|
-
--chat--message--bot--color: var(--chat--color-dark);
|
|
143
|
-
--chat--message--user--background: var(--chat--color-secondary);
|
|
144
|
-
--chat--message--user--color: var(--chat--color-white);
|
|
145
|
-
--chat--message--pre--background: rgba(0, 0, 0, 0.05);
|
|
146
|
-
--chat--toggle--background: var(--chat--color-primary);
|
|
147
|
-
--chat--toggle--hover--background: var(--chat--color-primary-shade-50);
|
|
148
|
-
--chat--toggle--active--background: var(--chat--color-primary-shade-100);
|
|
149
|
-
--chat--toggle--color: var(--chat--color-white);
|
|
150
|
-
--chat--toggle--size: 64px;
|
|
151
|
-
}
|
package/plugins/chat.d.ts
DELETED
package/plugins/chat.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ChatPlugin = void 0;
|
|
7
|
-
var _vue = require("vue");
|
|
8
|
-
var _uuid = require("uuid");
|
|
9
|
-
var _eventBuses = require("@n8n/chat/event-buses");
|
|
10
|
-
var api = _interopRequireWildcard(require("@n8n/chat/api"));
|
|
11
|
-
var _constants = require("@n8n/chat/constants");
|
|
12
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
-
const ChatPlugin = exports.ChatPlugin = {
|
|
15
|
-
install(app, options) {
|
|
16
|
-
app.provide(_constants.ChatOptionsSymbol, options);
|
|
17
|
-
const messages = (0, _vue.ref)([]);
|
|
18
|
-
const currentSessionId = (0, _vue.ref)(null);
|
|
19
|
-
const waitingForResponse = (0, _vue.ref)(false);
|
|
20
|
-
const initialMessages = (0, _vue.computed)(() => (options.initialMessages ?? []).map(text => ({
|
|
21
|
-
id: (0, _uuid.v4)(),
|
|
22
|
-
text,
|
|
23
|
-
sender: "bot",
|
|
24
|
-
createdAt: /* @__PURE__ */new Date().toISOString()
|
|
25
|
-
})));
|
|
26
|
-
async function sendMessage(text) {
|
|
27
|
-
const sentMessage = {
|
|
28
|
-
id: (0, _uuid.v4)(),
|
|
29
|
-
text,
|
|
30
|
-
sender: "user",
|
|
31
|
-
createdAt: /* @__PURE__ */new Date().toISOString()
|
|
32
|
-
};
|
|
33
|
-
messages.value.push(sentMessage);
|
|
34
|
-
waitingForResponse.value = true;
|
|
35
|
-
void (0, _vue.nextTick)(() => {
|
|
36
|
-
_eventBuses.chatEventBus.emit("scrollToBottom");
|
|
37
|
-
});
|
|
38
|
-
const sendMessageResponse = await api.sendMessage(text, currentSessionId.value, options);
|
|
39
|
-
const receivedMessage = {
|
|
40
|
-
id: (0, _uuid.v4)(),
|
|
41
|
-
text: sendMessageResponse.output,
|
|
42
|
-
sender: "bot",
|
|
43
|
-
createdAt: /* @__PURE__ */new Date().toISOString()
|
|
44
|
-
};
|
|
45
|
-
messages.value.push(receivedMessage);
|
|
46
|
-
waitingForResponse.value = false;
|
|
47
|
-
void (0, _vue.nextTick)(() => {
|
|
48
|
-
_eventBuses.chatEventBus.emit("scrollToBottom");
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
async function loadPreviousSession() {
|
|
52
|
-
if (!options.loadPreviousSession) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const sessionId = localStorage.getItem(_constants.localStorageSessionIdKey) ?? (0, _uuid.v4)();
|
|
56
|
-
const previousMessagesResponse = await api.loadPreviousSession(sessionId, options);
|
|
57
|
-
const timestamp = /* @__PURE__ */new Date().toISOString();
|
|
58
|
-
messages.value = (previousMessagesResponse?.data || []).map((message, index) => ({
|
|
59
|
-
id: `${index}`,
|
|
60
|
-
text: message.kwargs.content,
|
|
61
|
-
sender: message.id.includes("HumanMessage") ? "user" : "bot",
|
|
62
|
-
createdAt: timestamp
|
|
63
|
-
}));
|
|
64
|
-
if (messages.value.length) {
|
|
65
|
-
currentSessionId.value = sessionId;
|
|
66
|
-
}
|
|
67
|
-
return sessionId;
|
|
68
|
-
}
|
|
69
|
-
async function startNewSession() {
|
|
70
|
-
currentSessionId.value = (0, _uuid.v4)();
|
|
71
|
-
localStorage.setItem(_constants.localStorageSessionIdKey, currentSessionId.value);
|
|
72
|
-
}
|
|
73
|
-
const chatStore = {
|
|
74
|
-
initialMessages,
|
|
75
|
-
messages,
|
|
76
|
-
currentSessionId,
|
|
77
|
-
waitingForResponse,
|
|
78
|
-
loadPreviousSession,
|
|
79
|
-
startNewSession,
|
|
80
|
-
sendMessage
|
|
81
|
-
};
|
|
82
|
-
app.provide(_constants.ChatSymbol, chatStore);
|
|
83
|
-
app.config.globalProperties.$chat = chatStore;
|
|
84
|
-
}
|
|
85
|
-
};
|
package/plugins/chat.mjs
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { computed, nextTick, ref } from "vue";
|
|
2
|
-
import { v4 as uuidv4 } from "uuid";
|
|
3
|
-
import { chatEventBus } from "@n8n/chat/event-buses";
|
|
4
|
-
import * as api from "@n8n/chat/api";
|
|
5
|
-
import { ChatOptionsSymbol, ChatSymbol, localStorageSessionIdKey } from "@n8n/chat/constants";
|
|
6
|
-
export const ChatPlugin = {
|
|
7
|
-
install(app, options) {
|
|
8
|
-
app.provide(ChatOptionsSymbol, options);
|
|
9
|
-
const messages = ref([]);
|
|
10
|
-
const currentSessionId = ref(null);
|
|
11
|
-
const waitingForResponse = ref(false);
|
|
12
|
-
const initialMessages = computed(
|
|
13
|
-
() => (options.initialMessages ?? []).map((text) => ({
|
|
14
|
-
id: uuidv4(),
|
|
15
|
-
text,
|
|
16
|
-
sender: "bot",
|
|
17
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
18
|
-
}))
|
|
19
|
-
);
|
|
20
|
-
async function sendMessage(text) {
|
|
21
|
-
const sentMessage = {
|
|
22
|
-
id: uuidv4(),
|
|
23
|
-
text,
|
|
24
|
-
sender: "user",
|
|
25
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
26
|
-
};
|
|
27
|
-
messages.value.push(sentMessage);
|
|
28
|
-
waitingForResponse.value = true;
|
|
29
|
-
void nextTick(() => {
|
|
30
|
-
chatEventBus.emit("scrollToBottom");
|
|
31
|
-
});
|
|
32
|
-
const sendMessageResponse = await api.sendMessage(
|
|
33
|
-
text,
|
|
34
|
-
currentSessionId.value,
|
|
35
|
-
options
|
|
36
|
-
);
|
|
37
|
-
const receivedMessage = {
|
|
38
|
-
id: uuidv4(),
|
|
39
|
-
text: sendMessageResponse.output,
|
|
40
|
-
sender: "bot",
|
|
41
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
42
|
-
};
|
|
43
|
-
messages.value.push(receivedMessage);
|
|
44
|
-
waitingForResponse.value = false;
|
|
45
|
-
void nextTick(() => {
|
|
46
|
-
chatEventBus.emit("scrollToBottom");
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
async function loadPreviousSession() {
|
|
50
|
-
if (!options.loadPreviousSession) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
const sessionId = localStorage.getItem(localStorageSessionIdKey) ?? uuidv4();
|
|
54
|
-
const previousMessagesResponse = await api.loadPreviousSession(sessionId, options);
|
|
55
|
-
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
56
|
-
messages.value = (previousMessagesResponse?.data || []).map((message, index) => ({
|
|
57
|
-
id: `${index}`,
|
|
58
|
-
text: message.kwargs.content,
|
|
59
|
-
sender: message.id.includes("HumanMessage") ? "user" : "bot",
|
|
60
|
-
createdAt: timestamp
|
|
61
|
-
}));
|
|
62
|
-
if (messages.value.length) {
|
|
63
|
-
currentSessionId.value = sessionId;
|
|
64
|
-
}
|
|
65
|
-
return sessionId;
|
|
66
|
-
}
|
|
67
|
-
async function startNewSession() {
|
|
68
|
-
currentSessionId.value = uuidv4();
|
|
69
|
-
localStorage.setItem(localStorageSessionIdKey, currentSessionId.value);
|
|
70
|
-
}
|
|
71
|
-
const chatStore = {
|
|
72
|
-
initialMessages,
|
|
73
|
-
messages,
|
|
74
|
-
currentSessionId,
|
|
75
|
-
waitingForResponse,
|
|
76
|
-
loadPreviousSession,
|
|
77
|
-
startNewSession,
|
|
78
|
-
sendMessage
|
|
79
|
-
};
|
|
80
|
-
app.provide(ChatSymbol, chatStore);
|
|
81
|
-
app.config.globalProperties.$chat = chatStore;
|
|
82
|
-
}
|
|
83
|
-
};
|
package/plugins/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _chat = require("./chat");
|
|
7
|
-
Object.keys(_chat).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _chat[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _chat[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
package/plugins/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./chat.mjs";
|
package/style.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
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:#ffffff}.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-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{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))}.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%;padding:var(--chat--message--padding, var(--chat--spacing));border-radius:var(--chat--message--border-radius, var(--chat--border-radius))}.chat-message+.chat-message{margin-top:var(--chat--message--margin-bottom, calc(var(--chat--spacing) * .5))}.chat-message.chat-message-from-bot{background-color:var(--chat--message--bot--background);color:var(--chat--message--bot--color);border-bottom-left-radius:0}.chat-message.chat-message-from-user{background-color:var(--chat--message--user--background);color:var(--chat--message--user--color);margin-left:auto;border-bottom-right-radius:0}.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%}.chat-input textarea{font-family:inherit;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:white;cursor:pointer;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-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}
|
package/types/App.vue.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<Readonly<import("vue").ComponentPropsOptions<{
|
|
2
|
-
[x: string]: unknown;
|
|
3
|
-
}>>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, readonly string[] | Readonly<import("vue").ExtractPropTypes<Readonly<import("vue").ComponentObjectPropsOptions<{
|
|
4
|
-
[x: string]: unknown;
|
|
5
|
-
}>>>>, {
|
|
6
|
-
readonly [x: number]: string;
|
|
7
|
-
} | {}, {}>;
|
|
8
|
-
export default _default;
|