diff options
author | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-05-17 18:40:34 +0200 |
---|---|---|
committer | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-05-17 18:40:34 +0200 |
commit | 5396887801ebf5db9ad59bbe1fc7b2d5e03fc585 (patch) | |
tree | 905c9d954e3880c7d65a89e889d523bb4114d1bf | |
parent | Add needs auth to provierds, Add PerplexityApi provider (diff) | |
download | gpt4free-5396887801ebf5db9ad59bbe1fc7b2d5e03fc585.tar gpt4free-5396887801ebf5db9ad59bbe1fc7b2d5e03fc585.tar.gz gpt4free-5396887801ebf5db9ad59bbe1fc7b2d5e03fc585.tar.bz2 gpt4free-5396887801ebf5db9ad59bbe1fc7b2d5e03fc585.tar.lz gpt4free-5396887801ebf5db9ad59bbe1fc7b2d5e03fc585.tar.xz gpt4free-5396887801ebf5db9ad59bbe1fc7b2d5e03fc585.tar.zst gpt4free-5396887801ebf5db9ad59bbe1fc7b2d5e03fc585.zip |
-rw-r--r-- | g4f/Provider/You.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/g4f/Provider/You.py b/g4f/Provider/You.py index 2b08b38a..d549423e 100644 --- a/g4f/Provider/You.py +++ b/g4f/Provider/You.py @@ -100,9 +100,10 @@ class You(AsyncGeneratorProvider, ProviderModelMixin): "selectedChatMode": chat_mode, } if chat_mode == "custom": - # print(f"You model: {model}") - params["selectedAIModel"] = model.replace("-", "_") - + if debug.logging: + print(f"You model: {model}") + params["selectedAiModel"] = model.replace("-", "_") + async with (session.post if chat_mode == "default" else session.get)( f"{cls.url}/api/streamingSearch", data=data, @@ -117,9 +118,9 @@ class You(AsyncGeneratorProvider, ProviderModelMixin): elif line.startswith(b'data: '): if event in ["youChatUpdate", "youChatToken"]: data = json.loads(line[6:]) - if event == "youChatToken" and event in data: + if event == "youChatToken" and event in data and data[event]: yield data[event] - elif event == "youChatUpdate" and "t" in data and data["t"] is not None: + elif event == "youChatUpdate" and "t" in data and data["t"]: if chat_mode == "create": match = re.search(r"!\[(.+?)\]\((.+?)\)", data["t"]) if match: |