This repository was archived by the owner on Jul 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +101
-0
lines changed
javascripts/discourse/components Expand file tree Collapse file tree 5 files changed +101
-0
lines changed Original file line number Diff line number Diff line change 1+ import Component from " @glimmer/component" ;
2+ import { tracked } from " @glimmer/tracking" ;
3+ import { ajax } from " discourse/lib/ajax" ;
4+ import { i18n } from " discourse-i18n" ;
5+ import SiteSettingComponent from " admin/components/site-setting" ;
6+ import SiteSetting from " admin/models/site-setting" ;
7+
8+ export default class AiDefaultLlmSelector extends Component {
9+ @tracked defaultLlmSetting = null ;
10+
11+ constructor () {
12+ super (... arguments );
13+ this .#loadDefaultLlmSetting ();
14+ }
15+
16+ async #loadDefaultLlmSetting () {
17+ const { site_settings } = await ajax (" /admin/config/site_settings.json" , {
18+ data: {
19+ plugin: " discourse-ai" ,
20+ category: " discourse_ai" ,
21+ },
22+ });
23+
24+ const defaultLlmSetting = site_settings .find (
25+ (setting ) => setting .setting === " ai_default_llm_model"
26+ );
27+
28+ this .defaultLlmSetting = SiteSetting .create (defaultLlmSetting);
29+ }
30+
31+ <template >
32+ <div class =" ai-configure-default-llm" >
33+ <div class =" ai-configure-default-llm__header" >
34+ <h3 >{{i18n " discourse_ai.default_llm.title" }} </h3 >
35+ <p >{{i18n " discourse_ai.default_llm.description" }} </p >
36+ </div >
37+
38+ {{#if this . defaultLlmSetting }}
39+ <SiteSettingComponent
40+ @ setting ={{this .defaultLlmSetting }}
41+ class =" ai-configure-default-llm__setting"
42+ />
43+ {{/if }}
44+ </div >
45+ </template >
46+ }
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import DSelect from "discourse/components/d-select";
1010import FilterInput from " discourse/components/filter-input" ;
1111import { i18n } from " discourse-i18n" ;
1212import AiFeaturesList from " ./ai-features-list" ;
13+ import AiDefaultLlmSelector from " ./ai-default-llm-selector" ;
1314
1415const ALL = " all" ;
1516const CONFIGURED = " configured" ;
@@ -202,6 +203,8 @@ export default class AiFeatures extends Component {
202203 />
203204 </div >
204205
206+ <AiDefaultLlmSelector />
207+
205208 {{#if this . filteredFeatures.length }}
206209 <AiFeaturesList @ modules ={{this .filteredFeatures }} />
207210 {{else }}
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import I18n, { i18n } from "discourse-i18n";
99import AdminSectionLandingItem from " admin/components/admin-section-landing-item" ;
1010import AdminSectionLandingWrapper from " admin/components/admin-section-landing-wrapper" ;
1111import DTooltip from " float-kit/components/d-tooltip" ;
12+ import AiDefaultLlmSelector from " ./ai-default-llm-selector" ;
1213import AiLlmEditor from " ./ai-llm-editor" ;
1314
1415function isPreseeded (llm ) {
@@ -137,6 +138,9 @@ export default class AiLlmsListEditor extends Component {
137138 }}
138139 @ learnMoreUrl =" https://meta.discourse.org/t/discourse-ai-large-language-model-llm-settings-page/319903"
139140 />
141+
142+ <AiDefaultLlmSelector />
143+
140144 {{#if this . hasLlmElements }}
141145 <section class =" ai-llms-list-editor__configured" >
142146 <DPageSubheader
Original file line number Diff line number Diff line change 158158.ai-expanded-list__toggle-button {
159159 padding : 0 ;
160160}
161+
162+ .ai-configure-default-llm {
163+ display : flex ;
164+ align-items : center ;
165+ gap : var (--space-2 );
166+
167+ & __header {
168+ flex : 3 ;
169+ }
170+
171+ & __setting {
172+ flex : 2 ;
173+
174+ display : flex ;
175+ gap : var (--space-2 );
176+ align-items : center ;
177+ justify-content : center ;
178+ }
179+ background : var (--primary-very-low );
180+ padding : 1rem ;
181+ margin-block : 1rem ;
182+ border-radius : var (--d-border-radius );
183+
184+ h3 {
185+ color : var (--primary );
186+ font-size : var (--font-0 );
187+ margin-bottom : 0 ;
188+ }
189+
190+ p {
191+ margin-top : 0 ;
192+ font-size : var (--font-down-1 );
193+ color : var (--primary-high-or-secondary-low );
194+ }
195+
196+ .select-kit ,
197+ .btn {
198+ font-size : var (--font-down-1 );
199+ }
200+ .setting-label ,
201+ .desc {
202+ display : none ;
203+ }
204+ }
Original file line number Diff line number Diff line change 181181 discourse_ai :
182182 title : " AI"
183183
184+ default_llm :
185+ title : " Default LLM model"
186+ description : " The default LLM model to use for all AI features. This will be used if no LLM is specified in the feature configuration or persona."
187+
184188 features :
185189 short_title : " Features"
186190 description : " These are the AI features available to visitors on your site. These can be configured to use specific personas and LLMs, and can be access controlled by groups."
You can’t perform that action at this time.
0 commit comments