From 848b833bc1e05faca7d61ca45284482aac35b1ac Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Sat, 14 Jun 2025 01:30:49 +0530 Subject: [PATCH] add private message for copilot analysis --- app/services/llm_formatter/conversation_llm_formatter.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/services/llm_formatter/conversation_llm_formatter.rb b/app/services/llm_formatter/conversation_llm_formatter.rb index af56cfee3..d9f184659 100644 --- a/app/services/llm_formatter/conversation_llm_formatter.rb +++ b/app/services/llm_formatter/conversation_llm_formatter.rb @@ -22,7 +22,7 @@ class LlmFormatter::ConversationLlmFormatter < LlmFormatter::DefaultLlmFormatter return "No messages in this conversation\n" if @record.messages.empty? message_text = '' - @record.messages.chat.order(created_at: :asc).each do |message| + @record.messages.where.not(message_type: :activity).order(created_at: :asc).each do |message| message_text << format_message(message) end message_text @@ -30,13 +30,13 @@ class LlmFormatter::ConversationLlmFormatter < LlmFormatter::DefaultLlmFormatter def format_message(message) sender = message.message_type == 'incoming' ? 'User' : 'Support agent' + sender = "[Private] #{sender}" if message.private? "#{sender}: #{message.content}\n" end def build_attributes - attributes = [] - @record.account.custom_attribute_definitions.with_attribute_model('conversation_attribute').each do |attribute| - attributes << "#{attribute.attribute_display_name}: #{@record.custom_attributes[attribute.attribute_key]}" + attributes = @record.account.custom_attribute_definitions.with_attribute_model('conversation_attribute').map do |attribute| + "#{attribute.attribute_display_name}: #{@record.custom_attributes[attribute.attribute_key]}" end attributes.join("\n") end