ciyidogan commited on
Commit
6f489d0
·
verified ·
1 Parent(s): 62d67a6

Update websocket_handler.py

Browse files
Files changed (1) hide show
  1. 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
- # 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)
 
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)