embed max tokens, fix shutdown race condition

This commit is contained in:
MaxRobinsonTheGreat 2025-01-21 13:41:48 -06:00
parent a95fa33266
commit 66a03bf893
2 changed files with 5 additions and 1 deletions

View file

@ -54,6 +54,8 @@ export class GPT {
}
async embed(text) {
if (text.length > 8191)
text = text.slice(0, 8191);
const embedding = await this.openai.embeddings.create({
model: this.model_name || "text-embedding-3-small",
input: text,

View file

@ -111,7 +111,9 @@ export function createMindServer(port = 8080) {
for (let manager of Object.values(agentManagers)) {
manager.emit('shutdown');
}
setTimeout(() => {
process.exit(0);
}, 2000);
});
});