From 471f96f972d1ce14125f4b75324c36d62d1be03f Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 24 Jun 2025 17:42:47 +1000 Subject: [PATCH] FEATURE: allow seeing configured LLM on feature page (#1460) This is an interim fix so we can at least tell what feature is being used for what LLM. It also adds some test coverage to the feature page. --- .../admin/ai_features_controller.rb | 4 + .../discourse/components/ai-features-list.gjs | 13 ++ assets/stylesheets/common/ai-features.scss | 9 +- config/locales/client.en.yml | 2 + lib/ai_helper/assistant.rb | 6 +- lib/configuration/feature.rb | 22 +++ lib/translation/base_translator.rb | 8 +- lib/translation/language_detector.rb | 8 +- spec/configuration/feature_spec.rb | 146 ++++++++++++++++++ 9 files changed, 206 insertions(+), 12 deletions(-) create mode 100644 spec/configuration/feature_spec.rb diff --git a/app/controllers/discourse_ai/admin/ai_features_controller.rb b/app/controllers/discourse_ai/admin/ai_features_controller.rb index 3390310e..587ef700 100644 --- a/app/controllers/discourse_ai/admin/ai_features_controller.rb +++ b/app/controllers/discourse_ai/admin/ai_features_controller.rb @@ -38,6 +38,10 @@ module DiscourseAi { name: feature.name, persona: serialize_persona(persona_id_obj_hash[feature.persona_id]), + llm_model: { + id: feature.llm_model&.id, + name: feature.llm_model&.name, + }, enabled: feature.enabled?, } end diff --git a/assets/javascripts/discourse/components/ai-features-list.gjs b/assets/javascripts/discourse/components/ai-features-list.gjs index e2feab9c..d3643dc6 100644 --- a/assets/javascripts/discourse/components/ai-features-list.gjs +++ b/assets/javascripts/discourse/components/ai-features-list.gjs @@ -59,6 +59,19 @@ const AiFeaturesList =