FIX: Use correct variable and method for embeddings (#35)
This commit is contained in:
parent
4e05763a99
commit
7a54455cf6
|
@ -1,6 +1,5 @@
|
|||
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||
import { translateResults, updateRecentSearches } from "discourse/lib/search";
|
||||
import { setTransient } from "discourse/lib/page-tracker";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
|
||||
const SEMANTIC_SEARCH = "semantic_search";
|
||||
|
@ -9,7 +8,7 @@ function initializeSemanticSearch(api) {
|
|||
api.addFullPageSearchType(
|
||||
"discourse_ai.embeddings.semantic_search",
|
||||
SEMANTIC_SEARCH,
|
||||
(searchController, args, searchKey) => {
|
||||
(searchController, args) => {
|
||||
if (searchController.currentUser) {
|
||||
updateRecentSearches(searchController.currentUser, args.searchTerm);
|
||||
}
|
||||
|
@ -32,7 +31,6 @@ function initializeSemanticSearch(api) {
|
|||
);
|
||||
}
|
||||
} else {
|
||||
setTransient("lastSearch", { searchKey, model }, 5);
|
||||
model.grouped_search_result = results.grouped_search_result;
|
||||
searchController.set("model", model);
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@ module Jobs
|
|||
|
||||
topic = Topic.find_by_id(topic_id)
|
||||
return if topic.nil? || topic.private_message? && !SiteSetting.ai_embeddings_generate_for_pms
|
||||
post = Topic.find_by_id(topic_id).first_post
|
||||
post = topic.first_post
|
||||
return if post.nil? || post.raw.blank?
|
||||
|
||||
DiscourseAi::Embeddings::Topic.new(post.topic).perform!
|
||||
DiscourseAi::Embeddings::Topic.new.generate_and_store_embeddings_for(topic)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -46,7 +46,7 @@ module DiscourseAi
|
|||
end
|
||||
|
||||
def asymmetric_semantic_search(model, query, limit, offset)
|
||||
query_embedding = model.generate_embedding(query)
|
||||
embedding = model.generate_embedding(query)
|
||||
|
||||
candidate_ids =
|
||||
DiscourseAi::Database::Connection
|
||||
|
|
Loading…
Reference in New Issue