Spaces:
Building
Building
Update websocket_handler.py
Browse files- websocket_handler.py +4 -3
websocket_handler.py
CHANGED
@@ -309,15 +309,16 @@ async def websocket_endpoint(websocket: WebSocket, session_id: str):
|
|
309 |
# Send welcome message from session history
|
310 |
log_info(f"📋 Checking for welcome message in session history...", session_id=session_id)
|
311 |
|
312 |
-
#
|
313 |
-
chat_history = session.chat_history
|
314 |
|
315 |
if chat_history and len(chat_history) > 0:
|
316 |
log_info(f"📋 Found {len(chat_history)} messages in history", session_id=session_id)
|
317 |
|
318 |
# Get the last assistant message (welcome message)
|
319 |
for i, msg in enumerate(reversed(chat_history)):
|
320 |
-
log_debug(f"📋 Message {i}: role={msg.get('role', 'unknown')}, content_preview={msg.get('content', '')[:50]}...", session_id=session_id)
|
|
|
321 |
if msg.get('role') == 'assistant':
|
322 |
welcome_text = msg.get('content', '')
|
323 |
log_info(f"📢 Found welcome message: {welcome_text[:50]}...", session_id=session_id)
|
|
|
309 |
# Send welcome message from session history
|
310 |
log_info(f"📋 Checking for welcome message in session history...", session_id=session_id)
|
311 |
|
312 |
+
# Session'dan chat history'yi al
|
313 |
+
chat_history = session.chat_history
|
314 |
|
315 |
if chat_history and len(chat_history) > 0:
|
316 |
log_info(f"📋 Found {len(chat_history)} messages in history", session_id=session_id)
|
317 |
|
318 |
# Get the last assistant message (welcome message)
|
319 |
for i, msg in enumerate(reversed(chat_history)):
|
320 |
+
log_debug(f"📋 Message {i}: role={msg.get('role', 'unknown')}, content_preview={msg.get('content', '')[:50]}...", session_id=session_id)
|
321 |
+
|
322 |
if msg.get('role') == 'assistant':
|
323 |
welcome_text = msg.get('content', '')
|
324 |
log_info(f"📢 Found welcome message: {welcome_text[:50]}...", session_id=session_id)
|