From c12ca0183bdcf9787d3c75ba2a45853ee905b69f Mon Sep 17 00:00:00 2001 From: merefield Date: Thu, 17 Oct 2024 11:23:55 +0100 Subject: [PATCH] IMPROVE: influence bot to greet user by username for dynamic greetings --- app/controllers/discourse_chatbot/chatbot_controller.rb | 2 +- config/locales/server.en.yml | 2 +- plugin.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/discourse_chatbot/chatbot_controller.rb b/app/controllers/discourse_chatbot/chatbot_controller.rb index 3537d22..cd6ce37 100644 --- a/app/controllers/discourse_chatbot/chatbot_controller.rb +++ b/app/controllers/discourse_chatbot/chatbot_controller.rb @@ -28,7 +28,7 @@ def start_bot_convo start_bot = ::DiscourseChatbot::OpenAiBotRag.new(opts, false) system_message = { "role": "system", "content": I18n.t("chatbot.prompt.system.rag.private", current_date_time: DateTime.current) } - assistant_message = { "role": "assistant", "content": I18n.t("chatbot.prompt.quick_access_kick_off.announcement") } + assistant_message = { "role": "assistant", "content": I18n.t("chatbot.prompt.quick_access_kick_off.announcement", username: current_user.username) } system_message_suffix = start_bot.get_system_message_suffix(opts) system_message[:content] += " " + system_message_suffix diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 374a14d..957c0ec 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -111,7 +111,7 @@ en: private_message: title_creation: "Create a short Topic title from summarising the prior messages" quick_access_kick_off: - announcement: "I must greet the user warmly and kick off any questions I want answered" + announcement: "I must greet @%{username} warmly and kick off any questions I want answered." function: user_information: name: "user_information_for_%{user_field}" diff --git a/plugin.rb b/plugin.rb index b1d3798..f9ef127 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.2.1 +# version: 1.2.2 # authors: merefield # url: https://github.com/merefield/discourse-chatbot