From 34b9a69316d8c964a606c4df21e50389ec8b8bc9 Mon Sep 17 00:00:00 2001 From: merefield Date: Tue, 29 Oct 2024 10:23:11 +0000 Subject: [PATCH] FIX: forum search function was raising error --- .../functions/forum_search_function.rb | 20 +++++++++++-------- plugin.rb | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/discourse_chatbot/functions/forum_search_function.rb b/lib/discourse_chatbot/functions/forum_search_function.rb index b538f5f..f329b82 100644 --- a/lib/discourse_chatbot/functions/forum_search_function.rb +++ b/lib/discourse_chatbot/functions/forum_search_function.rb @@ -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 diff --git a/plugin.rb b/plugin.rb index 4859ff7..53c6578 100644 --- a/plugin.rb +++ b/plugin.rb @@ -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