Update prompter.js

Updated prompter.js for updated Ollama and Openrouter model usage
This commit is contained in:
Sweaterdog 2025-03-01 13:40:24 -08:00 committed by GitHub
parent 37417fcb92
commit 125aee4ce4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -123,12 +123,12 @@ export class Prompter {
profile = {model: profile};
}
if (!profile.api) {
if (profile.model.includes('gemini'))
if (profile.model.includes('openrouter/'))
profile.api = 'openrouter'; // must do first because shares names with other models
else if (profile.model.includes('ollama/'))
profile.api = 'ollama'; // also must do early because shares names with other models
else if (profile.model.includes('gemini'))
profile.api = 'google';
else if (profile.model.includes('openrouter/'))
profile.api = 'openrouter'; // must do before others bc shares model names
else if (profile.model.includes('andy-'))
profile.api = 'ollama'; // We have to check here since the installation for Andy-3.6 makes the username include "hf:" which is the same as glhf.chat, which will not work.
else if (profile.model.includes('gpt') || profile.model.includes('o1')|| profile.model.includes('o3'))
profile.api = 'openai';
else if (profile.model.includes('claude'))
@ -141,10 +141,6 @@ export class Prompter {
model_profile.api = 'mistral';
else if (profile.model.includes("groq/") || profile.model.includes("groqcloud/"))
profile.api = 'groq';
else if (profile.model.includes('hf:'))
profile.api = "glhf";
else if (profile.model.includes('hyperbolic:')|| profile.model.includes('hb:'))
profile.api = "hyperbolic";
else if (profile.model.includes('novita/'))
profile.api = 'novita';
else if (profile.model.includes('qwen'))
@ -153,12 +149,11 @@ export class Prompter {
profile.api = 'xai';
else if (profile.model.includes('deepseek'))
profile.api = 'deepseek';
else
profile.api = 'ollama'; // Fixed this line, it had a bug where only llama3 models could be used in Mindcraft via Ollama, which was is not optimal.
else
profile.api = 'ollama'; // Assume the model is ollama, even if the user didn't use ollama/
}
return profile;
}
_createModel(profile) {
let model = null;
if (profile.api === 'google')
@ -170,15 +165,11 @@ export class Prompter {
else if (profile.api === 'replicate')
model = new ReplicateAPI(profile.model.replace('replicate/', ''), profile.url, profile.params);
else if (profile.api === 'ollama')
model = new Local(profile.model, profile.url, profile.params);
model = new Local(profile.model.replace('ollama/', ''), profile.url, profile.params);
else if (profile.api === 'mistral')
model = new Mistral(profile.model, profile.url, profile.params);
else if (profile.api === 'groq')
model = new GroqCloudAPI(profile.model.replace('groq/', '').replace('groqcloud/', ''), profile.url, profile.params);
else if (profile.api === 'glhf')
model = new glhf(profile.model, profile.url, profile.params);
else if (profile.api === 'hyperbolic')
model = new hyperbolic(profile.model.replace('hyperbolic:', '').replace('hb:', ''), profile.url, profile.params);
else if (profile.api === 'huggingface')
model = new HuggingFace(profile.model, profile.url, profile.params);
else if (profile.api === 'novita')
@ -195,7 +186,6 @@ export class Prompter {
throw new Error('Unknown API:', profile.api);
return model;
}
getName() {
return this.profile.name;
}