Skip to content

Commit

Permalink
FIX: forum search function was raising error
Browse files Browse the repository at this point in the history
  • Loading branch information
merefield committed Oct 29, 2024
1 parent 02a0a9a commit 34b9a69
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions lib/discourse_chatbot/functions/forum_search_function.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,23 @@ def process(args)
end
end
{
result: response,
topic_ids_found: topic_ids_found,
post_ids_found: post_ids_found,
non_post_urls_found: non_post_urls_found,
answer: {
result: response,
topic_ids_found: topic_ids_found,
post_ids_found: post_ids_found,
non_post_urls_found: non_post_urls_found
},
token_usage: 0
}
rescue StandardError => e
Rails.logger.error("Chatbot: Error occurred while attempting to retrieve Forum Search results for query '#{query}': #{e.message}")
{
result: I18n.t("chatbot.prompt.function.forum_search.error", query: args[parameters[0][:name]]),
topic_ids_found: [],
post_ids_found: [],
non_post_urls_found: [],
answer: {
result: I18n.t("chatbot.prompt.function.forum_search.error", query: args[parameters[0][:name]]),
topic_ids_found: [],
post_ids_found: [],
non_post_urls_found: []
},
token_usage: 0
}
end
Expand Down
2 changes: 1 addition & 1 deletion plugin.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# name: discourse-chatbot
# about: a plugin that allows you to have a conversation with a configurable chatbot in Discourse Chat, Topics and Private Messages
# version: 1.4.0
# version: 1.4.1
# authors: merefield
# url: https://github.com/merefield/discourse-chatbot

Expand Down

0 comments on commit 34b9a69

Please sign in to comment.