mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-27 14:25:20 +02:00
feat: +path
This commit is contained in:
parent
a7b933311e
commit
c5e16330a2
1 changed files with 6 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import base64
|
||||
import os.path
|
||||
import traceback
|
||||
import uuid
|
||||
from typing import Optional
|
||||
|
|
@ -138,8 +139,11 @@ class S3:
|
|||
await file.write(data)
|
||||
|
||||
bucket = CONFIG.S3.get("bucket")
|
||||
await self.upload_file(bucket=bucket, local_path=pathname, object_name=object_name)
|
||||
return await self.get_object_url(bucket=bucket, object_name=object_name)
|
||||
object_pathname = CONFIG.S3.get("path") or "system"
|
||||
object_pathname += f"/{object_name}"
|
||||
object_pathname = os.path.normpath(object_pathname)
|
||||
await self.upload_file(bucket=bucket, local_path=pathname, object_name=object_pathname)
|
||||
return await self.get_object_url(bucket=bucket, object_name=object_pathname)
|
||||
except Exception as e:
|
||||
logger.exception(f"{e}, stack:{traceback.format_exc()}")
|
||||
return None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue