Skip to content

Commit bc7b6d6

Browse files
authored
Merge pull request #147 from merefield/some_fixes
COMPATIBILITY: use new modifyClass syntax and fix import
2 parents ca1b873 + 7841684 commit bc7b6d6

File tree

4 files changed

+58
-44
lines changed

4 files changed

+58
-44
lines changed

assets/javascripts/discourse/components/composer-raiser.gjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Component from "@glimmer/component";
22
import { action } from "@ember/object";
33
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
4+
import { scheduleOnce } from "@ember/runloop";
45
import { service } from "@ember/service";
56

67
export default class ComposerRaiserCompopnent extends Component {

assets/javascripts/discourse/initializers/chatbot-post-launch-init.js

Lines changed: 47 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,58 @@ import ChatbotLaunch from "../components/chatbot-launch";
44
export default apiInitializer("1.8.0", (api) => {
55
const siteSettings = api.container.lookup("service:site-settings");
66

7-
api.modifyClass("component:chat-channel", {
8-
pluginId: "discourse-chatbot",
9-
async fetchMessages(findArgs = {}) {
10-
if (this.messagesLoader.loading) {
11-
return;
12-
}
7+
api.modifyClass(
8+
"component:chat-channel",
9+
(Superclass) =>
10+
class extends Superclass {
11+
async fetchMessages(findArgs = {}) {
12+
if (this.messagesLoader.loading) {
13+
return;
14+
}
1315

14-
this.messagesManager.clear();
16+
this.messagesManager.clear();
1517

16-
const result = await this.messagesLoader.load(findArgs);
17-
this.messagesManager.messages = this.processMessages(
18-
this.args.channel,
19-
result
20-
);
21-
if (findArgs.target_message_id) {
22-
this.scrollToMessageId(findArgs.target_message_id, {
23-
highlight: true,
24-
position: findArgs.position,
25-
});
26-
} else if (findArgs.fetch_from_last_read) {
27-
const lastReadMessageId = this.currentUserMembership?.lastReadMessageId;
28-
if (
29-
this.args.channel.chatable.type === "DirectMessage" &&
30-
this.args.channel.unicodeTitle === this.siteSettings.chatbot_bot_user
31-
) {
32-
this.scrollToMessageId(
33-
this.messagesManager.messages[
34-
this.messagesManager.messages.length - 1
35-
].id
18+
const result = await this.messagesLoader.load(findArgs);
19+
this.messagesManager.messages = this.processMessages(
20+
this.args.channel,
21+
result
3622
);
37-
} else {
38-
this.scrollToMessageId(lastReadMessageId);
23+
if (findArgs.target_message_id) {
24+
this.scrollToMessageId(findArgs.target_message_id, {
25+
highlight: true,
26+
position: findArgs.position,
27+
});
28+
} else if (findArgs.fetch_from_last_read) {
29+
const lastReadMessageId =
30+
this.currentUserMembership?.lastReadMessageId;
31+
if (
32+
this.args.channel.chatable.type === "DirectMessage" &&
33+
this.args.channel.unicodeTitle ===
34+
this.siteSettings.chatbot_bot_user
35+
) {
36+
this.scrollToMessageId(
37+
this.messagesManager.messages[
38+
this.messagesManager.messages.length - 1
39+
].id
40+
);
41+
} else {
42+
this.scrollToMessageId(lastReadMessageId);
43+
}
44+
} else if (findArgs.target_date) {
45+
this.scrollToMessageId(result.meta.target_message_id, {
46+
highlight: true,
47+
position: "center",
48+
});
49+
} else {
50+
this._ignoreNextScroll = true;
51+
this.scrollToBottom();
52+
}
53+
54+
this.debounceFillPaneAttempt();
55+
this.debouncedUpdateLastReadMessage();
3956
}
40-
} else if (findArgs.target_date) {
41-
this.scrollToMessageId(result.meta.target_message_id, {
42-
highlight: true,
43-
position: "center",
44-
});
45-
} else {
46-
this._ignoreNextScroll = true;
47-
this.scrollToBottom();
4857
}
49-
50-
this.debounceFillPaneAttempt();
51-
this.debouncedUpdateLastReadMessage();
52-
},
53-
});
58+
);
5459

5560
if (siteSettings.chatbot_quick_access_bot_post_kicks_off) {
5661
api.registerValueTransformer(

config/settings.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ plugins:
5050
- gpt-5
5151
- gpt-5-mini
5252
- gpt-5-nano
53+
- gpt-5.1
5354
- o4-mini
5455
- o3
5556
- o3-mini
@@ -85,6 +86,7 @@ plugins:
8586
- gpt-5
8687
- gpt-5-mini
8788
- gpt-5-nano
89+
- gpt-5.1
8890
- o4-mini
8991
- o3
9092
- o3-mini
@@ -120,6 +122,7 @@ plugins:
120122
- gpt-5
121123
- gpt-5-mini
122124
- gpt-5-nano
125+
- gpt-5.1
123126
- o4-mini
124127
- o3
125128
- o3-mini
@@ -139,6 +142,7 @@ plugins:
139142
type: enum
140143
default: medium
141144
choices:
145+
- none
142146
- minimal
143147
- low
144148
- medium
@@ -282,6 +286,10 @@ plugins:
282286
type: enum
283287
default: gpt-4o
284288
choices:
289+
- gpt-5.1
290+
- gpt-5-mini
291+
- gpt-5-nano
292+
- gpt-5
285293
- gpt-4.1
286294
- gpt-4.1-mini
287295
- gpt-4.1-nano

plugin.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22
# name: discourse-chatbot
33
# about: a plugin that allows you to have a conversation with a configurable chatbot in Chat, Topics and Private Messages
4-
# version: 1.5.19
4+
# version: 1.5.20
55
# authors: merefield
66
# url: https://github.com/merefield/discourse-chatbot
77

@@ -41,7 +41,7 @@ module ::DiscourseChatbot
4141
POST_URL_REGEX = %r{\/t/[^/]+/(\d+)/(\d+)(?!\d|\/)}
4242
NON_POST_URL_REGEX = %r{\bhttps?:\/\/[^\s\/$.?#].[^\s)]*}
4343

44-
REASONING_MODELS = ["o1", "o1-mini", "o3", "o3-mini", "o4-mini", "gpt-5", "gpt-5-mini", "gpt-5-nano"]
44+
REASONING_MODELS = ["o1", "o1-mini", "o3", "o3-mini", "o4-mini", "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5.1"]
4545

4646
def progress_debug_message(message)
4747
puts "Chatbot: #{message}" if SiteSetting.chatbot_enable_verbose_console_logging

0 commit comments

Comments
 (0)