From 74c02f1d04af62696aab69b2fbba1e749a9a3ead Mon Sep 17 00:00:00 2001 From: merefield Date: Wed, 19 Jun 2024 17:55:07 +0100 Subject: [PATCH 1/3] IMPROVE: pretty the json objects in log output --- lib/discourse_chatbot/bots/open_ai_bot_rag.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/discourse_chatbot/bots/open_ai_bot_rag.rb b/lib/discourse_chatbot/bots/open_ai_bot_rag.rb index 907f56a..b533990 100644 --- a/lib/discourse_chatbot/bots/open_ai_bot_rag.rb +++ b/lib/discourse_chatbot/bots/open_ai_bot_rag.rb @@ -111,7 +111,7 @@ def create_chat_completion(messages, use_functions = true, iteration) ::DiscourseChatbot.progress_debug_message <<~EOS I called the LLM to help me ------------------------------ - value of messages is: #{messages} + value of messages is: #{JSON.pretty_generate(messages)} +++++++++++++++++++++++++++++++ EOS parameters = { @@ -142,7 +142,7 @@ def create_chat_completion(messages, use_functions = true, iteration) ::DiscourseChatbot.progress_debug_message <<~EOS +++++++++++++++++++++++++++++++++++++++ The llm responded with - #{res} + #{JSON.pretty_generate(res)} +++++++++++++++++++++++++++++++++++++++ EOS res @@ -248,8 +248,8 @@ def call_function(func_name, args_str, opts) ::DiscourseChatbot.progress_debug_message <<~EOS +++++++++++++++++++++++++++++++++++++++ I used '#{func_name}' to help me - args_str was '#{args_str}' - opts was '#{opts}' + args_str was '#{JSON.pretty_generate(args_str)}' + opts was '#{JSON.pretty_generate(opts)}' +++++++++++++++++++++++++++++++++++++++ EOS begin From 9a11a3a37afbf42f593a44f28d34d32c4e9c695b Mon Sep 17 00:00:00 2001 From: merefield Date: Wed, 19 Jun 2024 17:55:28 +0100 Subject: [PATCH 2/3] bump patch --- plugin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.rb b/plugin.rb index f09c70a..b13ee68 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: 0.9.33 +# version: 0.9.34 # authors: merefield # url: https://github.com/merefield/discourse-chatbot From c5d1465741eae1cffcd71819edfd08a65ac45f20 Mon Sep 17 00:00:00 2001 From: merefield Date: Wed, 19 Jun 2024 18:02:22 +0100 Subject: [PATCH 3/3] improve format of args string --- lib/discourse_chatbot/bots/open_ai_bot_rag.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/discourse_chatbot/bots/open_ai_bot_rag.rb b/lib/discourse_chatbot/bots/open_ai_bot_rag.rb index b533990..972ed30 100644 --- a/lib/discourse_chatbot/bots/open_ai_bot_rag.rb +++ b/lib/discourse_chatbot/bots/open_ai_bot_rag.rb @@ -248,7 +248,7 @@ def call_function(func_name, args_str, opts) ::DiscourseChatbot.progress_debug_message <<~EOS +++++++++++++++++++++++++++++++++++++++ I used '#{func_name}' to help me - args_str was '#{JSON.pretty_generate(args_str)}' + args_str was '#{JSON.pretty_generate(JSON.parse(args_str))}' opts was '#{JSON.pretty_generate(opts)}' +++++++++++++++++++++++++++++++++++++++ EOS