myagent-ai 1.23.32 → 1.23.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/tool_dispatcher.py +6 -14
- package/package.json +1 -1
- package/skills/file_send.py +3 -0
package/core/tool_dispatcher.py
CHANGED
|
@@ -489,22 +489,14 @@ class ToolDispatcher:
|
|
|
489
489
|
fpath = _P(media_file).expanduser().resolve()
|
|
490
490
|
if not fpath.exists():
|
|
491
491
|
return {"success": False, "error": f"文件不存在: {media_file}"}
|
|
492
|
-
|
|
493
|
-
fskill = FileSendSkill()
|
|
492
|
+
# [v1.23.32] 使用统一入口 _exec_file_send(正确的 MIME + v2_file 推送 + sent_files 持久化)
|
|
494
493
|
desc = f"{'音频' if media_type == 'audio' else '视频'}播放: {fpath.name}"
|
|
495
|
-
fresult = await
|
|
494
|
+
fresult = await self._exec_file_send(
|
|
495
|
+
{"file_path": str(fpath), "description": desc},
|
|
496
|
+
task_id, stream_callback, sent_files,
|
|
497
|
+
)
|
|
496
498
|
if fresult.get("success"):
|
|
497
|
-
|
|
498
|
-
result = {"success": True, "output": f"已发送{media_type}文件: {fpath.name}", "data": fresult}
|
|
499
|
-
if sent_files is not None and fresult.get("file_id"):
|
|
500
|
-
sent_files.append({
|
|
501
|
-
"id": fresult["file_id"],
|
|
502
|
-
"name": fresult.get("name", ""),
|
|
503
|
-
"type": fresult.get("type", ""),
|
|
504
|
-
"size": fresult.get("size", 0),
|
|
505
|
-
"_media_type": media_type,
|
|
506
|
-
})
|
|
507
|
-
return result
|
|
499
|
+
return {"success": True, "output": f"已发送{media_type}文件: {fpath.name}", "data": fresult.get("data", {})}
|
|
508
500
|
else:
|
|
509
501
|
return {"success": False, "error": fresult.get("error", "文件发送失败")}
|
|
510
502
|
else:
|
package/package.json
CHANGED
package/skills/file_send.py
CHANGED
|
@@ -105,6 +105,9 @@ class FileSendSkill:
|
|
|
105
105
|
".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
106
106
|
".txt": "text/plain", ".csv": "text/csv", ".md": "text/markdown",
|
|
107
107
|
".json": "application/json", ".html": "text/html",
|
|
108
|
+
".mp3": "audio/mpeg", ".mp4": "video/mp4", ".wav": "audio/wav",
|
|
109
|
+
".webm": "video/webm", ".ogg": "audio/ogg", ".flac": "audio/flac",
|
|
110
|
+
".zip": "application/zip", ".tar.gz": "application/gzip",
|
|
108
111
|
}
|
|
109
112
|
mime = mime_map.get(fpath.suffix.lower(), "application/octet-stream")
|
|
110
113
|
size = stored_path.stat().st_size
|