Skip to content

Commit d85a122

Browse files
Add FeiShuTools for enhanced messaging capabilities
- Introduced the FeiShuTools class to facilitate sending various message types (text, image, file, audio, media) through the Feishu platform. - Updated README files to include new methods and usage instructions for FeiShuTools, enhancing user guidance for integration. - Refactored existing code to utilize FeiShuTools, improving modularity and maintainability of the messaging functionality.
1 parent 3144073 commit d85a122

8 files changed

Lines changed: 523 additions & 330 deletions

File tree

README-zh_CN.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ OpenFox 从 **`~/.openfox/config.json`** 读取 JSON 配置,字段对应 `open
286286
|--------|------|
287287
| **ShellTools** | 在运行 OpenFox 的机器上执行 Shell 命令(Agno) |
288288
| **SchedulerTools** |`tools.scheduler.activate` 为 true 时注册。创建 / 列出 / 获取 / 删除 / 禁用定时任务;Cron 表达式触发对本 Agent 运行端点的回调 |
289+
| **FeiShuTools** | 飞书消息发送工具:`send_text_message``send_image_message``send_file_message``send_audio_message``send_media_message` |
289290
| **MCPConfigTools** | 在对话中增删改 MCP 相关配置声明,便于动态扩展工具 |
290291
| **WebSearchTools** | 联网搜索网页信息 |
291292
| **ArxivTools** | 检索 [arXiv](https://arxiv.org/) 论文与元数据 |
@@ -338,6 +339,14 @@ python -m openfox
338339
3. 将上述信息写入 `~/.openfox/config.json``channels.feishu`,重启 `python -m openfox`
339340
4. 在飞书单聊或群聊中使用应用能力(如 @ 机器人)与 OpenFox 对话。
340341

342+
FeiShuTools 可用方法(对话工具):
343+
344+
- `send_text_message`:发送纯文本或 markdown 卡片文本。
345+
- `send_image_message`:通过 `image_key` 或 URL/路径上传后发送图片。
346+
- `send_file_message`:通过 `file_key` 或 URL/路径上传后发送文件。
347+
- `send_audio_message`:上传并发送 OPUS 语音。
348+
- `send_media_message`:上传并发送 MP4 视频,可选缩略图。
349+
341350
---
342351

343352
## 模型(LiteLLM)

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ You can edit the live file in the Web **Config** page or via the **expand/config
286286
|------------|----------------|
287287
| **ShellTools** | Run shell commands on the host where OpenFox runs (Agno) |
288288
| **SchedulerTools** | Registered when `tools.scheduler.activate` is true. Create / list / get / delete / disable jobs; cron expressions invoke this Agent's run endpoint |
289+
| **FeiShuTools** | Feishu outbound messaging toolkit: `send_text_message`, `send_image_message`, `send_file_message`, `send_audio_message`, `send_media_message` |
289290
| **MCPConfigTools** | Add / remove / update MCP-related config in chat to extend tools dynamically |
290291
| **WebSearchTools** | Search the web |
291292
| **ArxivTools** | Search [arXiv](https://arxiv.org/) papers and metadata |
@@ -338,6 +339,14 @@ Steps in brief:
338339
3. Write these into `channels.feishu` in `~/.openfox/config.json`, then restart `python -m openfox`.
339340
4. In Feishu DM or group chat, use the app (e.g. @ bot) to talk to OpenFox.
340341

342+
FeiShuTools methods (chat tools):
343+
344+
- `send_text_message`: send plain text or markdown card text.
345+
- `send_image_message`: send by `image_key` or upload from URL/path.
346+
- `send_file_message`: send by `file_key` or upload from URL/path.
347+
- `send_audio_message`: upload/send OPUS audio.
348+
- `send_media_message`: upload/send MP4 video, optional thumbnail.
349+
341350
---
342351

343352
## Models (LiteLLM)

openfox/channels/base.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ def __init__(
2424
def start(self):
2525
raise NotImplementedError
2626

27-
@abstractmethod
28-
def send_message(self, receive_id: str, content: Any, msg_type: str = "text", **kwargs):
29-
raise NotImplementedError
30-
3127
@abstractmethod
3228
async def on_notify_scheduled(run_output: RunOutput, channel: Dict[str, Any]) -> None:
3329
raise NotImplementedError

0 commit comments

Comments
 (0)