From b199e2d591121e43de741679b2662b7bc6870a1c Mon Sep 17 00:00:00 2001 From: merefield Date: Sun, 16 Nov 2025 18:59:04 +0000 Subject: [PATCH 1/3] COMPATIBILITY: use new modifyClass syntax and fix import --- .../discourse/components/composer-raiser.gjs | 1 + .../initializers/chatbot-post-launch-init.js | 89 ++++++++++--------- plugin.rb | 2 +- 3 files changed, 49 insertions(+), 43 deletions(-) diff --git a/assets/javascripts/discourse/components/composer-raiser.gjs b/assets/javascripts/discourse/components/composer-raiser.gjs index 4e87367..324ff66 100644 --- a/assets/javascripts/discourse/components/composer-raiser.gjs +++ b/assets/javascripts/discourse/components/composer-raiser.gjs @@ -2,6 +2,7 @@ import Component from "@glimmer/component"; import { action } from "@ember/object"; import didInsert from "@ember/render-modifiers/modifiers/did-insert"; import { service } from "@ember/service"; +import { scheduleOnce } from "@ember/runloop"; export default class ComposerRaiserCompopnent extends Component { @service siteSettings; diff --git a/assets/javascripts/discourse/initializers/chatbot-post-launch-init.js b/assets/javascripts/discourse/initializers/chatbot-post-launch-init.js index 6f424c6..cf94680 100644 --- a/assets/javascripts/discourse/initializers/chatbot-post-launch-init.js +++ b/assets/javascripts/discourse/initializers/chatbot-post-launch-init.js @@ -4,53 +4,58 @@ import ChatbotLaunch from "../components/chatbot-launch"; export default apiInitializer("1.8.0", (api) => { const siteSettings = api.container.lookup("service:site-settings"); - api.modifyClass("component:chat-channel", { - pluginId: "discourse-chatbot", - async fetchMessages(findArgs = {}) { - if (this.messagesLoader.loading) { - return; - } + api.modifyClass( + "component:chat-channel", + (Superclass) => + class extends Superclass { + async fetchMessages(findArgs = {}) { + if (this.messagesLoader.loading) { + return; + } - this.messagesManager.clear(); + this.messagesManager.clear(); - const result = await this.messagesLoader.load(findArgs); - this.messagesManager.messages = this.processMessages( - this.args.channel, - result - ); - if (findArgs.target_message_id) { - this.scrollToMessageId(findArgs.target_message_id, { - highlight: true, - position: findArgs.position, - }); - } else if (findArgs.fetch_from_last_read) { - const lastReadMessageId = this.currentUserMembership?.lastReadMessageId; - if ( - this.args.channel.chatable.type === "DirectMessage" && - this.args.channel.unicodeTitle === this.siteSettings.chatbot_bot_user - ) { - this.scrollToMessageId( - this.messagesManager.messages[ - this.messagesManager.messages.length - 1 - ].id + const result = await this.messagesLoader.load(findArgs); + this.messagesManager.messages = this.processMessages( + this.args.channel, + result ); - } else { - this.scrollToMessageId(lastReadMessageId); + if (findArgs.target_message_id) { + this.scrollToMessageId(findArgs.target_message_id, { + highlight: true, + position: findArgs.position, + }); + } else if (findArgs.fetch_from_last_read) { + const lastReadMessageId = + this.currentUserMembership?.lastReadMessageId; + if ( + this.args.channel.chatable.type === "DirectMessage" && + this.args.channel.unicodeTitle === + this.siteSettings.chatbot_bot_user + ) { + this.scrollToMessageId( + this.messagesManager.messages[ + this.messagesManager.messages.length - 1 + ].id + ); + } else { + this.scrollToMessageId(lastReadMessageId); + } + } else if (findArgs.target_date) { + this.scrollToMessageId(result.meta.target_message_id, { + highlight: true, + position: "center", + }); + } else { + this._ignoreNextScroll = true; + this.scrollToBottom(); + } + + this.debounceFillPaneAttempt(); + this.debouncedUpdateLastReadMessage(); } - } else if (findArgs.target_date) { - this.scrollToMessageId(result.meta.target_message_id, { - highlight: true, - position: "center", - }); - } else { - this._ignoreNextScroll = true; - this.scrollToBottom(); } - - this.debounceFillPaneAttempt(); - this.debouncedUpdateLastReadMessage(); - }, - }); + ); if (siteSettings.chatbot_quick_access_bot_post_kicks_off) { api.registerValueTransformer( diff --git a/plugin.rb b/plugin.rb index bbb905a..5f6ba86 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 Chat, Topics and Private Messages -# version: 1.5.19 +# version: 1.5.20 # authors: merefield # url: https://github.com/merefield/discourse-chatbot From 42e1a3a9f5f00c7900ec2f80b9755c255fe0d7b5 Mon Sep 17 00:00:00 2001 From: merefield Date: Sun, 16 Nov 2025 19:09:16 +0000 Subject: [PATCH 2/3] add gpt-5.1 --- config/settings.yml | 8 ++++++++ plugin.rb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/config/settings.yml b/config/settings.yml index afb3d00..62132a6 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -50,6 +50,7 @@ plugins: - gpt-5 - gpt-5-mini - gpt-5-nano + - gpt-5.1 - o4-mini - o3 - o3-mini @@ -85,6 +86,7 @@ plugins: - gpt-5 - gpt-5-mini - gpt-5-nano + - gpt-5.1 - o4-mini - o3 - o3-mini @@ -120,6 +122,7 @@ plugins: - gpt-5 - gpt-5-mini - gpt-5-nano + - gpt-5.1 - o4-mini - o3 - o3-mini @@ -139,6 +142,7 @@ plugins: type: enum default: medium choices: + - none - minimal - low - medium @@ -282,6 +286,10 @@ plugins: type: enum default: gpt-4o choices: + - gpt-5.1 + - gpt-5-mini + - gpt-5-nano + - gpt-5 - gpt-4.1 - gpt-4.1-mini - gpt-4.1-nano diff --git a/plugin.rb b/plugin.rb index 5f6ba86..a3e3e03 100644 --- a/plugin.rb +++ b/plugin.rb @@ -41,7 +41,7 @@ module ::DiscourseChatbot POST_URL_REGEX = %r{\/t/[^/]+/(\d+)/(\d+)(?!\d|\/)} NON_POST_URL_REGEX = %r{\bhttps?:\/\/[^\s\/$.?#].[^\s)]*} - REASONING_MODELS = ["o1", "o1-mini", "o3", "o3-mini", "o4-mini", "gpt-5", "gpt-5-mini", "gpt-5-nano"] + REASONING_MODELS = ["o1", "o1-mini", "o3", "o3-mini", "o4-mini", "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5.1"] def progress_debug_message(message) puts "Chatbot: #{message}" if SiteSetting.chatbot_enable_verbose_console_logging From 784168466ba67ee6495799ef51c0a922b6185d2a Mon Sep 17 00:00:00 2001 From: merefield Date: Sun, 16 Nov 2025 19:15:16 +0000 Subject: [PATCH 3/3] sort imports --- assets/javascripts/discourse/components/composer-raiser.gjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/javascripts/discourse/components/composer-raiser.gjs b/assets/javascripts/discourse/components/composer-raiser.gjs index 324ff66..7f3bd1c 100644 --- a/assets/javascripts/discourse/components/composer-raiser.gjs +++ b/assets/javascripts/discourse/components/composer-raiser.gjs @@ -1,8 +1,8 @@ import Component from "@glimmer/component"; import { action } from "@ember/object"; import didInsert from "@ember/render-modifiers/modifiers/did-insert"; -import { service } from "@ember/service"; import { scheduleOnce } from "@ember/runloop"; +import { service } from "@ember/service"; export default class ComposerRaiserCompopnent extends Component { @service siteSettings;