fix: Disable predictions if model is absent (#7520)

This commit is contained in:
Pranav Raj S 2023-07-13 14:40:16 -07:00 committed by GitHub
parent 50a927bac2
commit 7e415fbee3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,8 @@ class Enterprise::SentimentAnalysisJob < ApplicationJob
# While gathering the maningfull node the Array/tensor index is going out of bound
text = message.content&.truncate(2900)
return if model.blank?
sentiment = model.predict(text)
message.sentiment = sentiment.merge(value: label_val(sentiment))