Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 42905ff

Browse files
committed
FIX: legacy reasoning models not working, missing provider params
1. Legacy reasoning models (o1-preview / o1-mini) do not support developer or system messages, do not use them. 2. LLM editor form not showing all provider params due to missing remap
1 parent 4f94675 commit 42905ff

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

assets/javascripts/discourse/components/ai-llm-editor-form.gjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export default class AiLlmEditorForm extends Component {
6161
provider: model.provider,
6262
enabled_chat_bot: model.enabled_chat_bot,
6363
vision_enabled: model.vision_enabled,
64-
provider_params: model.provider_params,
64+
provider_params: this.computeProviderParams(model.provider),
6565
llm_quotas: model.llm_quotas,
6666
};
6767
}

lib/completions/dialects/chat_gpt.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,17 @@ def tools_dialect
5555
end
5656
end
5757

58-
# developer messages are preferred on reasoning models
58+
# developer messages are preferred on recent reasoning models
5959
def supports_developer_messages?
60-
llm_model.provider == "open_ai" &&
60+
!legacy_reasoning_model? && llm_model.provider == "open_ai" &&
6161
(llm_model.name.start_with?("o1") || llm_model.name.start_with?("o3"))
6262
end
6363

64+
def legacy_reasoning_model?
65+
llm_model.provider == "open_ai" &&
66+
(llm_model.name.start_with?("o1-preview") || llm_model.name.start_with?("o1-mini"))
67+
end
68+
6469
def system_msg(msg)
6570
content = msg[:content]
6671
if disable_native_tools? && tools_dialect.instructions.present?
@@ -69,6 +74,8 @@ def system_msg(msg)
6974

7075
if supports_developer_messages?
7176
{ role: "developer", content: content }
77+
elsif legacy_reasoning_model?
78+
{ role: "user", content: content }
7279
else
7380
{ role: "system", content: content }
7481
end

0 commit comments

Comments
 (0)