Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Docs/Bot_Commands_User_Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@
* **权限**: 普通管理员或全局管理员。
* **相关指令**: `选择音乐模型` 显示可用音乐模型并通过编号选择,`音乐模型` / `查看音乐模型` 查看当前音乐模型,`清除音乐模型` 恢复使用全局默认。

* **Agent 聊天模式**
* **指令格式**: `开启Agent聊天` / `开启Agent引导聊天`
* **功能**: 在当前群开启引导模式。普通文本、Caption、OCR/QR/ASR 提取结果会在短时间窗口内合并成一次 Agent 输入并自动回复。
* **指令格式**: `开启Agent队列聊天`
* **功能**: 在当前群开启队列模式。每条触发消息都会按顺序进入 Agent 队列并分别回复。
* **指令格式**: `关闭Agent聊天` / `Agent聊天状态` / `查看Agent聊天`
* **功能**: 关闭或查看当前群 Agent 聊天模式。
* **权限**: 普通管理员或全局管理员。
* **要求**: 需要已设置群 LLM 模型,并启用 `EnableLLMAgentProcess=true`。

Comment thread
coderabbitai[bot] marked this conversation as resolved.
### 2. 全局管理员指令

以下指令仅限机器人全局管理员(在 `Env.cs` 中配置的 `AdminId`)使用。
Expand Down Expand Up @@ -355,6 +365,7 @@
* **触发方式1 (提及机器人)**: 在消息中 `@机器人用户名 <你的消息>`。
* **示例**: `@MyAwesomeBot 帮我总结一下这篇文章的主要内容。`
* **触发方式2 (回复机器人消息)**: 直接回复机器人的某条消息。
* **触发方式3 (Agent 聊天模式)**: 管理员开启 `开启Agent聊天` / `开启Agent引导聊天` 或 `开启Agent队列聊天` 后,群内普通文本、Caption 和媒体提取结果会自动触发 LLM。
* **功能**: 将您的消息发送给配置的LLM进行处理,并回复LLM的响应。
* **工具调用迭代限制**: 为防止LLM无限调用工具,机器人默认限制为25次工具调用(可通过 `MaxToolCycles` 配置)。当达到限制时:
* 机器人会保存当前对话快照到Redis
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@

### AI交互
- @机器人 + 问题: 使用配置的LLM回复
- 管理员发送 `开启Agent聊天` / `开启Agent引导聊天`: 当前群进入引导模式,普通文本、Caption 以及 OCR/QR/ASR 提取内容会短窗口合并后自动触发 Agent 回复
- 管理员发送 `开启Agent队列聊天`: 当前群进入逐条队列模式,每条触发消息按顺序进入 Agent 队列
- 管理员发送 `关闭Agent聊天` / `Agent聊天状态` / `查看Agent聊天`: 关闭或查看当前群 Agent 聊天模式

完整命令列表: [Docs/Bot_Commands_User_Guide.md](Docs/Bot_Commands_User_Guide.md)

Expand Down
9 changes: 9 additions & 0 deletions TelegramSearchBot.Common/Model/AI/LlmAgentContracts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ public static class LlmAgentRedisKeys {
public const string ActiveTaskSet = "AGENT_ACTIVE_TASKS";
public const string SubAgentTaskQueue = "SUBAGENT_TASKS";
public const string AgentToolDefs = "AGENT_TOOL_DEFS";
public const string AgentChatBatchDueSet = "AGENT_CHAT_BATCH_DUE";

public static string AgentTaskState(string taskId) => $"AGENT_TASK:{taskId}";
public static string AgentSnapshot(string taskId) => $"AGENT_SNAPSHOT:{taskId}";
Expand All @@ -239,5 +240,13 @@ public static class LlmAgentRedisKeys {
public static string SandboxToolQueue(long chatId) => $"SANDBOX_TOOL_TASKS:{chatId}";
public static string SandboxToolHeartbeat(long chatId) => $"SANDBOX_TOOL_HEARTBEAT:{chatId}";
public static string SandboxToolResult(string requestId) => $"SANDBOX_TOOL_RESULT:{requestId}";
public static string ModelSelectState(long chatId) => $"modelselect:{chatId}:state";
public static string ModelSelectModels(long chatId) => $"modelselect:{chatId}:models";
public static string ImageGenerationModelSelection(long chatId, long userId) => $"image_generation:model_select:{chatId}:{userId}";
public static string MusicGenerationModelSelection(long chatId, long userId) => $"music_generation:model_select:{chatId}:{userId}";
public static string AgentChatBatchList(long chatId) => $"AGENT_CHAT_BATCH:{chatId}:MESSAGES";
public static string AgentChatBatchMeta(long chatId) => $"AGENT_CHAT_BATCH:{chatId}:META";
public static string AgentChatBatchLock(long chatId) => $"AGENT_CHAT_BATCH:{chatId}:LOCK";
public static string AgentChatConfigWarning(long chatId, string warningType) => $"AGENT_CHAT_WARNING:{chatId}:{warningType}";
}
}
Loading
Loading