chore: Updated prompt for Article Bot (#7872)
This commit is contained in:
@@ -4,13 +4,22 @@ class Enterprise::MessageTemplates::ResponseBotService
|
||||
def perform
|
||||
ActiveRecord::Base.transaction do
|
||||
response = get_response(conversation.messages.last.content)
|
||||
process_response(conversation.messages.last, response)
|
||||
process_response(conversation.messages.last, response['response'])
|
||||
end
|
||||
rescue StandardError => e
|
||||
ChatwootExceptionTracker.new(e, account: conversation.account).capture_exception
|
||||
true
|
||||
end
|
||||
|
||||
def response_sections(content)
|
||||
sections = ''
|
||||
|
||||
inbox.get_responses(content).each do |response|
|
||||
sections += "{context_id: #{response.id}, context: #{response.question} ? #{response.answer}},"
|
||||
end
|
||||
sections
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
delegate :contact, :account, :inbox, to: :conversation
|
||||
@@ -34,15 +43,6 @@ class Enterprise::MessageTemplates::ResponseBotService
|
||||
message.message_type == 'incoming' ? 'user' : 'system'
|
||||
end
|
||||
|
||||
def response_sections(content)
|
||||
sections = ''
|
||||
|
||||
inbox.get_responses(content).each do |response|
|
||||
sections += "{context_id: #{response.id}, context: #{response.question} ? #{response.answer}}"
|
||||
end
|
||||
sections
|
||||
end
|
||||
|
||||
def process_response(message, response)
|
||||
if response == 'conversation_handoff'
|
||||
process_action(message, 'handoff')
|
||||
|
||||
Reference in New Issue
Block a user