diff --git a/.gitignore b/.gitignore index a2aee7e..6dc4554 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,10 @@ code_records/ scratch.js bots/**/action-code/** bots/**/ -keys.json \ No newline at end of file +keys.json +services/viaproxy/jars/** +services/viaproxy/logs/** +services/viaproxy/plugins/** +services/viaproxy/ViaLoader/** +services/viaproxy/saves.json +services/viaproxy/viaproxy.yml diff --git a/README.md b/README.md index a815028..018d144 100644 --- a/README.md +++ b/README.md @@ -46,9 +46,29 @@ You can configure the agent's name, model, and prompts in their profile like `an You can configure project details in `settings.js`. [See file for more details](settings.js) +### Run in docker to reduce some of the risks + +If you intent to `allow_insecure_coding`, it might be a good idea to put the whole app into a docker container to reduce risks of running unknown code. + +```bash +docker run -i -t --rm -v $(pwd):/app -w /app -p 3000-3003:3000-3003 node:latest node main.js +``` +or simply +```bash +docker-compose up +``` + +When running in docker, if you want the bot to join your local minecraft server, you have to use a special host address `host.docker.internal` to call your localhost from inside your docker container. Put this into your [settings.js](settings.js): + +```javascript +"host": "host.docker.internal", // instead of "localhost", to join your local minecraft from inside the docker container +``` + +To connect to an unsupported minecraft version, you can try to use [viaproxy](services/viaproxy/README.md) + ### Online Servers To connect to online servers your bot will need an official Microsoft/Minecraft account. You can use your own personal one, but will need another account if you want to connect with it. Here are example settings for this: -``` +```javascript "host": "111.222.333.444", "port": 55920, "auth": "microsoft", @@ -69,13 +89,15 @@ Bot profiles are json files (such as `andy.json`) that define: By default, the program will use the profiles specified in `settings.js`. You can specify one or more agent profiles using the `--profiles` argument: -`node main.js --profiles ./profiles/andy.json ./profiles/jill.json` +```bash +node main.js --profiles ./profiles/andy.json ./profiles/jill.json +``` ### Model Specifications LLM backends can be specified as simply as `"model": "gpt-3.5-turbo"`. However, for both the chat model and the embedding model, the bot profile can specify the below attributes: -``` +```json "model": { "api": "openai", "url": "https://api.openai.com/v1/", @@ -94,15 +116,15 @@ If the embedding field is not specified, then it will use the default embedding Thus, all the below specifications are equivalent to the above example: -``` +```json "model": "gpt-3.5-turbo" ``` -``` +```json "model": { "api": "openai" } ``` -``` +```json "model": "gpt-3.5-turbo", "embedding": "openai" ``` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d9822f1 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: '3.8' + +services: + app: + image: node:latest + working_dir: /app + volumes: + - .:/app + command: node main.js + ports: + - "3000-3003:3000-3003" # see the view from the camera mounted on your bot head: http://localhost:3000/ + + viaproxy: #use this service to connect to an unsupported minecraft server versions. more info: ./services/viaproxy/README.md + image: ghcr.io/viaversion/viaproxy:latest + volumes: + - ./services/viaproxy:/app/run + ports: + - "25568:25568" + profiles: + - viaproxy diff --git a/services/viaproxy/README.md b/services/viaproxy/README.md new file mode 100644 index 0000000..d1ed687 --- /dev/null +++ b/services/viaproxy/README.md @@ -0,0 +1,25 @@ +Use this service to connect your bot to an unsupported minecraft server versions. + +Run: + +```bash +docker-compose --profile viaproxy up +``` + +After first start it will create config file `services/viaproxy/viaproxy.yml`. + +Edit this file, and change your desired target `target-address`, + +then point your `settings.js` `host` and `port` to viaproxy endpoint: + +```javascript + "host": "host.docker.internal", + "port": 25568, +``` + +This easily works with "offline" servers. + +Connecting to "online" servers via viaproxy involves more effort: see `auth-method` in `services/viaproxy/viaproxy.yml` (TODO describe) + + +