Merge pull request #416 from kolbytn/patch

Patch
This commit is contained in:
Max Robinson 2025-01-21 14:07:51 -06:00 committed by GitHub
commit 8e783ba75a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 13 additions and 4 deletions

View file

@ -32,7 +32,7 @@ export default
"show_bot_views": false, // show bot's view in browser at localhost:3000, 3001... "show_bot_views": false, // show bot's view in browser at localhost:3000, 3001...
"allow_insecure_coding": false, // allows newAction command and model can write/run code on your computer. enable at own risk "allow_insecure_coding": false, // allows newAction command and model can write/run code on your computer. enable at own risk
"code_timeout_mins": 10, // minutes code is allowed to run. -1 for no timeout "code_timeout_mins": -1, // minutes code is allowed to run. -1 for no timeout
"max_messages": 15, // max number of messages to keep in context "max_messages": 15, // max number of messages to keep in context
"num_examples": 2, // number of examples to give to the model "num_examples": 2, // number of examples to give to the model

View file

@ -1269,12 +1269,17 @@ export async function tillAndSow(bot, x, y, z, seedType=null) {
* let position = world.getPosition(bot); * let position = world.getPosition(bot);
* await skills.till(bot, position.x, position.y - 1, position.x); * await skills.till(bot, position.x, position.y - 1, position.x);
**/ **/
console.log(x, y, z)
x = Math.round(x); x = Math.round(x);
y = Math.round(y); y = Math.round(y);
z = Math.round(z); z = Math.round(z);
let block = bot.blockAt(new Vec3(x, y, z)); let block = bot.blockAt(new Vec3(x, y, z));
console.log(x, y, z)
if (bot.modes.isOn('cheat')) {
placeBlock(bot, x, y, z, 'farmland');
placeBlock(bot, x, y+1, z, seedType);
return true;
}
if (block.name !== 'grass_block' && block.name !== 'dirt' && block.name !== 'farmland') { if (block.name !== 'grass_block' && block.name !== 'dirt' && block.name !== 'farmland') {
log(bot, `Cannot till ${block.name}, must be grass_block or dirt.`); log(bot, `Cannot till ${block.name}, must be grass_block or dirt.`);
return false; return false;

View file

@ -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,

View file

@ -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);
}); });
}); });