一款轻量级、完全异步的 Fabric 模组,将名为 Little Whale 的友好 AI 玩家带入你的 Minecraft 服务器。它支持任何兼容 OpenAI 的 API,能够以私聊或公聊的方式与玩家互动,理解上下文语境,并使用玩家的母语进行交流。
✨ 功能特性
-
3 种聊天模式 – 在私密、公开或混合模式之间切换:
- 私密模式(模式 1):玩家使用
@ai <消息> 与 AI 对话。只有发送者能看到回复。
- 公开模式(模式 2):所有公开聊天信息均被视为与 AI 的对话。AI 会向所有人公开回复。上下文全局共享。
-
混合模式(模式 3):@ai 触发私密对话,而普通聊天则触发公开的 AI 回复。私密和公开上下文保持分离。
-
感知玩家的 AI – 在公开/混合模式下,AI 通过 [玩家名称]: 消息 的格式知晓谁说了什么。它可以自然地以名字称呼玩家。
-
多语言支持 – AI 会自动使用玩家所使用的语言(如中文、英文等)进行回复。
-
仅纯文本 – AI 被指示绝不使用 Markdown、代码块或特殊格式,以确保输出在游戏聊天框中保持整洁。
-
安全且非阻塞 – 所有 HTTP 请求均在后台线程上运行;服务器主线程永远不会被阻塞。
-
上下文管理 – 在可配置的时间间隔后自动清除对话历史,或通过命令手动清除。
-
完全可配置 – 通过 config/aichat.json 更改 API 端点、模型、温度、系统提示词、前缀等设置。
-
管理员命令 – 强大的 /aichat 命令用于清除上下文、重新加载配置和查看状态。
? 安装
- 为 Minecraft 1.21.8 安装 Fabric。
- 下载模组
.jar 文件并将其放入 mods/ 文件夹。
- 启动服务器或客户端。默认配置文件将在
config/aichat.json 生成。
- 编辑
config/aichat.json 并填写你的 apiKey,以及(可选的)apiUrl。保存文件。
- 运行
/aichat reload(需要 OP 权限)或重启服务器。
⚙️ 配置 (config/aichat.json)
| Key |
Type |
Default |
Description |
apiUrl |
String |
https://open.bigmodel.cn/api/paas/v4/chat/completions |
API 端点 (兼容 OpenAI) |
apiKey |
String |
"" |
你的 API 密钥 |
systemPrompt |
String |
(多语言、防前缀、纯文本提示) |
定义 AI 行为的系统提示词 |
modelName |
String |
"general" |
发送给 API 的模型名称 |
temperature |
Double |
0.7 |
回复的创意程度 (0.0–2.0) |
autoClearContext |
Boolean |
true |
启用自动清除上下文 |
contextExpireSeconds |
Integer |
300 |
自动清除之间的间隔秒数 |
prefix |
String |
"<LittleWhale> " |
添加到每条 AI 回复的前缀 (支持颜色代码) |
mode |
Integer |
2 |
聊天模式:1 = 私人,2 = 公共,3 = 混合 |
? 用法
聊天触发器
- 私人 / 混合:在消息开头加上
@ai。例如:@ai How do I craft a furnace?
- 清除私人上下文:
@ai clear (适用于私人/混合模式)
- 公共模式:直接在聊天中说话——每条消息都会触发公共 AI 回复。
管理员命令 (需要 OP 权限,权限等级 2)
| 命令 |
描述 |
/aichat clear |
清除你自己的私人上下文(模式 1/3) |
/aichat clear <player> |
清除指定玩家的私人上下文 |
/aichat clearglobal |
清除全局公共对话上下文 |
/aichat clearall |
清除所有上下文(私人 + 全局) |
/aichat reload |
无需重启即可重新加载配置 |
| /aichat info | 显示当前设置(API、模型、模式等) |
A lightweight, fully asynchronous Fabric mod that brings a friendly AI player named Little Whale into your Minecraft server. Powered by any OpenAI-compatible API, it can chat with players in private or public, understand context, and speak their language.
✨ Features
- 3 Chat Modes – Switch between private, public, or mixed mode:
- Private (mode 1): Players use
@ai <message> to talk to the AI. Only the sender sees the reply.
- Public (mode 2): Every public chat message is treated as conversation with the AI. The AI replies publicly to everyone. Context is globally shared.
- Mixed (mode 3):
@ai triggers private conversation, while normal chat triggers public AI replies. Private and public contexts are kept separate.
- Player-aware AI – In public/mixed modes, the AI sees who said what via
[PlayerName]: message format. It can address players by name naturally.
- Multilingual – The AI automatically replies in the same language the player used (Chinese, English, etc.).
- Plain Text Only – The AI is instructed never to use Markdown, code blocks, or special formatting, keeping output clean for the in-game chat.
- Safe & Non‑blocking – All HTTP requests run on background threads; the server main thread is never blocked.
- Context Management – Auto-clears conversation history after a configurable interval or manually via commands.
- Fully Configurable – Change the API endpoint, model, temperature, system prompt, prefix, and more through
config/aichat.json.
- Admin Commands – Powerful
/aichat commands to clear contexts, reload config, and view status.
? Installation
- Install Fabric for Minecraft 1.21.8.
- Download the mod
.jar file and place it into the mods/ folder.
- Launch the server or client. A default configuration file will be generated at
config/aichat.json.
- Edit
config/aichat.json and fill in your apiKey and (optionally) apiUrl. Save the file.
- Run
/aichat reload (requires OP) or restart the server.
⚙️ Configuration (config/aichat.json)
| Key |
Type |
Default |
Description |
apiUrl |
String |
https://open.bigmodel.cn/api/paas/v4/chat/completions |
API endpoint (OpenAI-compatible) |
apiKey |
String |
"" |
Your API key |
systemPrompt |
String |
(multilingual, anti-prefix, plain‑text prompt) |
System prompt that defines AI behavior |
modelName |
String |
"general" |
Model name to send to the API |
temperature |
Double |
0.7 |
Creativity of responses (0.0–2.0) |
autoClearContext |
Boolean |
true |
Enable automatic context clearing |
contextExpireSeconds |
Integer |
300 |
Seconds between auto‑clears |
prefix |
String |
"<LittleWhale> " |
Prefix added to every AI reply (supports color codes) |
mode |
Integer |
2 |
Chat mode: 1 = private, 2 = public, 3 = mixed |
? Usage
Chat Triggers
- Private / Mixed: Start your message with
@ai. Example: @ai How do I craft a furnace?
- Clear private context:
@ai clear (works in private/mixed mode)
- Public mode: Just talk in chat – every message triggers a public AI reply.
Admin Commands (requires OP, permission level 2)
| Command |
Description |
/aichat clear |
Clear your own private context (mode 1/3) |
/aichat clear <player> |
Clear the private context of a specific player |
/aichat clearglobal |
Clear the global public conversation context |
/aichat clearall |
Clear all contexts (private + global) |
/aichat reload |
Reload the configuration without restarting |
/aichat info |
Display current settings (API, model, mode, etc.) |
评论 0
登录后参与评分
还没有评论,来抢沙发吧