ciyidogan commited on
Commit
05cebb3
·
verified ·
1 Parent(s): 6b62dd0

Update websocket_handler.py

Browse files
Files changed (1) hide show
  1. websocket_handler.py +5 -3
websocket_handler.py CHANGED
@@ -308,14 +308,16 @@ async def websocket_endpoint(websocket: WebSocket, session_id: str):
308
 
309
  # Send welcome message from session history
310
  log_info(f"📋 Checking for welcome message in session history...", session_id=session_id)
311
-
 
 
 
312
  if chat_history and len(chat_history) > 0:
313
  log_info(f"📋 Found {len(chat_history)} messages in history", session_id=session_id)
314
 
315
  # Get the last assistant message (welcome message)
316
  for i, msg in enumerate(reversed(chat_history)):
317
- log_debug(f"📋 Message {i}: role={msg.get('role', 'unknown')}, content_preview={msg.get('content', '')[:50]}...", session_id=session_id)
318
-
319
  if msg.get('role') == 'assistant':
320
  welcome_text = msg.get('content', '')
321
  log_info(f"📢 Found welcome message: {welcome_text[:50]}...", session_id=session_id)
 
308
 
309
  # Send welcome message from session history
310
  log_info(f"📋 Checking for welcome message in session history...", session_id=session_id)
311
+
312
+ # chat_history değişkeni tanımlı değil, session'dan almalıyız
313
+ chat_history = session.chat_history # BU SATIRI EKLE
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)