From 9e3c046d5ce629ef8b8537deb56cd8838b5596c6 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Fri, 6 Dec 2024 08:54:49 +0100 Subject: Add conversation support in HuggingChat --- g4f/Provider/Pizzagpt.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'g4f/Provider/Pizzagpt.py') diff --git a/g4f/Provider/Pizzagpt.py b/g4f/Provider/Pizzagpt.py index 6513bd34..16946a1e 100644 --- a/g4f/Provider/Pizzagpt.py +++ b/g4f/Provider/Pizzagpt.py @@ -1,6 +1,5 @@ from __future__ import annotations -import json from aiohttp import ClientSession from ..typing import AsyncResult, Messages @@ -45,5 +44,6 @@ class Pizzagpt(AsyncGeneratorProvider, ProviderModelMixin): async with session.post(f"{cls.url}{cls.api_endpoint}", json=data, proxy=proxy) as response: response.raise_for_status() response_json = await response.json() - content = response_json.get("answer", {}).get("content", "") - yield content + content = response_json.get("answer", response_json).get("content") + if content: + yield content -- cgit v1.2.3