This repository was archived by the owner on Jul 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed
app/services/problem_check Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ class ProblemCheck ::AiLlmStatus < ProblemCheck
4+ self . priority = "high"
5+ # self.perform_every = 1.hour
6+
7+ def call
8+ return no_problem if !SiteSetting . discourse_ai_enabled?
9+ return no_problem if llm_operational?
10+
11+ problem
12+ end
13+
14+ private
15+
16+ def llm_operational?
17+ model_ids = DiscourseAi ::Configuration ::LlmEnumerator . global_usage . keys
18+ models_to_check = LlmModel . where ( id : model_ids )
19+
20+ models_to_check . each do |model |
21+ begin
22+ result = validator . run_test ( model )
23+ return false unless result
24+ rescue StandardError => e
25+ Rails . logger . warn ( "LlmValidator encountered an error for model #{ model . id } : #{ e . message } " )
26+ return false
27+ end
28+ end
29+
30+ return true
31+ end
32+
33+ def validator
34+ @validator ||= DiscourseAi ::Configuration ::LlmValidator . new
35+ end
36+ end
Original file line number Diff line number Diff line change 452452 no_default_llm : The persona must have a default_llm defined.
453453 user_not_allowed : The user is not allowed to participate in the topic.
454454 prompt_message_length : The message %{idx} is over the 1000 character limit.
455+ dashboard :
456+ problem :
457+ ai_llm_status : " An LLM Model needs attention!"
Original file line number Diff line number Diff line change @@ -73,6 +73,8 @@ def self.public_asset_path(name)
7373 DiscourseAi ::AiBot ::EntryPoint . new ,
7474 ] . each { |a_module | a_module . inject_into ( self ) }
7575
76+ register_problem_check ProblemCheck ::AiLlmStatus
77+
7678 register_reviewable_type ReviewableAiChatMessage
7779 register_reviewable_type ReviewableAiPost
7880
You can’t perform that action at this time.
0 commit comments