diff --git a/pilot/base_modules/agent/controller.py b/pilot/base_modules/agent/controller.py index 29716239e..ef699a047 100644 --- a/pilot/base_modules/agent/controller.py +++ b/pilot/base_modules/agent/controller.py @@ -156,6 +156,7 @@ async def personal_agent_upload(doc_file: UploadFile = File(...), user: str = No try: agent_hub = AgentHub(PLUGINS_DIR) await agent_hub.upload_my_plugin(doc_file, user) + module_agent.refresh_plugins() return Result.succ(None) except Exception as e: logger.error("Upload Personal Plugin Error!", e) diff --git a/pilot/base_modules/agent/hub/agent_hub.py b/pilot/base_modules/agent/hub/agent_hub.py index 71b8c136a..063a2e03a 100644 --- a/pilot/base_modules/agent/hub/agent_hub.py +++ b/pilot/base_modules/agent/hub/agent_hub.py @@ -180,7 +180,7 @@ class AgentHub: os.remove(file_path) tmp_fd, tmp_path = tempfile.mkstemp(dir=os.path.join(self.plugin_dir)) with os.fdopen(tmp_fd, "wb") as tmp: - await tmp.write(await doc_file.read()) + tmp.write(await doc_file.read()) shutil.move( tmp_path, os.path.join(self.plugin_dir, doc_file.filename),