Fixing question repetition ? - What wind.surf will do ?
Browse files
app.py
CHANGED
@@ -164,15 +164,16 @@ with gr.Blocks() as demo:
|
|
164 |
|
165 |
def submit_message(message, chat_history, model_name, system_message, max_tokens, temperature, top_p):
|
166 |
history = [] if chat_history is None else chat_history
|
|
|
167 |
|
168 |
-
#
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
yield
|
176 |
|
177 |
submit_event = submit.click(
|
178 |
fn=submit_message,
|
|
|
164 |
|
165 |
def submit_message(message, chat_history, model_name, system_message, max_tokens, temperature, top_p):
|
166 |
history = [] if chat_history is None else chat_history
|
167 |
+
current_response = ""
|
168 |
|
169 |
+
# Stream the assistant's response
|
170 |
+
for response in respond(message, history, model_name, system_message, max_tokens, temperature, top_p):
|
171 |
+
current_response = response
|
172 |
+
new_history = history + [
|
173 |
+
{"role": "user", "content": message},
|
174 |
+
{"role": "assistant", "content": current_response}
|
175 |
+
]
|
176 |
+
yield new_history, ""
|
177 |
|
178 |
submit_event = submit.click(
|
179 |
fn=submit_message,
|