2024-05-21 12:35:50 -04:00
|
|
|
import { ajax } from "discourse/lib/ajax";
|
2024-05-13 11:46:42 -04:00
|
|
|
import RestModel from "discourse/models/rest";
|
|
|
|
|
|
|
|
export default class AiLlm extends RestModel {
|
|
|
|
createProperties() {
|
|
|
|
return this.getProperties(
|
2024-05-16 08:50:22 -04:00
|
|
|
"id",
|
2024-05-13 11:46:42 -04:00
|
|
|
"display_name",
|
|
|
|
"name",
|
|
|
|
"provider",
|
|
|
|
"tokenizer",
|
2024-05-16 08:50:22 -04:00
|
|
|
"max_prompt_tokens",
|
|
|
|
"url",
|
2024-06-18 13:32:14 -04:00
|
|
|
"api_key",
|
2024-06-24 18:26:30 -04:00
|
|
|
"enabled_chat_bot",
|
2024-07-24 15:29:47 -04:00
|
|
|
"provider_params",
|
|
|
|
"vision_enabled"
|
2024-05-13 11:46:42 -04:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
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() },
|
|
|
|
});
|
|
|
|
}
|
2024-05-13 11:46:42 -04:00
|
|
|
}
|