Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -381,6 +381,8 @@ def bot(history, choice, tts_choice):
|
|
381 |
history[-1] = response_pair # Update bot response correctly
|
382 |
|
383 |
response_text = ""
|
|
|
|
|
384 |
with concurrent.futures.ThreadPoolExecutor() as executor:
|
385 |
if tts_choice == "Alpha":
|
386 |
audio_future = executor.submit(generate_audio_elevenlabs, response_pair[1])
|
@@ -391,17 +393,17 @@ def bot(history, choice, tts_choice):
|
|
391 |
|
392 |
for character in response_pair[1]:
|
393 |
response_text += character
|
394 |
-
new_history = history
|
395 |
-
new_history[-1][1] = response_text
|
396 |
yield new_history, None
|
397 |
|
398 |
audio_path = audio_future.result()
|
399 |
-
new_history[-1][1]
|
400 |
yield new_history, audio_path
|
401 |
|
402 |
|
403 |
|
404 |
|
|
|
405 |
def add_message(history, message):
|
406 |
history = history or []
|
407 |
history.append([message, ""]) # Ensure it is a list with two elements: message and empty response
|
|
|
381 |
history[-1] = response_pair # Update bot response correctly
|
382 |
|
383 |
response_text = ""
|
384 |
+
new_history = history.copy()
|
385 |
+
|
386 |
with concurrent.futures.ThreadPoolExecutor() as executor:
|
387 |
if tts_choice == "Alpha":
|
388 |
audio_future = executor.submit(generate_audio_elevenlabs, response_pair[1])
|
|
|
393 |
|
394 |
for character in response_pair[1]:
|
395 |
response_text += character
|
396 |
+
new_history[-1] = [history[-1][0], response_text]
|
|
|
397 |
yield new_history, None
|
398 |
|
399 |
audio_path = audio_future.result()
|
400 |
+
new_history[-1] = [history[-1][0], response_text]
|
401 |
yield new_history, audio_path
|
402 |
|
403 |
|
404 |
|
405 |
|
406 |
+
|
407 |
def add_message(history, message):
|
408 |
history = history or []
|
409 |
history.append([message, ""]) # Ensure it is a list with two elements: message and empty response
|