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";
|
2024-02-15 16:37:59 +11:00
|
|
|
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-02-15 16:37:59 +11:00
|
|
|
|
2024-11-29 15:41:09 +00:00
|
|
|
@selectKitOptions({
|
|
|
|
|
filterable: true,
|
|
|
|
|
})
|
|
|
|
|
export default class AiLlmSelector extends ComboBox {
|
|
|
|
|
@observes("attrs.disabled")
|
|
|
|
|
_modelDisabledChanged() {
|
2024-02-15 16:37:59 +11:00
|
|
|
this.selectKit.options.set("disabled", this.get("attrs.disabled.value"));
|
2024-11-29 15:41:09 +00:00
|
|
|
}
|
2024-02-15 16:37:59 +11: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");
|
2024-02-15 16:37:59 +11:00
|
|
|
return [
|
|
|
|
|
{
|
|
|
|
|
id: "blank",
|
2025-02-04 16:27:27 +11:00
|
|
|
name: blankName,
|
2024-02-15 16:37:59 +11:00
|
|
|
},
|
|
|
|
|
].concat(this.llms);
|
2024-11-29 15:41:09 +00:00
|
|
|
}
|
|
|
|
|
}
|