Update app.py
Browse files
app.py
CHANGED
|
@@ -577,13 +577,13 @@ def generate(message, temperature):
|
|
| 577 |
delta = chunk_json["choices"][0]["delta"]
|
| 578 |
content = delta["content"] if "content" in delta else ""
|
| 579 |
if content != "":
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
|
| 587 |
|
| 588 |
def get_majority_text(data):
|
| 589 |
from collections import Counter
|
|
|
|
| 577 |
delta = chunk_json["choices"][0]["delta"]
|
| 578 |
content = delta["content"] if "content" in delta else ""
|
| 579 |
if content != "":
|
| 580 |
+
yield content, False
|
| 581 |
+
except json.JSONDecodeError as e:
|
| 582 |
+
print(f"func: generate error occurred\nchunk:{chunk}\nerror:{e}")
|
| 583 |
+
raise e
|
| 584 |
+
except KeyError as e:
|
| 585 |
+
print(f"func: generate error occurred\nchunk:{chunk}\nerror:{e}")
|
| 586 |
+
raise e
|
| 587 |
|
| 588 |
def get_majority_text(data):
|
| 589 |
from collections import Counter
|