DEV: Use section landing components for LLMs templates (#817)

Relies on https://github.com/discourse/discourse/pull/28477,
uses AdminSectionLandingWrapper and AdminSectionLandingItem
for the section items on the LLM page which are used to create
a new LLM config from a template.
This commit is contained in:
Martin Brennan 2024-10-02 15:31:48 +10:00 committed by GitHub
parent 62ba2fa4d7
commit 7325fb21ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 22 additions and 19 deletions

View File

@ -5,13 +5,14 @@ import { action } from "@ember/object";
import { LinkTo } from "@ember/routing"; import { LinkTo } from "@ember/routing";
import { inject as service } from "@ember/service"; import { inject as service } from "@ember/service";
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item"; import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
import DButton from "discourse/components/d-button";
import DToggleSwitch from "discourse/components/d-toggle-switch"; import DToggleSwitch from "discourse/components/d-toggle-switch";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
import icon from "discourse-common/helpers/d-icon"; import icon from "discourse-common/helpers/d-icon";
import i18n from "discourse-common/helpers/i18n"; import i18n from "discourse-common/helpers/i18n";
import I18n from "discourse-i18n"; import I18n from "discourse-i18n";
import AdminPageSubheader from "admin/components/admin-page-subheader"; import AdminPageSubheader from "admin/components/admin-page-subheader";
import AdminSectionLandingItem from "admin/components/admin-section-landing-item";
import AdminSectionLandingWrapper from "admin/components/admin-section-landing-wrapper";
import AiLlmEditor from "./ai-llm-editor"; import AiLlmEditor from "./ai-llm-editor";
export default class AiLlmsListEditor extends Component { export default class AiLlmsListEditor extends Component {
@ -181,29 +182,31 @@ export default class AiLlmsListEditor extends Component {
{{/if}} {{/if}}
<section class="ai-llms-list-editor__templates"> <section class="ai-llms-list-editor__templates">
<AdminPageSubheader @titleLabel={{this.preconfiguredTitle}} /> <AdminPageSubheader @titleLabel={{this.preconfiguredTitle}} />
<div class="ai-llms-list-editor__templates-list">
<AdminSectionLandingWrapper
class="ai-llms-list-editor__templates-list"
>
{{#each this.preConfiguredLlms as |llm|}} {{#each this.preConfiguredLlms as |llm|}}
<div <AdminSectionLandingItem
@titleLabelTranslated={{llm.name}}
@descriptionLabelTranslated={{this.modelDescription llm}}
@taglineLabel={{concat
"discourse_ai.llms.providers."
llm.provider
}}
data-llm-id={{llm.id}} data-llm-id={{llm.id}}
class="ai-llms-list-editor__templates-list-item" class="ai-llms-list-editor__templates-list-item"
> >
<h4> <:buttons as |buttons|>
{{i18n (concat "discourse_ai.llms.providers." llm.provider)}} <buttons.Default
</h4> @action={{fn this.transitionToLlmEditor llm.id}}
<h3> @icon="gear"
{{llm.name}} @label="discourse_ai.llms.preconfigured.button"
</h3> />
<p> </:buttons>
{{this.modelDescription llm}} </AdminSectionLandingItem>
</p>
<DButton
@action={{fn this.transitionToLlmEditor llm.id}}
@icon="gear"
@label="discourse_ai.llms.preconfigured.button"
/>
</div>
{{/each}} {{/each}}
</div> </AdminSectionLandingWrapper>
</section> </section>
{{/if}} {{/if}}
</section> </section>