mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-06-27 18:12:18 +00:00
FIX: Embeddings backfill job compat when transitioning models (#1122)
When you already have embeddings for a model stored and change models, our backfill script was failing to backfill the newly configured model. Regression introduced most likely in 1686a8a
This commit is contained in:
parent
708a3bd2b8
commit
77c6543c5d
@ -26,7 +26,9 @@ module Jobs
|
||||
|
||||
topics =
|
||||
Topic
|
||||
.joins("LEFT JOIN #{table_name} ON #{table_name}.topic_id = topics.id")
|
||||
.joins(
|
||||
"LEFT JOIN #{table_name} ON #{table_name}.topic_id = topics.id AND #{table_name}.model_id = #{vector_def.id}",
|
||||
)
|
||||
.where(archetype: Archetype.default)
|
||||
.where(deleted_at: nil)
|
||||
.order("topics.bumped_at DESC")
|
||||
@ -43,7 +45,7 @@ module Jobs
|
||||
#{table_name}.strategy_version < #{vector_def.strategy_version}
|
||||
SQL
|
||||
|
||||
rebaked += populate_topic_embeddings(vector, relation)
|
||||
rebaked += populate_topic_embeddings(vector, relation, force: true)
|
||||
|
||||
return if rebaked >= limit
|
||||
|
||||
@ -67,7 +69,9 @@ module Jobs
|
||||
|
||||
posts =
|
||||
Post
|
||||
.joins("LEFT JOIN #{table_name} ON #{table_name}.post_id = posts.id")
|
||||
.joins(
|
||||
"LEFT JOIN #{table_name} ON #{table_name}.post_id = posts.id AND #{table_name}.model_id = #{vector_def.id}",
|
||||
)
|
||||
.where(deleted_at: nil)
|
||||
.where(post_type: Post.types[:regular])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user