discourse-ai/assets/javascripts/discourse/admin/models/ai-llm.js
Joffrey JAFFEUX 40e996b174
DEV: converts llm admin page to use form kit (#1099)
This also converts the quota editor, and the quota modal.
2025-02-04 11:51:01 +01:00

33 lines
754 B
JavaScript

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",
"enabled_chat_bot",
"provider_params",
"vision_enabled"
);
}
updateProperties() {
const attrs = this.createProperties();
attrs.id = this.id;
attrs.llm_quotas = this.llm_quotas;
return attrs;
}
async testConfig(llmConfig) {
return await ajax("/admin/plugins/discourse-ai/ai-llms/test.json", {
data: { ai_llm: llmConfig ?? this.createProperties() },
});
}
}