Demo Update 29
This commit is contained in:
@@ -587,7 +587,7 @@ def stream_ai_response(text, session_id):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# Signal start of AI speech
|
# Signal start of AI speech
|
||||||
emit('ai_speech_start', room=session_id)
|
socketio.emit('ai_speech_start', room=session_id) # CHANGED: emit → socketio.emit
|
||||||
|
|
||||||
# Use the last few conversation segments as context (up to 4)
|
# Use the last few conversation segments as context (up to 4)
|
||||||
context_segments = session['segments'][-4:] if len(session['segments']) > 4 else session['segments']
|
context_segments = session['segments'][-4:] if len(session['segments']) > 4 else session['segments']
|
||||||
@@ -643,15 +643,15 @@ def stream_ai_response(text, session_id):
|
|||||||
if session_id in user_sessions:
|
if session_id in user_sessions:
|
||||||
session['is_ai_speaking'] = False
|
session['is_ai_speaking'] = False
|
||||||
session['is_turn_active'] = False # End conversation turn
|
session['is_turn_active'] = False # End conversation turn
|
||||||
socketio.emit('ai_speech_end', room=session_id)
|
socketio.emit('ai_speech_end', room=session_id) # CHANGED: emit → socketio.emit
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error streaming AI response: {e}")
|
print(f"Error streaming AI response: {e}")
|
||||||
if session_id in user_sessions:
|
if session_id in user_sessions:
|
||||||
session['is_ai_speaking'] = False
|
session['is_ai_speaking'] = False
|
||||||
session['is_turn_active'] = False
|
session['is_turn_active'] = False
|
||||||
socketio.emit('error', {'message': f'Error generating audio: {str(e)}'}, room=session_id)
|
socketio.emit('error', {'message': f'Error generating audio: {str(e)}'}, room=session_id) # CHANGED: emit → socketio.emit
|
||||||
socketio.emit('ai_speech_end', room=session_id)
|
socketio.emit('ai_speech_end', room=session_id) # CHANGED: emit → socketio.emit
|
||||||
|
|
||||||
@socketio.on('interrupt_ai')
|
@socketio.on('interrupt_ai')
|
||||||
def handle_interrupt():
|
def handle_interrupt():
|
||||||
|
|||||||
Reference in New Issue
Block a user