mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-04-22 06:02: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) {
|
async embed(text) {
|
||||||
|
if (text.length > 8191)
|
||||||
|
text = text.slice(0, 8191);
|
||||||
const embedding = await this.openai.embeddings.create({
|
const embedding = await this.openai.embeddings.create({
|
||||||
model: this.model_name || "text-embedding-3-small",
|
model: this.model_name || "text-embedding-3-small",
|
||||||
input: text,
|
input: text,
|
||||||
|
|
|
@ -111,7 +111,9 @@ export function createMindServer(port = 8080) {
|
||||||
for (let manager of Object.values(agentManagers)) {
|
for (let manager of Object.values(agentManagers)) {
|
||||||
manager.emit('shutdown');
|
manager.emit('shutdown');
|
||||||
}
|
}
|
||||||
process.exit(0);
|
setTimeout(() => {
|
||||||
|
process.exit(0);
|
||||||
|
}, 2000);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue