Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix load oss files #315

Merged
merged 4 commits into from
Dec 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/pai_rag/utils/oss_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,18 @@ def list_objects(self, prefix: str):
"""
列出存储桶中指定前缀的对象列表。

该方法通过调用oss bucket的list_objects函数,查询与给定前缀匹配的所有对象,并返回这些对象的列表。

参数:
- prefix (str): 对象名的前缀,用于筛选满足条件的对象。默认为空字符串,表示不指定前缀,即列出所有对象。

返回:
- list: 包含满足前缀条件的所有对象的列表。
"""
# 调用bucket的list_objects方法,传入前缀参数
res = self.bucket.list_objects(prefix=prefix)
# 返回查询到的对象列表
return res.object_list
object_list = []
for obj in oss2.ObjectIteratorV2(self.bucket, prefix):
logger.info("file: " + obj.key)
object_list.append(obj)
return object_list

def put_object_acl(self, key, permission):
if key.endswith(".txt"):
Expand Down
Loading