mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-04-21 21:52:07 +02:00
embed max tokens, fix shutdown race condition
This commit is contained in:
parent
a95fa33266
commit
66a03bf893
2 changed files with 5 additions and 1 deletions
|
@ -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,
|
||||
|
|
|
@ -111,7 +111,9 @@ export function createMindServer(port = 8080) {
|
|||
for (let manager of Object.values(agentManagers)) {
|
||||
manager.emit('shutdown');
|
||||
}
|
||||
setTimeout(() => {
|
||||
process.exit(0);
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue