From 491c6ec546c4ec8ab4eb88d020c13820071bf6dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milorad=20FIlipovi=C4=87?= Date: Tue, 7 May 2024 15:43:19 +0200 Subject: [PATCH] feat(editor): Implement AI Assistant chat UI (#9300) --- packages/@n8n/chat/README.md | 19 ++ packages/@n8n/chat/package.json | 2 +- packages/@n8n/chat/src/components/Chat.vue | 51 +++- packages/@n8n/chat/src/components/Input.vue | 26 +- packages/@n8n/chat/src/components/Layout.vue | 17 ++ packages/@n8n/chat/src/components/Message.vue | 36 ++- packages/@n8n/chat/src/composables/useI18n.ts | 7 +- packages/@n8n/chat/src/constants/defaults.ts | 1 + packages/@n8n/chat/src/css/_tokens.scss | 2 + packages/@n8n/chat/src/types/chat.ts | 4 +- packages/@n8n/chat/src/types/messages.ts | 17 +- packages/@n8n/chat/src/types/options.ts | 5 + packages/editor-ui/src/App.vue | 26 +- packages/editor-ui/src/Interface.ts | 15 ++ .../AIAssistantChat/AIAssistantChat.vue | 227 ++++++++++++++++++ .../AIAssistantChat/NextStepPopup.vue | 148 ++++++++++++ .../AIAssistantChat/QuickReplies.vue | 66 +++++ .../src/components/CanvasControls.vue | 1 - .../Node/NodeCreator/NodeCreator.vue | 17 +- packages/editor-ui/src/constants.ts | 19 +- .../editor-ui/src/n8n-theme-variables.scss | 1 + packages/editor-ui/src/n8n-theme.scss | 28 ++- .../src/plugins/i18n/locales/en.json | 20 ++ packages/editor-ui/src/stores/ai.store.ts | 54 ++++- packages/editor-ui/src/utils/typeGuards.ts | 4 + .../editor-ui/src/views/CanvasAddButton.vue | 2 +- packages/editor-ui/src/views/NodeView.vue | 141 +++++++++-- pnpm-lock.yaml | 185 ++++---------- 28 files changed, 948 insertions(+), 193 deletions(-) create mode 100644 packages/editor-ui/src/components/AIAssistantChat/AIAssistantChat.vue create mode 100644 packages/editor-ui/src/components/AIAssistantChat/NextStepPopup.vue create mode 100644 packages/editor-ui/src/components/AIAssistantChat/QuickReplies.vue diff --git a/packages/@n8n/chat/README.md b/packages/@n8n/chat/README.md index 2cb9babbf11f7..8055e9677761a 100644 --- a/packages/@n8n/chat/README.md +++ b/packages/@n8n/chat/README.md @@ -210,12 +210,31 @@ The Chat window is entirely customizable using CSS variables. --chat--window--width: 400px; --chat--window--height: 600px; + --chat--header-height: auto; + --chat--header--padding: var(--chat--spacing); + --chat--header--background: var(--chat--color-dark); + --chat--header--color: var(--chat--color-light); + --chat--header--border-top: none; + --chat--header--border-bottom: none; + --chat--header--border-bottom: none; + --chat--header--border-bottom: none; + --chat--heading--font-size: 2em; + --chat--header--color: var(--chat--color-light); + --chat--subtitle--font-size: inherit; + --chat--subtitle--line-height: 1.8; + --chat--textarea--height: 50px; + --chat--message--font-size: 1rem; + --chat--message--padding: var(--chat--spacing); + --chat--message--border-radius: var(--chat--border-radius); + --chat--message-line-height: 1.8; --chat--message--bot--background: var(--chat--color-white); --chat--message--bot--color: var(--chat--color-dark); + --chat--message--bot--border: none; --chat--message--user--background: var(--chat--color-secondary); --chat--message--user--color: var(--chat--color-white); + --chat--message--user--border: none; --chat--message--pre--background: rgba(0, 0, 0, 0.05); --chat--toggle--background: var(--chat--color-primary); diff --git a/packages/@n8n/chat/package.json b/packages/@n8n/chat/package.json index ed05c4a19a922..127b573b4e00a 100644 --- a/packages/@n8n/chat/package.json +++ b/packages/@n8n/chat/package.json @@ -42,7 +42,7 @@ "highlight.js": "^11.8.0", "markdown-it-link-attributes": "^4.0.1", "uuid": "^8.3.2", - "vue": "^3.3.4", + "vue": "^3.4.21", "vue-markdown-render": "^2.1.1" }, "devDependencies": { diff --git a/packages/@n8n/chat/src/components/Chat.vue b/packages/@n8n/chat/src/components/Chat.vue index e9a4476a98d79..c6b0a08618fab 100644 --- a/packages/@n8n/chat/src/components/Chat.vue +++ b/packages/@n8n/chat/src/components/Chat.vue @@ -1,5 +1,7 @@