Merge remote-tracking branch 'Solenopsisbot/main' into remote-output

This commit is contained in:
MaxRobinsonTheGreat 2025-08-25 15:23:43 -05:00
commit 08fc1b4fcb
5 changed files with 30 additions and 10 deletions

View file

@ -29,6 +29,7 @@ const settings = {
"init_message": "Respond with hello world and your name", // sends to all on spawn
"only_chat_with": [], // users that the bots listen to and send general messages to. if empty it will chat publicly
"speak": false, // allows all bots to speak through system text-to-speech. works on windows, mac, on linux you need to `apt install espeak`
"chat_ingame": true, // bot responses are shown in minecraft chat
"language": "en", // translate to/from this language. Supports these language names: https://cloud.google.com/translate/docs/languages
"render_bot_view": false, // show bot's view in browser at localhost:3000, 3001...
@ -41,7 +42,7 @@ const settings = {
"max_messages": 15, // max number of messages to keep in context
"num_examples": 2, // number of examples to give to the model
"max_commands": -1, // max number of commands that can be used in consecutive responses. -1 for no limit
"verbose_commands": true, // show full command syntax
"show_command_syntax": "full", // "full", "shortened", or "none"
"narrate_behavior": true, // chat simple automatic actions ('Picking up item!')
"chat_bot_messages": true, // publicly chat messages to other bots

View file

@ -12,7 +12,7 @@ import { SelfPrompter } from './self_prompter.js';
import convoManager from './conversation.js';
import { handleTranslation, handleEnglishTranslation } from '../utils/translator.js';
import { addBrowserViewer } from './vision/browser_viewer.js';
import { serverProxy } from './mindserver_proxy.js';
import { serverProxy, sendOutputToServer } from './mindserver_proxy.js';
import settings from './settings.js';
import { Task } from './tasks/tasks.js';
import { say } from './speak.js';
@ -304,16 +304,24 @@ export class Agent {
if (checkInterrupt()) break;
this.self_prompter.handleUserPromptedCmd(self_prompt, isAction(command_name));
if (settings.verbose_commands) {
if (settings.show_command_syntax === "full") {
this.routeResponse(source, res);
}
else { // only output command name
else if (settings.show_command_syntax === "shortened") {
// show only "used !commandname"
let pre_message = res.substring(0, res.indexOf(command_name)).trim();
let chat_message = `*used ${command_name.substring(1)}*`;
if (pre_message.length > 0)
chat_message = `${pre_message} ${chat_message}`;
this.routeResponse(source, chat_message);
}
else {
// no command at all
let pre_message = res.substring(0, res.indexOf(command_name)).trim();
res = pre_message;
if (res.trim().length > 0)
this.routeResponse(source, res);
}
let execute_res = await executeCommand(this, res);
@ -379,7 +387,8 @@ export class Agent {
if (settings.speak) {
say(to_translate);
}
this.bot.chat(message);
if (settings.chat_ingame) {this.bot.chat(message);}
sendOutputToServer(this.name, message);
}
}

View file

@ -2,7 +2,7 @@ import { io } from 'socket.io-client';
import convoManager from './conversation.js';
import { setSettings } from './settings.js';
// agents connection to mindserver
// agent's individual connection to the mindserver
// always connect to localhost
class MindServerProxy {
@ -110,6 +110,12 @@ class MindServerProxy {
// Create and export a singleton instance
export const serverProxy = new MindServerProxy();
// for chatting with other bots
export function sendBotChatToServer(agentName, json) {
serverProxy.getSocket().emit('chat-message', agentName, json);
}
// for sending general output to server for display
export function sendOutputToServer(agentName, message) {
serverProxy.getSocket().emit('bot-output', agentName, message);
}

View file

@ -170,6 +170,10 @@ export function createMindServer(host_public = false, port = 8080) {
console.error('Error: ', error);
}
});
socket.on('bot-output', (agentName, message) => {
io.emit('bot-output', agentName, message);
});
});
let host = host_public ? '0.0.0.0' : 'localhost';

View file

@ -94,10 +94,10 @@
"description": "Whether to log all prompts to file. Can be very verbose.",
"default": false
},
"verbose_commands": {
"type": "boolean",
"description": "Whether to show full command syntax in bot responses. If false will use a shortened syntax.",
"default": true
"show_command_syntax": {
"type": "string",
"description": "Whether to show \"full\" command syntax, \"shortened\" command syntax, or \"none\"",
"default": "full"
},
"chat_bot_messages": {
"type": "boolean",