diff --git a/app/javascript/dashboard/api/integrations/openapi.js b/app/javascript/dashboard/api/integrations/openapi.js index fb92bba0d..9f075a9ef 100644 --- a/app/javascript/dashboard/api/integrations/openapi.js +++ b/app/javascript/dashboard/api/integrations/openapi.js @@ -30,18 +30,12 @@ class OpenAIAPI extends ApiClient { 'reply_suggestion', 'label_suggestion', ]; - - /** - * The message events supported by the API. - * @type {string[]} - */ - this.message_events = ['rephrase']; } /** * Processes an event using the OpenAI API. * @param {Object} options - The options for the event. - * @param {string} [options.type='rephrase'] - The type of event to process. + * @param {string} [options.type='improve'] - The type of event to process. * @param {string} [options.content] - The content of the event. * @param {string} [options.tone] - The tone of the event. * @param {string} [options.conversationId] - The ID of the conversation to process the event for. @@ -50,7 +44,7 @@ class OpenAIAPI extends ApiClient { * @returns {Promise} A promise that resolves with the result of the event processing. */ processEvent( - { type = 'rephrase', content, tone, conversationId, hookId }, + { type = 'improve', content, tone, conversationId, hookId }, signal ) { /** diff --git a/app/javascript/dashboard/components/widgets/AIAssistanceModal.vue b/app/javascript/dashboard/components/widgets/AIAssistanceModal.vue index 04bba8f59..3cd945208 100644 --- a/app/javascript/dashboard/components/widgets/AIAssistanceModal.vue +++ b/app/javascript/dashboard/components/widgets/AIAssistanceModal.vue @@ -48,7 +48,7 @@ export default { this.$emit('close'); }, - async generateAIContent(type = 'rephrase') { + async generateAIContent(type = 'improve') { this.isGenerating = true; this.generatedContent = await this.processEvent(type); this.isGenerating = false; diff --git a/app/javascript/dashboard/components/widgets/WootWriter/CopilotMenuBar.vue b/app/javascript/dashboard/components/widgets/WootWriter/CopilotMenuBar.vue index d91b5bd5c..22dc5d0d2 100644 --- a/app/javascript/dashboard/components/widgets/WootWriter/CopilotMenuBar.vue +++ b/app/javascript/dashboard/components/widgets/WootWriter/CopilotMenuBar.vue @@ -163,10 +163,7 @@ const handleMenuItemClick = item => { }; const handleSubMenuItemClick = (parentItem, subItem) => { - emit('executeCopilotAction', subItem.key, { - parentKey: parentItem.key, - tone: subItem.label.toLowerCase(), - }); + emit('executeCopilotAction', subItem.key); }; diff --git a/app/javascript/dashboard/components/widgets/WootWriter/Editor.vue b/app/javascript/dashboard/components/widgets/WootWriter/Editor.vue index cde3630a3..2aa92fb5b 100644 --- a/app/javascript/dashboard/components/widgets/WootWriter/Editor.vue +++ b/app/javascript/dashboard/components/widgets/WootWriter/Editor.vue @@ -191,12 +191,12 @@ const imageUpload = useTemplateRef('imageUpload'); const editor = useTemplateRef('editor'); const handleCopilotAction = actionKey => { - if (actionKey === 'rephrase_selection' && editorView?.state) { + if (actionKey === 'improve_selection' && editorView?.state) { const { from, to } = editorView.state.selection; const selectedText = editorView.state.doc.textBetween(from, to).trim(); if (from !== to && selectedText) { - emit('executeCopilotAction', 'rephrase', selectedText); + emit('executeCopilotAction', 'improve', selectedText); } } else { emit('executeCopilotAction', actionKey); diff --git a/app/javascript/dashboard/composables/useAI.js b/app/javascript/dashboard/composables/useAI.js index ab94d7016..e950d8637 100644 --- a/app/javascript/dashboard/composables/useAI.js +++ b/app/javascript/dashboard/composables/useAI.js @@ -157,18 +157,14 @@ export function useAI() { }; /** - * Processes an AI event, such as rephrasing content. - * @param {string} [type='rephrase'] - The type of AI event to process. + * Processes an AI event, such as improving content. + * @param {string} [type='improve'] - The type of AI event to process. * @param {string} [content=''] - The content to process (for full message) or selected text (for selection-based). * @param {Object} [options={}] - Additional options. * @param {AbortSignal} [options.signal] - AbortSignal to cancel the request. * @returns {Promise} The generated message or an empty string if an error occurs. */ - const processEvent = async ( - type = 'rephrase', - content = '', - options = {} - ) => { + const processEvent = async (type = 'improve', content = '', options = {}) => { try { const result = await EditorAPI.processEvent( { diff --git a/app/javascript/dashboard/composables/useCopilotReply.js b/app/javascript/dashboard/composables/useCopilotReply.js index cd992574c..729fe82fa 100644 --- a/app/javascript/dashboard/composables/useCopilotReply.js +++ b/app/javascript/dashboard/composables/useCopilotReply.js @@ -55,7 +55,7 @@ export function useCopilotReply() { } /** - * Executes a copilot action (e.g., rephrase, fix grammar). + * Executes a copilot action (e.g., improve, fix grammar). * @param {string} action - The action type * @param {string} data - The content to process */ diff --git a/app/javascript/dashboard/helper/AnalyticsHelper/events.js b/app/javascript/dashboard/helper/AnalyticsHelper/events.js index 727316f1d..d5a98eb80 100644 --- a/app/javascript/dashboard/helper/AnalyticsHelper/events.js +++ b/app/javascript/dashboard/helper/AnalyticsHelper/events.js @@ -88,6 +88,7 @@ export const OPEN_AI_EVENTS = Object.freeze({ SUMMARIZE: 'OpenAI: Used summarize', REPLY_SUGGESTION: 'OpenAI: Used reply suggestion', REPHRASE: 'OpenAI: Used rephrase', + IMPROVE: 'OpenAI: Used improve', FIX_SPELLING_AND_GRAMMAR: 'OpenAI: Used fix spelling and grammar', SHORTEN: 'OpenAI: Used shorten', EXPAND: 'OpenAI: Used expand',