From 630826baed7a604ded1a456f85d97241ef41de6c Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Wed, 16 Apr 2025 05:32:49 -0700 Subject: [PATCH] feat: Implement UI for Agent Bots in settings and remove CSML support (#11276) - Add agent bots management UI in settings with avatar upload - Enable agent bot configuration for all inbox types - Implement proper CRUD operations with webhook URL support - Fix agent bots menu item visibility in settings sidebar - Remove all CSML-related code and features - Add migration to convert existing CSML bots to webhook bots - Simplify agent bot model and services to focus on webhook bots - Improve UI to differentiate between system bots and account bots ## Video https://github.com/user-attachments/assets/3f4edbb7-b758-468c-8dd6-a9537b983f7d --------- Co-authored-by: iamsivin Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: Muhsin Keloth Co-authored-by: Pranav --- .../api/v1/accounts/agent_bots_controller.rb | 2 +- app/controllers/dashboard_controller.rb | 2 +- app/javascript/dashboard/api/agentBots.js | 17 ++ .../components-next/dialog/Dialog.vue | 5 +- .../layout/config/sidebarItems/settings.js | 1 - .../sidebarComponents/SecondaryNavItem.vue | 7 - .../dashboard/i18n/locale/en/agentBots.json | 75 ++++-- .../dashboard/settings/agentBots/Index.vue | 205 ++++++++++---- .../settings/agentBots/agentBot.routes.js | 34 --- .../agentBots/components/AgentBotModal.vue | 251 ++++++++++++++++++ .../agentBots/components/AgentBotRow.vue | 59 ---- .../agentBots/components/AgentBotType.vue | 36 --- .../agentBots/components/CSMLBotEditor.vue | 99 ------- .../agentBots/components/CSMLMonacoEditor.vue | 71 ----- .../settings/agentBots/csml/Edit.vue | 40 --- .../dashboard/settings/agentBots/csml/New.vue | 41 --- .../dashboard/settings/inbox/Settings.vue | 6 +- .../dashboard/store/modules/agentBots.js | 55 +++- .../modules/specs/agentBots/agentBots.spec.js | 29 +- .../store/modules/specs/agentBots/fixtures.js | 24 +- .../modules/specs/agentBots/mutations.spec.js | 12 + .../dashboard/store/mutation-types.js | 1 + app/javascript/shared/store/globalConfig.js | 2 - app/jobs/agent_bots/csml_job.rb | 10 - app/listeners/agent_bot_listener.rb | 16 +- app/models/agent_bot.rb | 9 +- .../agent_bots/validate_bot_service.rb | 38 --- .../api/v1/models/_agent_bot.json.jbuilder | 4 +- config/features.yml | 2 +- ...61725_convert_csml_bots_to_webhook_bots.rb | 13 + db/schema.rb | 2 +- lib/csml_engine.rb | 52 ---- lib/integrations/bot_processor_service.rb | 1 - lib/integrations/csml/processor_service.rb | 142 ---------- .../v1/accounts/agent_bots_controller_spec.rb | 34 ++- spec/jobs/agent_bots/csml_job_spec.rb | 19 -- spec/lib/csml_engine_spec.rb | 99 ------- .../csml/processor_service_spec.rb | 108 -------- spec/listeners/agent_bot_listener_spec.rb | 9 - spec/models/agent_bot_spec.rb | 19 ++ .../agent_bots/validate_bot_service_spec.rb | 25 -- 41 files changed, 657 insertions(+), 1019 deletions(-) create mode 100644 app/javascript/dashboard/routes/dashboard/settings/agentBots/components/AgentBotModal.vue delete mode 100644 app/javascript/dashboard/routes/dashboard/settings/agentBots/components/AgentBotRow.vue delete mode 100644 app/javascript/dashboard/routes/dashboard/settings/agentBots/components/AgentBotType.vue delete mode 100644 app/javascript/dashboard/routes/dashboard/settings/agentBots/components/CSMLBotEditor.vue delete mode 100644 app/javascript/dashboard/routes/dashboard/settings/agentBots/components/CSMLMonacoEditor.vue delete mode 100644 app/javascript/dashboard/routes/dashboard/settings/agentBots/csml/Edit.vue delete mode 100644 app/javascript/dashboard/routes/dashboard/settings/agentBots/csml/New.vue delete mode 100644 app/jobs/agent_bots/csml_job.rb delete mode 100644 app/services/agent_bots/validate_bot_service.rb create mode 100644 db/migrate/20250410061725_convert_csml_bots_to_webhook_bots.rb delete mode 100644 lib/csml_engine.rb delete mode 100644 lib/integrations/csml/processor_service.rb delete mode 100644 spec/jobs/agent_bots/csml_job_spec.rb delete mode 100644 spec/lib/csml_engine_spec.rb delete mode 100644 spec/lib/integrations/csml/processor_service_spec.rb delete mode 100644 spec/services/agent_bots/validate_bot_service_spec.rb diff --git a/app/controllers/api/v1/accounts/agent_bots_controller.rb b/app/controllers/api/v1/accounts/agent_bots_controller.rb index 43bce17bc..1422beea1 100644 --- a/app/controllers/api/v1/accounts/agent_bots_controller.rb +++ b/app/controllers/api/v1/accounts/agent_bots_controller.rb @@ -37,7 +37,7 @@ class Api::V1::Accounts::AgentBotsController < Api::V1::Accounts::BaseController end def permitted_params - params.permit(:name, :description, :outgoing_url, :avatar, :avatar_url, :bot_type, bot_config: [:csml_content]) + params.permit(:name, :description, :outgoing_url, :avatar, :avatar_url, :bot_type, bot_config: {}) end def process_avatar_from_url diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 0f915ab8a..d91d85b0d 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -36,7 +36,7 @@ class DashboardController < ActionController::Base 'LOGOUT_REDIRECT_LINK', 'DISABLE_USER_PROFILE_UPDATE', 'DEPLOYMENT_ENV', - 'CSML_EDITOR_HOST', 'INSTALLATION_PRICING_PLAN' + 'INSTALLATION_PRICING_PLAN' ).merge(app_config) end diff --git a/app/javascript/dashboard/api/agentBots.js b/app/javascript/dashboard/api/agentBots.js index 4de6fcee0..6e59f38d3 100644 --- a/app/javascript/dashboard/api/agentBots.js +++ b/app/javascript/dashboard/api/agentBots.js @@ -1,9 +1,26 @@ +/* global axios */ import ApiClient from './ApiClient'; class AgentBotsAPI extends ApiClient { constructor() { super('agent_bots', { accountScoped: true }); } + + create(data) { + return axios.post(this.url, data, { + headers: { 'Content-Type': 'multipart/form-data' }, + }); + } + + update(id, data) { + return axios.patch(`${this.url}/${id}`, data, { + headers: { 'Content-Type': 'multipart/form-data' }, + }); + } + + deleteAgentBotAvatar(botId) { + return axios.delete(`${this.url}/${botId}/avatar`); + } } export default new AgentBotsAPI(); diff --git a/app/javascript/dashboard/components-next/dialog/Dialog.vue b/app/javascript/dashboard/components-next/dialog/Dialog.vue index 42325b0c5..6800b1254 100644 --- a/app/javascript/dashboard/components-next/dialog/Dialog.vue +++ b/app/javascript/dashboard/components-next/dialog/Dialog.vue @@ -125,7 +125,10 @@ defineExpose({ open, close }); -
+