Spaces:
Runtime error
Runtime error
update chunk decode logic
Browse files
app.py
CHANGED
@@ -76,7 +76,7 @@ def predict(inputs, top_p, temperature, openai_api_key, chat_counter, chatbot=[]
|
|
76 |
if chunk.decode() :
|
77 |
chunk = chunk.decode()
|
78 |
# decode each line as response data is in bytes
|
79 |
-
if len(chunk) > 12 and "
|
80 |
#if len(json.loads(chunk.decode()[6:])['choices'][0]["delta"]) == 0:
|
81 |
# break
|
82 |
partial_words = partial_words + json.loads(chunk[6:])['choices'][0]["delta"]["content"]
|
|
|
76 |
if chunk.decode() :
|
77 |
chunk = chunk.decode()
|
78 |
# decode each line as response data is in bytes
|
79 |
+
if len(chunk) > 12 and "content" in json.loads(chunk[6:])['choices'][0]['delta']:
|
80 |
#if len(json.loads(chunk.decode()[6:])['choices'][0]["delta"]) == 0:
|
81 |
# break
|
82 |
partial_words = partial_words + json.loads(chunk[6:])['choices'][0]["delta"]["content"]
|