pick 部分代码

This commit is contained in:
w_xiaolizu
2023-06-27 13:58:09 +08:00
parent 670b5b0f5b
commit b2468e065c
4 changed files with 13 additions and 5 deletions

View File

@ -181,7 +181,7 @@ def request_gpt_model_multi_threads_with_very_awesome_ui_and_high_efficiency(
executor = ThreadPoolExecutor(max_workers=max_workers) executor = ThreadPoolExecutor(max_workers=max_workers)
n_frag = len(inputs_array) n_frag = len(inputs_array)
# 用户反馈 # 用户反馈
chatbot.append(["请开始多线程操作。", ""]) chatbot.append([None, ""])
yield from update_ui(chatbot=chatbot, history=[]) # 刷新界面 yield from update_ui(chatbot=chatbot, history=[]) # 刷新界面
# 跨线程传递 # 跨线程传递
mutable = [["", time.time(), "等待中"] for _ in range(n_frag)] mutable = [["", time.time(), "等待中"] for _ in range(n_frag)]

View File

@ -45,6 +45,7 @@ mspace {
#debug_mes { #debug_mes {
position: absolute; position: absolute;
display: flex;
bottom: 0; bottom: 0;
left: 0; left: 0;
width: 100%; width: 100%;

View File

@ -99,4 +99,4 @@ def inset_127_prompt():
sqlite_handle = SqliteHandle sqlite_handle = SqliteHandle
if __name__ == '__main__': if __name__ == '__main__':
print(sqlite_handle().find_prompt_result('文档转Markdown')) cp_db_data()

View File

@ -594,7 +594,7 @@ def is_api2d_key(key):
return False return False
def is_proxy_key(key): def is_proxy_key(key):
if 'proxy' in key: if key.startswith('proxy-') and len(key) == 37:
return True return True
else: else:
return False return False
@ -620,7 +620,14 @@ def what_keys(keys):
if is_api2d_key(k): if is_api2d_key(k):
avail_key_list['API2D Key'] += 1 avail_key_list['API2D Key'] += 1
return f"检测到: OpenAI Key {avail_key_list['OpenAI Key']}API2D Key {avail_key_list['API2D Key']}" for k in key_list:
if is_proxy_key(k):
avail_key_list['Proxy Key'] += 1
return f"检测到: \n" \
f"OpenAI Key {avail_key_list['OpenAI Key']}\n" \
f"API2D Key {avail_key_list['API2D Key']}\n" \
f"Proxy Key {avail_key_list['API2D Key']}\n"
def select_api_key(keys, llm_model): def select_api_key(keys, llm_model):
import random import random
@ -635,7 +642,7 @@ def select_api_key(keys, llm_model):
for k in key_list: for k in key_list:
if is_api2d_key(k): avail_key_list.append(k) if is_api2d_key(k): avail_key_list.append(k)
if llm_model.startswith('proxy'): if llm_model.startswith('proxy-'):
for k in key_list: for k in key_list:
if is_proxy_key(k): avail_key_list.append(k.replace('proxy-', '')) if is_proxy_key(k): avail_key_list.append(k.replace('proxy-', ''))