diff --git a/spec/lib/integrations/openai/processor_service_spec.rb b/spec/lib/integrations/openai/processor_service_spec.rb index 6d9c414c7..3f487ce8d 100644 --- a/spec/lib/integrations/openai/processor_service_spec.rb +++ b/spec/lib/integrations/openai/processor_service_spec.rb @@ -20,6 +20,14 @@ RSpec.describe Integrations::Openai::ProcessorService do let!(:conversation) { create(:conversation, account: account) } let!(:customer_message) { create(:message, account: account, conversation: conversation, message_type: :incoming, content: 'hello agent') } let!(:agent_message) { create(:message, account: account, conversation: conversation, message_type: :outgoing, content: 'hello customer') } + let!(:summary_prompt) do + if Dir.exist?('enterprise') + Rails.root.join('enterprise/lib/enterprise/integrations/openai_prompts/summary.txt').read + else + 'Please summarize the key points from the following conversation between support agents and customer as bullet points for the next ' \ + "support agent looking into the conversation. Reply in the user's language." + end + end describe '#perform' do context 'when event name is rephrase' do @@ -83,8 +91,7 @@ RSpec.describe Integrations::Openai::ProcessorService do 'model' => 'gpt-3.5-turbo', 'messages' => [ { 'role' => 'system', - 'content' => 'Please summarize the key points from the following conversation between support agents and customer ' \ - 'as bullet points for the next support agent looking into the conversation. Reply in the user\'s language.' }, + 'content' => summary_prompt }, { 'role' => 'user', 'content' => conversation_messages } ] }.to_json diff --git a/spec/models/message_spec.rb b/spec/models/message_spec.rb index 85eb1267a..25504e776 100644 --- a/spec/models/message_spec.rb +++ b/spec/models/message_spec.rb @@ -84,6 +84,7 @@ RSpec.describe Message do last_activity_at: message.conversation.last_activity_at.to_i, unread_count: message.conversation.unread_incoming_messages.count }, + sentiment: {}, sender: message.sender.push_event_data, echo_id: 'random-echo_id' }