From d15876025f9d3b5d97fcfda2c7b896f276140ec0 Mon Sep 17 00:00:00 2001 From: Kris Date: Fri, 20 Dec 2024 19:33:45 -0500 Subject: [PATCH] UX: disabled preseeded edit button, add description (#1038) --- .../components/ai-llms-list-editor.gjs | 49 +++++++++++++++---- .../modules/llms/common/ai-llms-editor.scss | 31 ++++++++---- config/locales/client.en.yml | 2 + spec/system/llms/ai_llm_spec.rb | 17 +++---- 4 files changed, 71 insertions(+), 28 deletions(-) diff --git a/assets/javascripts/discourse/components/ai-llms-list-editor.gjs b/assets/javascripts/discourse/components/ai-llms-list-editor.gjs index 0bc82d68..2fec3d45 100644 --- a/assets/javascripts/discourse/components/ai-llms-list-editor.gjs +++ b/assets/javascripts/discourse/components/ai-llms-list-editor.gjs @@ -1,16 +1,23 @@ import Component from "@glimmer/component"; import { concat, fn } from "@ember/helper"; import { action } from "@ember/object"; -import { LinkTo } from "@ember/routing"; import { service } from "@ember/service"; import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item"; +import DButton from "discourse/components/d-button"; import DPageSubheader from "discourse/components/d-page-subheader"; import i18n from "discourse-common/helpers/i18n"; import I18n from "discourse-i18n"; import AdminSectionLandingItem from "admin/components/admin-section-landing-item"; import AdminSectionLandingWrapper from "admin/components/admin-section-landing-wrapper"; +import DTooltip from "float-kit/components/d-tooltip"; import AiLlmEditor from "./ai-llm-editor"; +function isPreseeded(llm) { + if (llm.id < 0) { + return true; + } +} + export default class AiLlmsListEditor extends Component { @service adminPluginNavManager; @service router; @@ -36,6 +43,15 @@ export default class AiLlmsListEditor extends Component { return ""; } + @action + preseededDescription(llm) { + if (isPreseeded(llm)) { + return i18n("discourse_ai.llms.preseeded_model_description", { + model: llm.name, + }); + } + } + sanitizedTranslationKey(id) { return id.replace(/\./g, "-"); } @@ -146,6 +162,7 @@ export default class AiLlmsListEditor extends Component { class="ai-llm-list__row d-admin-row__content" > +
{{llm.display_name}} @@ -153,6 +170,7 @@ export default class AiLlmsListEditor extends Component {
{{this.modelDescription llm}} + {{this.preseededDescription llm}}
{{#if llm.used_by}}