Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

fix: 配置支持小艺和飞书上传文件

douran2a232951a497
diff --git a/jiuwenclaw/agentserver/interface.py b/jiuwenclaw/agentserver/interface.py
index dadc03474b..6a51ad1722 100644
--- a/jiuwenclaw/agentserver/interface.py
+++ b/jiuwenclaw/agentserver/interface.py
@@ -529,6 +529,8 @@ class JiuWenClaw:
self._instance.ability_manager.remove(tool.name)
elif tool.name.startswith("session_"):
self._instance.ability_manager.remove(tool.name)
+ elif tool.name.startswith("send_file_to_user"):
+ self._instance.ability_manager.remove(tool.name)
# 定时工具:按 channel 注册;优先用 channel_id,否则从 session_id 前缀推断
channel = (channel_id or "").strip() or (
@@ -551,22 +553,24 @@ class JiuWenClaw:
Runner.resource_mgr.add_tool(cron_tool)
self._instance.ability_manager.add(cron_tool.card)
- # 小艺手机端插件(xiaoyi phone tools)未生效时重新加载
config_base = get_config()
- channels_cfg = config_base.get("channels", {})
- xiaoyi_cfg = channels_cfg.get("xiaoyi", {})
- xiaoyi_phone_tools_enabled = xiaoyi_cfg.get("phone_tools_enabled", False)
- if xiaoyi_phone_tools_enabled:
+ send_file_tool_enabled = config_base.get("channels", {}).get(channel, {}).get("send_file_allowed", False)
+ if send_file_tool_enabled:
# Register send file toolkit
send_file_toolkit = SendFileToolkit(
request_id=request_id,
- session_id=effective_session_id,
+ session_id=session_id,
channel_id=channel_id,
)
for tool in send_file_toolkit.get_tools():
Runner.resource_mgr.add_tool(tool)
self._instance.ability_manager.add(tool.card)
+ # 小艺手机端插件(xiaoyi phone tools)未生效时重新加载
+ channels_cfg = config_base.get("channels", {})
+ xiaoyi_cfg = channels_cfg.get("xiaoyi", {})
+ xiaoyi_phone_tools_enabled = xiaoyi_cfg.get("phone_tools_enabled", False)
+
if xiaoyi_phone_tools_enabled and not self._xiaoyi_phone_tools_registered:
try:
phone_tools = [
diff --git a/jiuwenclaw/resources/config.yaml b/jiuwenclaw/resources/config.yaml
index 8486a15ee1..29104c5274 100644
--- a/jiuwenclaw/resources/config.yaml
+++ b/jiuwenclaw/resources/config.yaml
@@ -130,6 +130,7 @@ channels:
allow_from:
enable_streaming: false
enabled: false
+ send_file_allowed: true
feishu_enterprise:
# 企业飞书多 Bot 配置(每个 bot 会注册为独立 channel: feishu_enterprise:<app_id>)
# bot_a:
@@ -160,6 +161,7 @@ channels:
file_upload_url:
# 小艺手机端插件tools调用,会添加相关tools到系统提示词
phone_tools_enabled: false
+ send_file_allowed: true
dingtalk:
# 钉钉应用配置
client_id: