xu song
commited on
Commit
•
e4e3ccf
1
Parent(s):
2e49897
update
Browse files- app_util.py +6 -3
app_util.py
CHANGED
@@ -62,13 +62,16 @@ def generate_response(chatbot, history, user_input=None):
|
|
62 |
|
63 |
|
64 |
def generate(chatbot, history):
|
|
|
65 |
if history[-1]["role"] == "assistant":
|
66 |
-
|
67 |
elif history[-1]["role"] in ["user", "system"]:
|
68 |
-
|
69 |
else:
|
70 |
gr.Warning("bug")
|
71 |
-
|
|
|
|
|
72 |
|
73 |
|
74 |
def regenerate():
|
|
|
62 |
|
63 |
|
64 |
def generate(chatbot, history):
|
65 |
+
streamer = None
|
66 |
if history[-1]["role"] == "assistant":
|
67 |
+
streamer = generate_response(chatbot, history)
|
68 |
elif history[-1]["role"] in ["user", "system"]:
|
69 |
+
streamer = generate_query(chatbot, history)
|
70 |
else:
|
71 |
gr.Warning("bug")
|
72 |
+
|
73 |
+
for out in streamer:
|
74 |
+
yield out
|
75 |
|
76 |
|
77 |
def regenerate():
|