From cf86d274a02c45b4edbc9a7be3044a6c53e47661 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 3 Feb 2025 08:45:56 +1100 Subject: [PATCH] FEATURE: improve o3-mini support (#1106) * DEV: raise timeout for reasoning LLMs * FIX: use id to identify llms, not model_name model_name is not unique, in the case of reasoning models you may configure the same llm multiple times using different reasoning levels. --- .../connectors/composer-fields/persona-llm-selector.gjs | 4 ++-- lib/completions/endpoints/base.rb | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/assets/javascripts/discourse/connectors/composer-fields/persona-llm-selector.gjs b/assets/javascripts/discourse/connectors/composer-fields/persona-llm-selector.gjs index a5240197..951d754a 100644 --- a/assets/javascripts/discourse/connectors/composer-fields/persona-llm-selector.gjs +++ b/assets/javascripts/discourse/connectors/composer-fields/persona-llm-selector.gjs @@ -152,7 +152,7 @@ export default class BotSelector extends Component { resetTargetRecipients() { if (this.allowLLMSelector) { const botUsername = this.currentUser.ai_enabled_chat_bots.find( - (bot) => bot.model_name === this.llm + (bot) => bot.id === this.llm ).username; this.composer.set("targetRecipients", botUsername); } else { @@ -170,7 +170,7 @@ export default class BotSelector extends Component { return availableBots.map((bot) => { return { - id: bot.model_name, + id: bot.id, name: bot.display_name, }; }); diff --git a/lib/completions/endpoints/base.rb b/lib/completions/endpoints/base.rb index 439b54f5..58ff9c2a 100644 --- a/lib/completions/endpoints/base.rb +++ b/lib/completions/endpoints/base.rb @@ -7,7 +7,11 @@ module DiscourseAi attr_reader :partial_tool_calls CompletionFailed = Class.new(StandardError) - TIMEOUT = 60 + # 6 minutes + # Reasoning LLMs can take a very long time to respond, generally it will be under 5 minutes + # The alternative is to have per LLM timeouts but that would make it extra confusing for people + # configuring. Let's try this simple solution first. + TIMEOUT = 360 class << self def endpoint_for(provider_name)