bradnow commited on
Commit
5761cb7
·
1 Parent(s): 2ce979c

Fix turns logging

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -116,8 +116,8 @@ def run_chat_inference(history, message, state):
116
  return history, INPUT_ENABLED, SEND_BUTTON_ENABLED, STOP_BUTTON_DISABLED, BUTTON_ENABLED, state
117
 
118
  chat_start_count = chat_start_count + 1
119
- log_info(f"chat_start_count: {chat_start_count}, turns: {int(len(history if history else []) / 3)}, "
120
- f"model: {model_name}")
121
 
122
  is_reasoning = model_config.get("REASONING")
123
 
 
116
  return history, INPUT_ENABLED, SEND_BUTTON_ENABLED, STOP_BUTTON_DISABLED, BUTTON_ENABLED, state
117
 
118
  chat_start_count = chat_start_count + 1
119
+ user_messages_count = sum(1 for item in history if isinstance(item, dict) and item.get("role") == "user")
120
+ log_info(f"chat_start_count: {chat_start_count}, turns: {user_messages_count}, model: {model_name}")
121
 
122
  is_reasoning = model_config.get("REASONING")
123