Skip to content

Commit

Permalink
fix: Skip sentiment analysis for blank text (chatwoot#7580)
Browse files Browse the repository at this point in the history
Co-authored-by: Sojan Jose <[email protected]>
  • Loading branch information
tejaswinichile and sojan-official authored Jul 27, 2023
1 parent 2d07577 commit c00855f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions enterprise/app/jobs/enterprise/sentiment_analysis_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ class Enterprise::SentimentAnalysisJob < ApplicationJob
queue_as :low

def perform(message)
return if message.account.locale != 'en'
return if valid_incoming_message?(message)
return if message.account.locale != 'en' || !valid_incoming_message?(message)

save_message_sentiment(message)
rescue StandardError => e
Expand Down Expand Up @@ -39,7 +38,7 @@ def label_val(sentiment)
end

def valid_incoming_message?(message)
!message.incoming? || message.private?
message.incoming? && message.content.present? && !message.private?
end

# returns the sentiment file from vendor folder else download it to the path from AWS-S3
Expand Down

0 comments on commit c00855f

Please sign in to comment.