GamesAI

此插件可以将MCDR与支持OpenAI的AI进行结合,使得在游戏内也能使用AI

工具

一键安装指令

!!MCDR plugin install games_ai

作者

数据同步于

...

上次更新

...

最新版本

总下载量

48

返回插件仓库

Note

Welcome to version 0.3.2. This version fixes several issues and splits the command for adding data to the public database into two modes: overwrite and append. See This Update.

Important

Version 0.2.1 changes the help command from !!openai to !!gamesai.

Table of Contents (click to expand)

Installation

Use the following command in the MCDR console to install the plugin:

!!MCDR plugin install games_ai


Alternatively, get it from the MCDR Plugin Repository and install it into your plugin directory.

If you choose to install manually, first install the Python package OpenAI using the following command:

pip install openai

Usage

Enter the command !!gamesai anywhere to display all functions of this plugin.

You can also directly type !!ask to ask the AI questions or chat.


Type !!data to get information about database commands.

Tip

When updating to version 0.3.0 or above, the database will be added automatically.

!!data commands are as follows:

CommandDescription
!!data write <key> <value>Add a piece of data to the public database. The key cannot contain spaces; the value can be any string.
!!data add <key> <value>Append the value to an existing key in the public database. If the key does not exist, a new key is created automatically.
!!data del <key>Delete a piece of data from the public database, regardless of whether the key exists.
!!data read <key>Read the value corresponding to the key in the public database.
!!data listRead all contents of the public database.
!!data list keysRead all keys in the public database.

Configuration

The default configuration file structure is as follows:

{
    "system_message": "Respond concisely but with a touch of emotion. If you want to obtain the list of online players, reply get_players; if you want to obtain the server whitelist (i.e., the full member list), reply get_whitelist. You are a bot on a Minecraft server.",
    "prefix": "[GamesAI]",
    "permission": 3,
    "base_url":"<Your API Base URL>",
    "ai_model":"<Your AI Model>",
    "api_key":"<Your API Key>",
    "max_history": 10
}

Below is a brief description of each parameter:

1. system_message:

Type: str

Default value: See the content in the file above.

Enter your default prompt. If left blank, the default value from the file above will be used.

2. prefix

Type: str

Default value: [GamesAI]

Enter the name of this AI to add a prefix before the AI's replies. Minecraft formatting codes can be included.

3. permission

Type: int

Default value: 3

The permission level required to execute commands such as !!data. See the MCDR permission documentation.

4. base_url

Warning

This field must be filled in; otherwise, an error will occur.

Type: str

Default value: none

Enter your API server address.

5. ai_model

Warning

This field must be filled in; otherwise, an error will occur.

Type: str

Default value: none

Enter the AI model you wish to use.

6. api_key

Warning

This field must be filled in; otherwise, an error will occur.

Type: str

Default value: none

Enter your API key.

7. max_history

Type: int

Default value: 10

Enter the maximum number of chat history records to keep per player. This is independent of the public database.

Acknowledgements and Disclaimer

Special thanks to Wanghai Commune Server for providing the foundation for testing this plugin.

All content generated by the AI (LLM) model is unrelated to this plugin.

This Update

This update mainly distinguishes between the !!data write and !!data add commands: one for overwriting and one for appending.

Additionally, after reading data (!!data read), this update adds the ability to copy the command !!data write to the input box (e.g., if the key is test and the value is test, the text copied to the input box would be !!data write test test). However, if the data is too long, copying may not be possible. The ability to copy to the clipboard has also been added.

自述文件来源:README.md