FIX: Invalid access error in logs (#1317)

This commit is contained in:
Keegan George 2025-05-06 10:13:03 -07:00 committed by GitHub
parent c0a2d4c935
commit adc2716cec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 24 additions and 1 deletions

View File

@ -34,7 +34,30 @@ module DiscourseAi
search_string = search_terms.join(" ").to_s search_string = search_terms.join(" ").to_s
begin
results = ::Search.execute(search_string, search_type: :full_page, guardian: guardian) results = ::Search.execute(search_string, search_type: :full_page, guardian: guardian)
rescue Discourse::InvalidAccess => e
return(
{
args: {
search_query: search_query,
category: category,
user: user,
order: order,
max_posts: max_posts,
tags: tags,
before: before,
after: after,
status: status,
max_results: max_results,
}.compact,
rows: [],
instruction: I18n.t("invalid_access"),
error: e.message,
}
)
end
results_limit = max_results results_limit = max_results
should_try_semantic_search = should_try_semantic_search =