From 6b8e6adc9df559087b883f0db0ebfb328db2da34 Mon Sep 17 00:00:00 2001 From: hlohaus <983577+hlohaus@users.noreply.github.com> Date: Sat, 1 Feb 2025 02:04:51 +0100 Subject: [PATCH] Fix publish to pypi --- .github/workflows/publish-to-pypi.yml | 4 ++-- g4f/providers/response.py | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index d5481fd46e1..603e5b82200 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -25,7 +25,7 @@ jobs: - name: Build a binary wheel and a source tarball run: python3 -m build - name: Store the distribution packages - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: python-package-distributions path: dist/ @@ -44,7 +44,7 @@ jobs: id-token: write steps: - name: Download all the dists - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: python-package-distributions path: dist/ diff --git a/g4f/providers/response.py b/g4f/providers/response.py index 244399efe04..8227aed6045 100644 --- a/g4f/providers/response.py +++ b/g4f/providers/response.py @@ -71,7 +71,7 @@ def format_images_markdown(images: Union[str, list], alt: str, preview: Union[st class ResponseType: @abstractmethod def __str__(self) -> str: - pass + raise NotImplementedError class JsonMixin: def __init__(self, **kwargs) -> None: @@ -143,7 +143,11 @@ def __init__( def __str__(self) -> str: if self.is_thinking is not None: return self.is_thinking - return f"{self.status}\n" if self.token is None else self.token + if self.token is not None: + return self.token + if self.status is not None: + return f"{self.status}\n" + return "" class Sources(ResponseType): def __init__(self, sources: list[dict[str, str]]) -> None: