diff --git a/assets/javascripts/initializers/ai-bot-replies.js b/assets/javascripts/initializers/ai-bot-replies.js index e6776c14..8e767ff6 100644 --- a/assets/javascripts/initializers/ai-bot-replies.js +++ b/assets/javascripts/initializers/ai-bot-replies.js @@ -8,7 +8,7 @@ import { registerWidgetShim } from "discourse/widgets/render-glimmer"; import { hbs } from "ember-cli-htmlbars"; function isGPTBot(user) { - return user && [-110, -111, -112].includes(user.id); + return user && [-110, -111, -112, -113].includes(user.id); } function attachHeaderIcon(api) { diff --git a/lib/modules/ai_bot/open_llm_bot.rb b/lib/modules/ai_bot/open_llm_bot.rb index 83ea7f02..fc0a2f82 100644 --- a/lib/modules/ai_bot/open_llm_bot.rb +++ b/lib/modules/ai_bot/open_llm_bot.rb @@ -15,10 +15,14 @@ module DiscourseAi # start with system result = +"" - result << "[INST] <>\n #{messages.shift[:content]} <>\n\n #{messages.shift[:content]} [/INST]" + result << "[INST] <>\n #{messages.shift[:content]} <>\n\n #{messages.shift[:content]} [/INST]" messages.each do |message| - result << "\n\n[INST]#{message[:bot] ? "" : message[:username] + ":"} #{message[:content]} [/INST]" + if message[:bot] + result << message[:content] + else + result << "[INST]#{message[:bot] ? "" : message[:username] + ":"} #{message[:content]} [/INST]" + end end result @@ -65,7 +69,7 @@ module DiscourseAi prompt, model_for, temperature: 0.4, - max_tokens: 200, + max_tokens: 600, &blk ) end diff --git a/lib/modules/summarization/models/llama2.rb b/lib/modules/summarization/models/llama2.rb index 1dc96088..76ca63b3 100644 --- a/lib/modules/summarization/models/llama2.rb +++ b/lib/modules/summarization/models/llama2.rb @@ -20,9 +20,9 @@ module DiscourseAi ) end - def concatenate_summaries(summaries, &on_partial_blk) - prompt = <<~TEXT - [INST] <> + def concatenate_summaries(summaries) + completion(<<~TEXT) + [INST] <> You are a helpful bot <>