Update app.py
Browse files
app.py
CHANGED
|
@@ -530,9 +530,10 @@ def parse_data_chunk(data_chunk):
|
|
| 530 |
Returns:
|
| 531 |
list: A list of individual data entries with whitespace stripped.
|
| 532 |
"""
|
|
|
|
|
|
|
|
|
|
| 533 |
chunks = data_chunk.split("data:")
|
| 534 |
-
stripped_chunks = map(lambda chunk: chunk.strip(), chunks)
|
| 535 |
-
return [chunk for chunk in stripped_chunks if chunk]
|
| 536 |
|
| 537 |
|
| 538 |
def generate(message, temperature):
|
|
|
|
| 530 |
Returns:
|
| 531 |
list: A list of individual data entries with whitespace stripped.
|
| 532 |
"""
|
| 533 |
+
def parse_data_chunk(data_chunk):
|
| 534 |
+
if isinstance(data_chunk, ChatCompletionStreamOutput):
|
| 535 |
+
data_chunk = data_chunk.text
|
| 536 |
chunks = data_chunk.split("data:")
|
|
|
|
|
|
|
| 537 |
|
| 538 |
|
| 539 |
def generate(message, temperature):
|