import Component from "@glimmer/component"; import { concat, fn } from "@ember/helper"; import { on } from "@ember/modifier"; import { action } from "@ember/object"; import { LinkTo } from "@ember/routing"; import DToggleSwitch from "discourse/components/d-toggle-switch"; import { popupAjaxError } from "discourse/lib/ajax-error"; import icon from "discourse-common/helpers/d-icon"; import i18n from "discourse-common/helpers/i18n"; import I18n from "discourse-i18n"; import AiLlmEditor from "./ai-llm-editor"; export default class AiLlmsListEditor extends Component { get hasLLMElements() { return this.args.llms.length !== 0; } @action async toggleEnabledChatBot(llm) { const oldValue = llm.enabled_chat_bot; const newValue = !oldValue; try { llm.set("enabled_chat_bot", newValue); await llm.update({ enabled_chat_bot: newValue, }); } catch (err) { llm.set("enabled_chat_bot", oldValue); popupAjaxError(err); } } }