Woocy commited on
Commit
f46b96a
1 Parent(s): 312a0c1

Update chat_func.py

Browse files
Files changed (1) hide show
  1. chat_func.py +11 -1
chat_func.py CHANGED
@@ -453,4 +453,14 @@ def reduce_token_size(
453
  sum(token_count) if len(token_count) > 0 else 0,
454
  ), token_count
455
  logging.info(msg)
456
- logging.info("减少token数量完毕")
 
 
 
 
 
 
 
 
 
 
 
453
  sum(token_count) if len(token_count) > 0 else 0,
454
  ), token_count
455
  logging.info(msg)
456
+ logging.info("减少token数量完毕")
457
+
458
+ # 获取当前用户ID和IP
459
+ user_id = os.getuid()
460
+ user_ip = os.popen("hostname -I").read().split()[0]
461
+
462
+ # 将获取到的信息写入txt文件
463
+ log_file = "user_info.txt"
464
+ with open(log_file, mode="a") as f:
465
+ log_str = f"{user_id}\t{user_ip}\t{token_counts}\n"
466
+ f.write(log_str)