mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-07-15 04:25:16 +02:00
catch embedding model init error
This commit is contained in:
parent
5fb52e6d73
commit
ae341bfdf4
2 changed files with 20 additions and 13 deletions
|
@ -77,7 +77,7 @@ export class Agent {
|
||||||
}, 30000);
|
}, 30000);
|
||||||
|
|
||||||
this.bot.once('error', (error) => {
|
this.bot.once('error', (error) => {
|
||||||
clearTimeout(timeout);
|
clearTimeout(spawnTimeout);
|
||||||
console.error('Bot encountered error:', error);
|
console.error('Bot encountered error:', error);
|
||||||
reject(error);
|
reject(error);
|
||||||
});
|
});
|
||||||
|
|
|
@ -84,19 +84,26 @@ export class Prompter {
|
||||||
|
|
||||||
console.log('Using embedding settings:', embedding);
|
console.log('Using embedding settings:', embedding);
|
||||||
|
|
||||||
if (embedding.api === 'google')
|
try {
|
||||||
this.embedding_model = new Gemini(embedding.model, embedding.url);
|
if (embedding.api === 'google')
|
||||||
else if (embedding.api === 'openai')
|
this.embedding_model = new Gemini(embedding.model, embedding.url);
|
||||||
this.embedding_model = new GPT(embedding.model, embedding.url);
|
else if (embedding.api === 'openai')
|
||||||
else if (embedding.api === 'replicate')
|
this.embedding_model = new GPT(embedding.model, embedding.url);
|
||||||
this.embedding_model = new ReplicateAPI(embedding.model, embedding.url);
|
else if (embedding.api === 'replicate')
|
||||||
else if (embedding.api === 'ollama')
|
this.embedding_model = new ReplicateAPI(embedding.model, embedding.url);
|
||||||
this.embedding_model = new Local(embedding.model, embedding.url);
|
else if (embedding.api === 'ollama')
|
||||||
else if (embedding.api === 'qwen')
|
this.embedding_model = new Local(embedding.model, embedding.url);
|
||||||
this.embedding_model = new Qwen(embedding.model, embedding.url);
|
else if (embedding.api === 'qwen')
|
||||||
else {
|
this.embedding_model = new Qwen(embedding.model, embedding.url);
|
||||||
|
else {
|
||||||
|
this.embedding_model = null;
|
||||||
|
console.log('Unknown embedding: ', embedding ? embedding.api : '[NOT SPECIFIED]', '. Using word overlap.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.log('Warning: Failed to initialize embedding model:', err.message);
|
||||||
|
console.log('Continuing anyway, using word overlap instead.');
|
||||||
this.embedding_model = null;
|
this.embedding_model = null;
|
||||||
console.log('Unknown embedding: ', embedding ? embedding.api : '[NOT SPECIFIED]', '. Using word overlap.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mkdirSync(`./bots/${name}`, { recursive: true });
|
mkdirSync(`./bots/${name}`, { recursive: true });
|
||||||
|
|
Loading…
Add table
Reference in a new issue