bradnow commited on
Commit
ed565d2
·
1 Parent(s): c95a856

Remove invalid row count logging

Browse files
Files changed (1) hide show
  1. log_chat.py +1 -5
log_chat.py CHANGED
@@ -103,10 +103,6 @@ def _log_chat(chat_id: str, session_id: str, model_name: str, prompt: str, histo
103
  # Only read first row to check if file is valid and get row count efficiently
104
  df_check = pd.read_csv(csv_path, nrows=1)
105
  file_exists = True
106
- # Get row count without loading entire file into memory
107
- with open(csv_path, 'r') as f:
108
- row_count = sum(1 for _ in f) - 1 # Subtract header
109
- log_info(f"log_chat() --> Downloaded existing CSV with ~{row_count} rows")
110
  break # Success, exit the loop
111
  except Exception as e:
112
  retry_count += 1
@@ -159,7 +155,7 @@ def _log_chat(chat_id: str, session_id: str, model_name: str, prompt: str, histo
159
  writer.writeheader()
160
  writer.writerow(new_row)
161
 
162
- log_debug(f"log_chat() --> Wrote out CSV with new row, new row_count={row_count + 1}")
163
  # dump_local_csv()
164
  except Exception as e:
165
  log_error(f"log_chat() --> Error writing to CSV: {e}")
 
103
  # Only read first row to check if file is valid and get row count efficiently
104
  df_check = pd.read_csv(csv_path, nrows=1)
105
  file_exists = True
 
 
 
 
106
  break # Success, exit the loop
107
  except Exception as e:
108
  retry_count += 1
 
155
  writer.writeheader()
156
  writer.writerow(new_row)
157
 
158
+ log_debug(f"log_chat() --> Wrote out CSV with new row")
159
  # dump_local_csv()
160
  except Exception as e:
161
  log_error(f"log_chat() --> Error writing to CSV: {e}")