feat(captain-memory): enqueue extraction on conversation.resolved
This commit is contained in:
parent
2261b09b25
commit
e89b96d09b
@ -3,6 +3,10 @@ class CaptainListener < BaseListener
|
||||
|
||||
def conversation_resolved(event)
|
||||
conversation = extract_conversation_and_account(event)[0]
|
||||
return if conversation.blank?
|
||||
|
||||
Captain::ContactMemories::ExtractFromConversationJob.perform_later(conversation.id)
|
||||
|
||||
assistant = conversation.inbox.captain_assistant
|
||||
|
||||
return unless conversation.inbox.captain_active?
|
||||
|
||||
@ -53,5 +53,19 @@ describe CaptainListener do
|
||||
listener.conversation_resolved(event)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when conversation resolves' do
|
||||
before do
|
||||
assistant.config['feature_memory'] = false
|
||||
assistant.config['feature_faq'] = false
|
||||
assistant.save!
|
||||
end
|
||||
|
||||
it 'enqueues contact memory extraction job' do
|
||||
expect { listener.conversation_resolved(event) }
|
||||
.to have_enqueued_job(Captain::ContactMemories::ExtractFromConversationJob)
|
||||
.with(conversation.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user