mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-06-28 18:42:16 +00:00
FIX: AI Helper category / tag suggestion when user does not categories muted (#1042)
This commit is contained in:
parent
ceac6e5efb
commit
792df58fbc
@ -109,11 +109,13 @@ module DiscourseAi
|
||||
schema
|
||||
.asymmetric_similarity_search(raw_vector, limit: limit, offset: 0) do |builder|
|
||||
builder.join("topics t on t.id = topic_id")
|
||||
unless muted_category_ids.empty?
|
||||
builder.where(<<~SQL, exclude_category_ids: muted_category_ids.map(&:to_i))
|
||||
t.category_id NOT IN (:exclude_category_ids) AND
|
||||
t.category_id NOT IN (SELECT categories.id FROM categories WHERE categories.parent_category_id IN (:exclude_category_ids))
|
||||
SQL
|
||||
end
|
||||
end
|
||||
.map { |r| [r.topic_id, r.distance] }
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user