AskChat
一个用于服务器的 AI 聊天助手。玩家通过在聊天中使用 !ask <问题> 提问,由可配置的 AI 人格(默认为 "Notch")回答,并可调用工具以获取实时信息。
支持三种提供商——Gemini(默认)、Ollama(本地或云端)和 NVIDIA NIM,并提供针对 Web 搜索(Brave)和 Minecraft Wiki 的智能体工具使用功能。
示例


功能
- 基于聊天的界面: 无需离开你的 Minecraft 世界即可提问并获取回答。
- 可配置:
- 自定义 AI 的提示词以引导其回复。
- 更改聊天中机器人的名称。
- 可选择将问题与答案同时广播至服务器。
- 轻量级: 旨在将对服务器性能的影响降至最低。
安装
- 将对应的 jar 文件放入服务器的
plugins/ 目录中。
- 启动服务器一次,以生成
plugins/AiChatBuddy/config.yml。
- 停止服务器,编辑
config.yml(见下文),然后重新启动——或者在运行时直接编辑并执行 /aichat reload。
配置
默认 config.yml:
provider: gemini # gemini | ollama | nvidia
bot-name: "Notch"
private-questions: false # true = whisper replies, false = broadcast
max-history: 8 # rolling per-player message history; 0 = stateless
agent-max-steps: 8 # max tool-calling iterations before forcing a best-effort answer
prompt-template: |
You are Notch — the ancient architect and silent overseer ...
(full Notch persona, see config.yml)
providers:
gemini:
api-key: ""
api-url: "
temperature: 0.5
top-p: 0.99
ollama:
base-url: " # or for cloud
api-key: "" # cloud only
model: "gpt-oss:20b"
temperature: 0.7
nvidia:
base-url: "
api-key: "" # must start with nvapi-
model: "meta/llama-3.3-70b-instruct"
temperature: 0.5
tools:
web-search:
enabled: true
api-key: "" # Brave Search API key; tool is hidden from the LLM if blank
max-results: 3
minecraft-wiki:
enabled: true
max-results: 3
你只需填写想要使用的提供商(provider)和工具(tool)的 API 密钥。未配置的提供商或工具将被自动跳过。
---
## 获取 API 密钥
### Gemini(默认,提供免费层级)
1. 前往
2. 使用 Google 账号登录。
3. 点击 **创建 API 密钥**。
4. 将密钥(以 `AIza…` 开头)复制到 `providers.gemini.api-key` 中。
通过编辑 `providers.gemini.api-url` 来切换模型 —— URL 中包含模型名称。默认值为 `gemma-4-31b-it`(支持函数调用、速度快、免费)。其他不错的选择:
- `gemini-2.5-flash` — 速度快、成本低、工具使用能力强。
- `gemini-2.5-pro` — 质量更好,速度较慢。
- `gemma-4-26b-a4b-it` — 更大的上下文窗口,每个 token 仅激活约 4B 参数。
### Brave Search(用于 `web_search` 工具)
1. 访问 <https://brave.com/search/api/>。
2. 点击 **Get Started** 并注册账号。
3. 订阅 **Free** 计划(每秒 1 次查询,每月 2000 次查询)。
4. 在仪表板中,于 **API Keys** 下创建一个 API 密钥。
5. 将其粘贴到 `tools.web-search.api-key` 中。留空则禁用网络搜索。
### NVIDIA NIM(免费层级)
1. 访问 <https://build.nvidia.com/>。
2. 使用 NVIDIA Developer 凭据登录。
3. 打开任意模型页面(例如 <https://build.nvidia.com/meta/llama-3_3-70b-instruct>)。
4. 点击右上角的 **Get API Key**。
5. 复制该密钥(以 `nvapi-` 开头),粘贴到 `providers.nvidia.api-key` 中。
推荐用于 `providers.nvidia.model` 的模型:
- `meta/llama-3.3-70b-instruct`(默认)
- `nvidia/llama-3.1-nemotron-70b-instruct`
- `mistralai/mixtral-8x22b-instruct-v0.1`
### Ollama
你可以 **本地** 运行 Ollama(免费、私密),或使用 Ollama 云服务。
**本地:**
1. 从 <https://ollama.com/download> 安装 Ollama。
2. 拉取一个支持工具调用的模型,例如 `ollama pull llama3.1` 或 `ollama pull qwen2.5`。
3. 在 `config.yml` 中配置:
- `providers.ollama.base-url: "http://localhost:11434"`
- `providers.ollama.api-key: ""`(本地运行无需此密钥)
- `providers.ollama.model: "llama3.1"`(或你拉取的任意模型名称)
**云端:**
1. 在 <https://ollama.com/> 注册账号。
2. 在账户设置中生成一个 API 密钥。
3. 在 `config.yml` 中配置:
- `providers.ollama.base-url: "https://ollama.com"`
- `providers.ollama.api-key: "<your-key-key>"`
- `providers.ollama.model: "gpt-oss:20b"`(或 `gpt-oss:120b`、`qwen3-coder:480b`、`deepseek-v3.1:671b`、`glm-4.7`、`kimi-k2.6` 等)
随时可通过编辑 `provider:` 并运行 `/aichat reload` 来切换提供商。
---
## 命令
| 命令 | 权限 | 描述 |
| ------- | ---------- | ----------- |
| `!ask <question>` | `aichatbuddy.ask`(默认:所有人) | 在聊天中向 AI 提问。 |
| `/aichat reload` | `aichatbuddy.reload`(默认:OP) | 重新加载 `config.yml` 并清除内存中的历史记录。 |
| `/aichat forget` | `aichatbuddy.forget.self`(默认:所有人) | 清除你自己的对话历史。 |
| `/aichat forget <player>` | `aichatbuddy.forget.others`(默认:OP) | 清除其他玩家的历史记录。 |
---
## 使用方法
在聊天中输入 `!ask` 后接你的问题,例如:`!ask How do I make a crafting table?`。AI 将回复答案。
## 支持与反馈
如果你有任何问题、错误或功能建议,请在 [GitHub]([link-to-your-github-repo](https://github.com/mrgucci1/AiChatBuddy) 上提交 Issue。
## 贡献
欢迎贡献!请随时 fork 本仓库并提交拉取请求。
## 许可证
本项目基于 [MIT 许可证](LICENSE) 开源。
AskChat
An AI chat assistant for servers. Players ask questions in chat with !ask <question> and a configurable AI persona ("Notch" by default) answers, optionally calling tools to fetch live information.
Supports three providers — Gemini (default), Ollama (local or cloud), and NVIDIA NIM — with agentic tool use for web search (Brave) and the Minecraft Wiki.
Examples


Features
- Chat-Based Interface: Ask questions and receive answers without leaving your Minecraft world.
- Configurable:
- Customize the AI's prompt to guide its responses.
- Change the bot's name in chat.
- Optionally broadcast both the question and the answer to the server.
- Lightweight: Designed to minimize impact on server performance.
Installation
- Drop the matching jar into your server's
plugins/ directory.
- Start the server once to generate
plugins/AiChatBuddy/config.yml.
- Stop the server, edit
config.yml (see below), and start again — or edit live and run /aichat reload.
Configuration
Default config.yml:
provider: gemini # gemini | ollama | nvidia
bot-name: "Notch"
private-questions: false # true = whisper replies, false = broadcast
max-history: 8 # rolling per-player message history; 0 = stateless
agent-max-steps: 8 # max tool-calling iterations before forcing a best-effort answer
prompt-template: |
You are Notch — the ancient architect and silent overseer ...
(full Notch persona, see config.yml)
providers:
gemini:
api-key: ""
api-url: "https://generativelanguage.googleapis.com/v1beta/models/gemma-4-31b-it:generateContent"
temperature: 0.5
top-p: 0.99
ollama:
base-url: "http://localhost:11434" # or https://ollama.com for cloud
api-key: "" # cloud only
model: "gpt-oss:20b"
temperature: 0.7
nvidia:
base-url: "https://integrate.api.nvidia.com"
api-key: "" # must start with nvapi-
model: "meta/llama-3.3-70b-instruct"
temperature: 0.5
tools:
web-search:
enabled: true
api-key: "" # Brave Search API key; tool is hidden from the LLM if blank
max-results: 3
minecraft-wiki:
enabled: true
max-results: 3
You only need to fill in the api-keys for the provider(s) and tool(s) you want to use. Unconfigured providers/tools are simply skipped.
Getting API keys
Gemini (default, free tier available)
- Go to
- Sign in with a Google account.
- Click Create API key.
- Copy the key (starts with
AIza…) into providers.gemini.api-key.
Switch models by editing providers.gemini.api-url — the URL contains the model name. Defaults to gemma-4-31b-it (function-calling capable, fast, free). Other good choices:
gemini-2.5-flash — fast, low-cost, strong tool use.
gemini-2.5-pro — better quality, slower.
gemma-4-26b-a4b-it — bigger context window, only ~4B active params per token.
Brave Search (for the web_search tool)
- Go to .
- Click Get Started and sign up.
- Subscribe to the Free plan (1 query/sec, 2k queries/month).
- In the dashboard, create an API key under API Keys.
- Paste it into
tools.web-search.api-key. Leave blank to disable web search.
NVIDIA NIM (free tier)
- Go to .
- Sign in with NVIDIA Developer credentials.
- Open any model (e.g. ).
- Click Get API Key in the top right.
- Copy the key (starts with
nvapi-) into providers.nvidia.api-key.
Recommended models for providers.nvidia.model:
meta/llama-3.3-70b-instruct (default)
nvidia/llama-3.1-nemotron-70b-instruct
mistralai/mixtral-8x22b-instruct-v0.1
Ollama
You can run Ollama locally (free, private) or use Ollama cloud.
Local:
- Install Ollama from .
- Pull a model that supports tool calls, e.g.
ollama pull llama3.1 or ollama pull qwen2.5.
- In
config.yml:
providers.ollama.base-url: "http://localhost:11434"
providers.ollama.api-key: "" (not needed locally)
providers.ollama.model: "llama3.1" (or whichever you pulled)
Cloud :
- Sign up at .
- Generate an API key under your account settings.
- In
config.yml:
providers.ollama.base-url: "https://ollama.com"
providers.ollama.api-key: "<your-key-key>"
providers.ollama.model: "gpt-oss:20b" (or gpt-oss:120b, qwen3-coder:480b, deepseek-v3.1:671b, glm-4.7, kimi-k2.6, etc.)
Switch providers at any time by editing provider: and running /aichat reload.
Commands
| Command |
Permission |
Description |
!ask <question> |
aichatbuddy.ask (default: everyone) |
Ask the AI in chat. |
/aichat reload |
aichatbuddy.reload (default: op) |
Reload config.yml and clear in-memory history. |
/aichat forget |
aichatbuddy.forget.self (default: everyone) |
Clear your own conversation history. |
/aichat forget <player> |
aichatbuddy.forget.others (default: op) |
Clear another player's history. |
Usage
Type !ask followed by your question in the chat, e.g., !ask How do I make a crafting table?. The AI will respond with an answer.
Support & Feedback
If you have any questions, issues, or feature requests, please open an issue on [GitHub](link-to-your-github-repo.
Contributing
Contributions are welcome! Please feel free to fork this repository and submit pull requests.
License
This project is licensed under the MIT License.
评论 0
登录后参与评分
还没有评论,来抢沙发吧