From 119ac7812cd72c7c3b87ae86c0544b0dfc84d58c Mon Sep 17 00:00:00 2001 From: iamsivin Date: Tue, 9 Dec 2025 15:54:31 +0530 Subject: [PATCH] feat: Reply Editor AI Changes --- .../dashboard/api/integrations/openapi.js | 20 +- .../dashboard/assets/scss/_next-colors.scss | 26 ++ .../components/widgets/AttachmentsPreview.vue | 4 +- .../widgets/WootWriter/CopilotEditor.vue | 246 +++++++++++++++ .../widgets/WootWriter/CopilotMenuBar.vue | 256 +++++++++++++++ .../WootWriter/CopilotReplyBottomPanel.vue | 49 +++ .../components/widgets/WootWriter/Editor.vue | 68 +++- .../widgets/WootWriter/EditorModeToggle.vue | 20 +- .../widgets/WootWriter/ReplyBottomPanel.vue | 11 +- .../widgets/WootWriter/ReplyTopPanel.vue | 75 ++++- .../conversation/CopilotEditorSection.vue | 106 +++++++ .../MessageSignatureMissingAlert.vue | 2 +- .../widgets/conversation/ReplyBox.vue | 292 +++++++++++------- app/javascript/dashboard/composables/useAI.js | 30 +- .../dashboard/composables/useCopilotReply.js | 122 ++++++++ app/javascript/dashboard/constants/editor.js | 27 +- .../i18n/locale/en/conversation.json | 3 +- .../i18n/locale/en/integrations.json | 18 ++ package.json | 1 + pnpm-lock.yaml | 10 + tailwind.config.js | 1 + theme/colors.js | 15 + 22 files changed, 1242 insertions(+), 160 deletions(-) create mode 100644 app/javascript/dashboard/components/widgets/WootWriter/CopilotEditor.vue create mode 100644 app/javascript/dashboard/components/widgets/WootWriter/CopilotMenuBar.vue create mode 100644 app/javascript/dashboard/components/widgets/WootWriter/CopilotReplyBottomPanel.vue create mode 100644 app/javascript/dashboard/components/widgets/conversation/CopilotEditorSection.vue create mode 100644 app/javascript/dashboard/composables/useCopilotReply.js diff --git a/app/javascript/dashboard/api/integrations/openapi.js b/app/javascript/dashboard/api/integrations/openapi.js index 3fcf241ee..fb92bba0d 100644 --- a/app/javascript/dashboard/api/integrations/openapi.js +++ b/app/javascript/dashboard/api/integrations/openapi.js @@ -46,9 +46,13 @@ class OpenAIAPI extends ApiClient { * @param {string} [options.tone] - The tone of the event. * @param {string} [options.conversationId] - The ID of the conversation to process the event for. * @param {string} options.hookId - The ID of the hook to use for processing the event. + * @param {AbortSignal} [signal] - AbortSignal to cancel the request. * @returns {Promise} A promise that resolves with the result of the event processing. */ - processEvent({ type = 'rephrase', content, tone, conversationId, hookId }) { + processEvent( + { type = 'rephrase', content, tone, conversationId, hookId }, + signal + ) { /** * @type {ConversationMessageData} */ @@ -69,12 +73,16 @@ class OpenAIAPI extends ApiClient { }; } - return axios.post(`${this.url}/hooks/${hookId}/process_event`, { - event: { - name: type, - data, + return axios.post( + `${this.url}/hooks/${hookId}/process_event`, + { + event: { + name: type, + data, + }, }, - }); + { signal } + ); } } diff --git a/app/javascript/dashboard/assets/scss/_next-colors.scss b/app/javascript/dashboard/assets/scss/_next-colors.scss index f23c01d42..4d7975a32 100644 --- a/app/javascript/dashboard/assets/scss/_next-colors.scss +++ b/app/javascript/dashboard/assets/scss/_next-colors.scss @@ -94,6 +94,19 @@ --gray-11: 100 100 100; --gray-12: 32 32 32; + --violet-1: 253 252 254; + --violet-2: 250 248 255; + --violet-3: 244 240 254; + --violet-4: 235 228 255; + --violet-5: 225 217 255; + --violet-6: 212 202 254; + --violet-7: 194 178 248; + --violet-8: 169 153 236; + --violet-9: 110 86 207; + --violet-10: 100 84 196; + --violet-11: 101 85 183; + --violet-12: 47 38 95; + --background-color: 253 253 253; --text-blue: 8 109 224; --border-container: 236 236 236; @@ -209,6 +222,19 @@ --gray-11: 180 180 180; --gray-12: 238 238 238; + --violet-1: 20 17 31; + --violet-2: 27 21 37; + --violet-3: 41 31 67; + --violet-4: 50 37 85; + --violet-5: 60 46 105; + --violet-6: 71 56 135; + --violet-7: 86 70 151; + --violet-8: 110 86 171; + --violet-9: 110 86 207; + --violet-10: 125 109 217; + --violet-11: 169 153 236; + --violet-12: 226 221 254; + --background-color: 18 18 19; --border-strong: 52 52 52; --border-weak: 38 38 42; diff --git a/app/javascript/dashboard/components/widgets/AttachmentsPreview.vue b/app/javascript/dashboard/components/widgets/AttachmentsPreview.vue index 75afb5263..c924dd65d 100644 --- a/app/javascript/dashboard/components/widgets/AttachmentsPreview.vue +++ b/app/javascript/dashboard/components/widgets/AttachmentsPreview.vue @@ -46,11 +46,11 @@ const fileName = file => {