|
1 | 1 | # frozen_string_literal: true |
2 | 2 | # name: discourse-chatbot |
3 | | -# about: a plugin that allows you to have a conversation with a configurable chatbot in Discourse Chat, Topics and Private Messages |
4 | | -# version: 1.5.14 |
| 3 | +# about: a plugin that allows you to have a conversation with a configurable chatbot in Chat, Topics and Private Messages |
| 4 | +# version: 1.5.15 |
5 | 5 | # authors: merefield |
6 | 6 | # url: https://github.com/merefield/discourse-chatbot |
7 | 7 |
|
| 8 | +gem 'domain_name', '0.6.20240107', { require: false } |
| 9 | +gem 'http-cookie', '1.0.8', { require: false } |
8 | 10 | gem 'event_stream_parser', '1.0.0', { require: false } |
9 | 11 | gem "ruby-openai", '8.1.0', { require: false } |
10 | 12 | # google search |
@@ -39,7 +41,7 @@ module ::DiscourseChatbot |
39 | 41 | POST_URL_REGEX = %r{\/t/[^/]+/(\d+)/(\d+)(?!\d|\/)} |
40 | 42 | NON_POST_URL_REGEX = %r{\bhttps?:\/\/[^\s\/$.?#].[^\s)]*} |
41 | 43 |
|
42 | | - REASONING_MODELS = ["o1", "o1-mini", "o3", "o3-mini", "o4-mini"] |
| 44 | + REASONING_MODELS = ["o1", "o1-mini", "o3", "o3-mini", "o4-mini", "gpt-5", "gpt-5-mini", "gpt-5-nano"] |
43 | 45 |
|
44 | 46 | def progress_debug_message(message) |
45 | 47 | puts "Chatbot: #{message}" if SiteSetting.chatbot_enable_verbose_console_logging |
@@ -143,16 +145,6 @@ def progress_debug_message(message) |
143 | 145 | register_user_custom_field_type(::DiscourseChatbot::CHATBOT_REMAINING_QUOTA_TOKENS_CUSTOM_FIELD, :integer) |
144 | 146 | register_user_custom_field_type(::DiscourseChatbot::CHATBOT_QUERIES_QUOTA_REACH_ESCALATION_DATE_CUSTOM_FIELD, :date) |
145 | 147 |
|
146 | | - # Initialize Chatbot Quotas for all users as required |
147 | | - user_count = User.count |
148 | | - queries_field_count = UserCustomField.where(name: ::DiscourseChatbot::CHATBOT_REMAINING_QUOTA_QUERIES_CUSTOM_FIELD).count |
149 | | - token_field_count = UserCustomField.where(name: ::DiscourseChatbot::CHATBOT_REMAINING_QUOTA_TOKENS_CUSTOM_FIELD).count |
150 | | - pp "CHATBOT: Checking presence of Chatbot Custom Fields" |
151 | | - if user_count > queries_field_count * 2 || user_count > token_field_count * 2 |
152 | | - pp "CHATBOT: Resetting Chatbot Quotas for all users as many users without required Chatbot Custom Fields" |
153 | | - ::DiscourseChatbot::Bot.new.reset_all_quotas |
154 | | - end |
155 | | - |
156 | 148 | add_to_serializer(:current_user, :chatbot_access) do |
157 | 149 | !::DiscourseChatbot::EventEvaluation.new.trust_level(object.id).blank? |
158 | 150 | end |
@@ -273,4 +265,5 @@ class ::Chat::UpdateUserLastRead |
273 | 265 | end |
274 | 266 | end |
275 | 267 | end |
| 268 | + Jobs.enqueue(:backfill_chatbot_quotas) |
276 | 269 | end |
0 commit comments