feat: Ability to improve drafts in the editor using GPT integration (#6957)
ref: https://github.com/chatwoot/chatwoot/issues/6436 fixes: https://linear.app/chatwoot/issue/CW-1552/ability-to-rephrase-text-in-the-editor-using-gpt-integration --------- Co-authored-by: Sojan <sojan@pepalo.com> Co-authored-by: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com>
This commit is contained in:
@@ -25,6 +25,8 @@ class Integrations::Hook < ApplicationRecord
|
||||
validate :validate_settings_json_schema
|
||||
validates :app_id, uniqueness: { scope: [:account_id], unless: -> { app.present? && app.params[:allow_multiple_hooks].present? } }
|
||||
|
||||
# TODO: This seems to be only used for slack at the moment
|
||||
# We can add a validator when storing the integration settings and toggle this in future
|
||||
enum status: { disabled: 0, enabled: 1 }
|
||||
|
||||
belongs_to :account
|
||||
@@ -45,6 +47,15 @@ class Integrations::Hook < ApplicationRecord
|
||||
update(status: 'disabled')
|
||||
end
|
||||
|
||||
def process_event(event)
|
||||
case app_id
|
||||
when 'openai'
|
||||
Integrations::Openai::ProcessorService.new(hook: self, event: event).perform if app_id == 'openai'
|
||||
else
|
||||
'No processor found'
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def ensure_hook_type
|
||||
|
||||
Reference in New Issue
Block a user