Files
discourse-ai/assets/javascripts/discourse/components/ai-llm-selector.js
T

28 lines
736 B
JavaScript
Raw Normal View History

2024-11-29 15:41:09 +00:00
import { computed } from "@ember/object";
import { observes } from "@ember-decorators/object";
2025-01-14 15:54:09 +11:00
import { i18n } from "discourse-i18n";
import ComboBox from "select-kit/components/combo-box";
2024-11-29 15:41:09 +00:00
import { selectKitOptions } from "select-kit/components/select-kit";
2024-11-29 15:41:09 +00:00
@selectKitOptions({
filterable: true,
})
export default class AiLlmSelector extends ComboBox {
@observes("attrs.disabled")
_modelDisabledChanged() {
this.selectKit.options.set("disabled", this.get("attrs.disabled.value"));
2024-11-29 15:41:09 +00:00
}
2024-11-29 15:41:09 +00:00
@computed
get content() {
2025-02-04 16:27:27 +11:00
const blankName =
this.attrs.blankName || i18n("discourse_ai.ai_persona.no_llm_selected");
return [
{
id: "blank",
2025-02-04 16:27:27 +11:00
name: blankName,
},
].concat(this.llms);
2024-11-29 15:41:09 +00:00
}
}