Skip to content

Commit

Permalink
Feat/0.2.0 (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaojin3616 authored Oct 17, 2023
2 parents 517a323 + 7cea779 commit 65d0b7f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ jobs:
twine upload dist/* -u ${{ secrets.PYPI_USER }} -p ${{ secrets.PYPI_PASSWORD }} --repository pypi
# 构建 backend 并推送到 Docker hub
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: install poetry
uses: snok/install-poetry@v1
with:
Expand All @@ -71,6 +77,7 @@ jobs:
# 是否 docker push
push: true
# docker build arg, 注入 APP_NAME/APP_VERSION
platforms: linux/amd64,linux/arm64
build-args: |
APP_NAME="bisheng-backend"
APP_VERSION=${{ steps.get_version.outputs.VERSION }}
Expand All @@ -88,6 +95,7 @@ jobs:
# 是否 docker push
push: true
# docker build arg, 注入 APP_NAME/APP_VERSION
platforms: linux/amd64,linux/arm64
build-args: |
APP_NAME="bisheng-frontend"
APP_VERSION=${{ steps.get_version.outputs.VERSION }}
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ jobs:
# 是否 docker push
push: true
# docker build arg, 注入 APP_NAME/APP_VERSION
platforms: linux/amd64,linux/arm64
build-args: |
APP_NAME="bisheng-backend"
APP_VERSION="release"
Expand All @@ -113,7 +112,6 @@ jobs:
# 是否 docker push
push: true
# docker build arg, 注入 APP_NAME/APP_VERSION
platforms: linux/amd64,linux/arm64
build-args: |
APP_NAME="bisheng-frontend"
APP_VERSION="release"
Expand Down
1 change: 1 addition & 0 deletions src/backend/bisheng/api/v1/knowledge.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ def _read_chunk_text(input_file, file_name, size, chunk_overlap, separator):
if file_type not in filetype_load_map:
raise Exception('Unsupport file type')
loader = filetype_load_map[file_type](file_path=input_file)
separator = separator[0] if separator and isinstance(separator, list) else separator
text_splitter = CharacterTextSplitter(separator=separator,
chunk_size=size,
chunk_overlap=chunk_overlap,
Expand Down
14 changes: 10 additions & 4 deletions src/backend/bisheng/utils/minio_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ class MinioClient():
minio_client: minio.Minio

def __init__(self) -> None:
if 'minio' not in settings.knowledges:
self.minio_client = None
self.minio_share = None
return
self.minio_client = minio.Minio(
endpoint=settings.knowledges.get('minio').get('MINIO_ENDPOINT'),
access_key=settings.knowledges.get('minio').get('MINIO_ACCESS_KEY'),
Expand All @@ -33,10 +37,12 @@ def get_share_link(self, object_name):
# filepath "/" 开头会有nginx问题
if object_name[0] == '/':
object_name = object_name[1:]

return self.minio_share.presigned_get_object(bucket_name=bucket,
object_name=object_name,
expires=timedelta(days=7))
if self.minio_share:
return self.minio_share.presigned_get_object(bucket_name=bucket,
object_name=object_name,
expires=timedelta(days=7))
else:
return ''

def delete_minio(self, object_name: str):
if self.minio_client:
Expand Down

0 comments on commit 65d0b7f

Please sign in to comment.