From f41efef0aefe84d8ed5765f524dd673095d8627d Mon Sep 17 00:00:00 2001 From: Abobo <113653079+Abobo8964@users.noreply.github.com> Date: Fri, 15 Mar 2024 20:30:15 +0800 Subject: Error checking for Vercel (#1704) Error checking is done for Vercel's create_completion to avoid interruption caused by UnicodeDecodeError. --- g4f/Provider/Vercel.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/g4f/Provider/Vercel.py b/g4f/Provider/Vercel.py index f8faeeaf..26fc5211 100644 --- a/g4f/Provider/Vercel.py +++ b/g4f/Provider/Vercel.py @@ -63,7 +63,10 @@ class Vercel(AbstractProvider): if not response.ok: continue for token in response.iter_content(chunk_size=None): - yield token.decode() + try: + yield token.decode() + except UnicodeDecodeError: + pass break raise_for_status(response) -- cgit v1.2.3