discourse-ai/assets/javascripts/discourse/admin/models/ai-llm.js

31 lines
618 B
JavaScript
Raw Normal View History

2024-05-21 12:35:50 -04:00
import { ajax } from "discourse/lib/ajax";
import RestModel from "discourse/models/rest";
export default class AiLlm extends RestModel {
createProperties() {
return this.getProperties(
"id",
"display_name",
"name",
"provider",
"tokenizer",
"max_prompt_tokens",
"url",
"api_key"
);
}
updateProperties() {
const attrs = this.createProperties();
attrs.id = this.id;
return attrs;
}
2024-05-21 12:35:50 -04:00
async testConfig() {
return await ajax(`/admin/plugins/discourse-ai/ai-llms/test.json`, {
data: { ai_llm: this.createProperties() },
});
}
}