fix: Update breaking specs on sentiment and open AI integration (#7513)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user