0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-09 21:45:25 +08:00
discourse/plugins/discourse-ai/app/services/problem_check
Régis Hanol b03ef52553
FIX: skip failure tracking for unsaved LLM models (#36735)
When testing a new LLM configuration in the admin panel, if the test
fails (e.g., invalid API key), users see "Target can't be blank" instead
of the actual error from the LLM provider.

This happens because `track_failures` attempts to create a
ProblemCheckTracker using `llm_model.id` as the target, but unsaved
models have `id = nil`, which fails the `validates :target, presence:
true` validation.

The fix adds a `new_record?` check to skip failure tracking for unsaved
models, consistent with the existing checks for `blank?` and `seeded?`.

Ref - https://meta.discourse.org/t/391497
2025-12-19 10:23:31 +01:00
..
ai_credit_hard_limit.rb FIX: Fix scheduled targeted problem checks (#35696) 2025-11-10 10:09:14 +08:00
ai_credit_soft_limit.rb FIX: Fix scheduled targeted problem checks (#35696) 2025-11-10 10:09:14 +08:00
ai_llm_status.rb FIX: skip failure tracking for unsaved LLM models (#36735) 2025-12-19 10:23:31 +01:00