From b2468e065c47af5bee3f0e1cf28782c5b4d46baf Mon Sep 17 00:00:00 2001 From: w_xiaolizu Date: Tue, 27 Jun 2023 13:58:09 +0800 Subject: [PATCH] =?UTF-8?q?pick=20=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crazy_functions/crazy_utils.py | 2 +- docs/assets/custom.css | 1 + prompt_generator.py | 2 +- toolbox.py | 13 ++++++++++--- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/crazy_functions/crazy_utils.py b/crazy_functions/crazy_utils.py index 96301ff..848afcf 100644 --- a/crazy_functions/crazy_utils.py +++ b/crazy_functions/crazy_utils.py @@ -181,7 +181,7 @@ def request_gpt_model_multi_threads_with_very_awesome_ui_and_high_efficiency( executor = ThreadPoolExecutor(max_workers=max_workers) n_frag = len(inputs_array) # 用户反馈 - chatbot.append(["请开始多线程操作。", ""]) + chatbot.append([None, ""]) yield from update_ui(chatbot=chatbot, history=[]) # 刷新界面 # 跨线程传递 mutable = [["", time.time(), "等待中"] for _ in range(n_frag)] diff --git a/docs/assets/custom.css b/docs/assets/custom.css index 6769abf..d02134b 100644 --- a/docs/assets/custom.css +++ b/docs/assets/custom.css @@ -45,6 +45,7 @@ mspace { #debug_mes { position: absolute; + display: flex; bottom: 0; left: 0; width: 100%; diff --git a/prompt_generator.py b/prompt_generator.py index eeba13f..0efdc83 100644 --- a/prompt_generator.py +++ b/prompt_generator.py @@ -99,4 +99,4 @@ def inset_127_prompt(): sqlite_handle = SqliteHandle if __name__ == '__main__': - print(sqlite_handle().find_prompt_result('文档转Markdown')) \ No newline at end of file + cp_db_data() \ No newline at end of file diff --git a/toolbox.py b/toolbox.py index 1a86b2a..59cb962 100644 --- a/toolbox.py +++ b/toolbox.py @@ -594,7 +594,7 @@ def is_api2d_key(key): return False def is_proxy_key(key): - if 'proxy' in key: + if key.startswith('proxy-') and len(key) == 37: return True else: return False @@ -620,7 +620,14 @@ def what_keys(keys): if is_api2d_key(k): 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): import random @@ -635,7 +642,7 @@ def select_api_key(keys, llm_model): for k in key_list: 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: if is_proxy_key(k): avail_key_list.append(k.replace('proxy-', ''))