FIX: Skip embeddings for blank content (#392)

This commit is contained in:
Rafael dos Santos Silva 2023-12-29 14:59:08 -03:00 committed by GitHub
parent c778592da4
commit cec9bb8910
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -108,6 +108,7 @@ module DiscourseAi
def generate_representation_from(target, persist: true)
text = @strategy.prepare_text_from(target, tokenizer, max_sequence_length - 2)
return if text.blank?
new_digest = OpenSSL::Digest::SHA1.hexdigest(text)
current_digest = DB.query_single(<<~SQL, target_id: target.id).first