myagent-ai 1.47.35 → 1.47.36
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 +17 -8
- package/package.json +1 -1
package/core/tool_dispatcher.py
CHANGED
|
@@ -120,7 +120,7 @@ class ToolDispatcher:
|
|
|
120
120
|
"""
|
|
121
121
|
# ── 内置平台工具 (LLM 直接调用) ──
|
|
122
122
|
if tool_name == "command":
|
|
123
|
-
return await self._exec_command(params, timeout, task_id, stream_callback, sent_files)
|
|
123
|
+
return await self._exec_command(params, timeout, task_id, stream_callback, sent_files, agent_path)
|
|
124
124
|
elif tool_name == "web_control":
|
|
125
125
|
return await self._exec_web_control(params, task_id, stream_callback)
|
|
126
126
|
|
|
@@ -183,7 +183,8 @@ class ToolDispatcher:
|
|
|
183
183
|
|
|
184
184
|
async def _exec_command(self, params: Dict, timeout: int, task_id: str,
|
|
185
185
|
stream_callback: Optional[Callable] = None,
|
|
186
|
-
sent_files: Optional[List[Dict[str, Any]]] = None
|
|
186
|
+
sent_files: Optional[List[Dict[str, Any]]] = None,
|
|
187
|
+
agent_path: Optional[str] = None) -> Dict:
|
|
187
188
|
"""执行 shell 命令"""
|
|
188
189
|
code_text = params.get("command", "")
|
|
189
190
|
if not code_text:
|
|
@@ -227,9 +228,13 @@ class ToolDispatcher:
|
|
|
227
228
|
_to_name = _match[1].strip()
|
|
228
229
|
_content = _match[2].strip()
|
|
229
230
|
|
|
230
|
-
# 获取当前 agent
|
|
231
|
-
_from_path =
|
|
232
|
-
|
|
231
|
+
# 获取当前 agent 的路径和名称
|
|
232
|
+
_from_path = agent_path if agent_path else "unknown"
|
|
233
|
+
# 从 agent_path 解析 agent 名称
|
|
234
|
+
if _from_path and _from_path.startswith("agents/"):
|
|
235
|
+
_from_name = _from_path.replace("agents/", "").split("/")[-1]
|
|
236
|
+
else:
|
|
237
|
+
_from_name = _from_path if _from_path else "未知"
|
|
233
238
|
|
|
234
239
|
_gm.add_agent_chat(
|
|
235
240
|
group_id="",
|
|
@@ -285,9 +290,13 @@ class ToolDispatcher:
|
|
|
285
290
|
_to_name = _match[1].strip()
|
|
286
291
|
_content = _match[2].strip()
|
|
287
292
|
|
|
288
|
-
# 获取当前 agent
|
|
289
|
-
_from_path =
|
|
290
|
-
|
|
293
|
+
# 获取当前 agent 的路径和名称
|
|
294
|
+
_from_path = agent_path if agent_path else "unknown"
|
|
295
|
+
# 从 agent_path 解析 agent 名称
|
|
296
|
+
if _from_path and _from_path.startswith("agents/"):
|
|
297
|
+
_from_name = _from_path.replace("agents/", "").split("/")[-1]
|
|
298
|
+
else:
|
|
299
|
+
_from_name = _from_path if _from_path else "未知"
|
|
291
300
|
|
|
292
301
|
_gm.add_agent_chat(
|
|
293
302
|
group_id="",
|