Update app.py
Browse files
app.py
CHANGED
|
@@ -565,8 +565,8 @@ def generate(message, temperature):
|
|
| 565 |
|
| 566 |
# The reason why the library method is not used here is that if an error occurs,
|
| 567 |
# the returned data will not be a stream, and using the official library will result in an error.
|
| 568 |
-
for chunk in
|
| 569 |
-
chunk = chunk.decode("utf-8")
|
| 570 |
data_chunks = parse_data_chunk(chunk)
|
| 571 |
try:
|
| 572 |
for data_chunk in data_chunks:
|
|
|
|
| 565 |
|
| 566 |
# The reason why the library method is not used here is that if an error occurs,
|
| 567 |
# the returned data will not be a stream, and using the official library will result in an error.
|
| 568 |
+
for chunk in response:
|
| 569 |
+
chunk = chunk.decode("utf-8") if isinstance(chunk, bytes) else chunk
|
| 570 |
data_chunks = parse_data_chunk(chunk)
|
| 571 |
try:
|
| 572 |
for data_chunk in data_chunks:
|