* DRAFT: Create AI Bot users dynamically and support custom LlmModels * Get user associated to llm_model * Track enabled bots with attribute * Don't store bot username. Minor touches to migrate default values in settings * Handle scenario where vLLM uses a SRV record * Made 3.5-turbo-16k the default version so we can remove hack
32 lines
644 B
JavaScript
32 lines
644 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"
|
|
);
|
|
}
|
|
|
|
updateProperties() {
|
|
const attrs = this.createProperties();
|
|
attrs.id = this.id;
|
|
|
|
return attrs;
|
|
}
|
|
|
|
async testConfig() {
|
|
return await ajax(`/admin/plugins/discourse-ai/ai-llms/test.json`, {
|
|
data: { ai_llm: this.createProperties() },
|
|
});
|
|
}
|
|
}
|