feat(Agent): ChatAgent And AgentHub

1.Upgrade sqlalchemy to version 2.0
This commit is contained in:
yhjun1026 2023-10-18 18:04:02 +08:00
parent 65c745495b
commit 708557c70f
2 changed files with 2 additions and 1 deletions

View File

@ -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)

View File

@ -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),