Skip to content

Commit

Permalink
Of course, need to index text and models
Browse files Browse the repository at this point in the history
  • Loading branch information
caiosba committed Jul 26, 2024
1 parent cf59ad8 commit 383acc3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/models/explainer.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
class Explainer < ApplicationRecord
include Article

# FIXME: Read from workspace settings
ALEGRE_MODELS_AND_THRESHOLDS = {
Bot::Alegre::ELASTICSEARCH_MODEL => 0.8 # Sometimes this is easier for local development
# Bot::Alegre::PARAPHRASE_MULTILINGUAL_MODEL => 0.6
}

belongs_to :team

has_annotations
Expand Down Expand Up @@ -47,7 +53,8 @@ def self.update_paragraphs_in_alegre(id, previous_paragraphs_count, timestamp)
count += 1
params = {
doc_id: Digest::MD5.hexdigest(['explainer', explainer.id, 'paragraph', count].join(':')),
quiet: true,
text: paragraph,
models: ALEGRE_MODELS_AND_THRESHOLDS.keys,
context: base_context.merge({ paragraph: count })
}
Bot::Alegre.request('post', '/text/similarity/', params)
Expand Down

0 comments on commit 383acc3

Please sign in to comment.