Skip to content

A platform for community discussion. Free, open, simple.

FIX: remove duplication in llm error message (#38753)

Krisa79bbe97e30d
diff --git a/plugins/discourse-ai/app/models/ai_agent.rb b/plugins/discourse-ai/app/models/ai_agent.rb
index 76d6608f72b..34f0cdf9a14 100644
--- a/plugins/discourse-ai/app/models/ai_agent.rb
+++ b/plugins/discourse-ai/app/models/ai_agent.rb
@@ -379,7 +379,7 @@ class AiAgent < ActiveRecord::Base
allow_chat_channel_mentions || allow_chat_direct_messages || allow_topic_mentions ||
force_default_llm
) && !default_llm_id
- errors.add(:default_llm, I18n.t("discourse_ai.ai_bot.agents.default_llm_required"))
+ errors.add(:base, I18n.t("discourse_ai.ai_bot.agents.default_llm_required"))
end
end
diff --git a/plugins/discourse-ai/spec/models/ai_agent_spec.rb b/plugins/discourse-ai/spec/models/ai_agent_spec.rb
index e92c6c86ec4..d24813e900c 100644
--- a/plugins/discourse-ai/spec/models/ai_agent_spec.rb
+++ b/plugins/discourse-ai/spec/models/ai_agent_spec.rb
@@ -178,7 +178,7 @@ RSpec.describe AiAgent do
)
expect(agent.valid?).to eq(false)
- expect(agent.errors[:default_llm].first).to eq(
+ expect(agent.errors[:base]).to include(
I18n.t("discourse_ai.ai_bot.agents.default_llm_required"),
)
@@ -193,7 +193,7 @@ RSpec.describe AiAgent do
)
expect(agent.valid?).to eq(false)
- expect(agent.errors[:default_llm].first).to eq(
+ expect(agent.errors[:base]).to include(
I18n.t("discourse_ai.ai_bot.agents.default_llm_required"),
)
@@ -208,7 +208,7 @@ RSpec.describe AiAgent do
)
expect(agent.valid?).to eq(false)
- expect(agent.errors[:default_llm].first).to eq(
+ expect(agent.errors[:base]).to include(
I18n.t("discourse_ai.ai_bot.agents.default_llm_required"),
)
end