ai: Filter out blank responses.
Browse files
jarvis.py
CHANGED
@@ -304,10 +304,11 @@ async def respond_async(multi, history, model_display, sess, custom_prompt):
|
|
304 |
chunk = d.result()
|
305 |
if chunk is None:
|
306 |
raise StopAsyncIteration
|
|
|
|
|
307 |
if not first_meaningful_chunk_found:
|
308 |
-
|
309 |
-
|
310 |
-
first_meaningful_chunk_found = True
|
311 |
else:
|
312 |
history[-1][1] += chunk
|
313 |
yield history, gr.update(interactive=False, submit_btn=False, stop_btn=True), sess
|
|
|
304 |
chunk = d.result()
|
305 |
if chunk is None:
|
306 |
raise StopAsyncIteration
|
307 |
+
if not chunk.strip():
|
308 |
+
continue
|
309 |
if not first_meaningful_chunk_found:
|
310 |
+
history[-1][1] = chunk
|
311 |
+
first_meaningful_chunk_found = True
|
|
|
312 |
else:
|
313 |
history[-1][1] += chunk
|
314 |
yield history, gr.update(interactive=False, submit_btn=False, stop_btn=True), sess
|