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);
|
||||
|
||||
this.bot.once('error', (error) => {
|
||||
clearTimeout(timeout);
|
||||
clearTimeout(spawnTimeout);
|
||||
console.error('Bot encountered error:', error);
|
||||
reject(error);
|
||||
});
|
||||
|
|
|
@ -84,6 +84,7 @@ export class Prompter {
|
|||
|
||||
console.log('Using embedding settings:', embedding);
|
||||
|
||||
try {
|
||||
if (embedding.api === 'google')
|
||||
this.embedding_model = new Gemini(embedding.model, embedding.url);
|
||||
else if (embedding.api === 'openai')
|
||||
|
@ -98,6 +99,12 @@ export class Prompter {
|
|||
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;
|
||||
}
|
||||
|
||||
mkdirSync(`./bots/${name}`, { recursive: true });
|
||||
writeFileSync(`./bots/${name}/last_profile.json`, JSON.stringify(this.profile, null, 4), (err) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue