提示错误信息
Browse files- config.py +1 -1
- request_llm/bridge_chatgpt.py +11 -6
config.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
# [step 1]>> 例如: API_KEY = "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" (此key无效)
|
2 |
-
API_KEY = "sk-此处填API密钥"
|
3 |
|
4 |
# [step 2]>> 改为True应用代理,如果直接在海外服务器部署,此处不修改
|
5 |
USE_PROXY = False
|
|
|
1 |
# [step 1]>> 例如: API_KEY = "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" (此key无效)
|
2 |
+
API_KEY = "sk-此处填API密钥" # 可同时填写多个API-KEY,用英文逗号分割,例如API_KEY = "sk-openaikey1,sk-openaikey2,fkxxxx-api2dkey1,fkxxxx-api2dkey2"
|
3 |
|
4 |
# [step 2]>> 改为True应用代理,如果直接在海外服务器部署,此处不修改
|
5 |
USE_PROXY = False
|
request_llm/bridge_chatgpt.py
CHANGED
@@ -130,13 +130,18 @@ def predict(inputs, llm_kwargs, plugin_kwargs, chatbot, history=[], system_promp
|
|
130 |
if "PreProcess" in core_functional[additional_fn]: inputs = core_functional[additional_fn]["PreProcess"](inputs) # 获取预处理函数(如果有的话)
|
131 |
inputs = core_functional[additional_fn]["Prefix"] + inputs + core_functional[additional_fn]["Suffix"]
|
132 |
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
yield from update_ui(chatbot=chatbot, history=history, msg="等待响应") # 刷新界面
|
138 |
|
139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
history.append(inputs); history.append(" ")
|
141 |
|
142 |
retry = 0
|
|
|
130 |
if "PreProcess" in core_functional[additional_fn]: inputs = core_functional[additional_fn]["PreProcess"](inputs) # 获取预处理函数(如果有的话)
|
131 |
inputs = core_functional[additional_fn]["Prefix"] + inputs + core_functional[additional_fn]["Suffix"]
|
132 |
|
133 |
+
raw_input = inputs
|
134 |
+
logging.info(f'[raw_input] {raw_input}')
|
135 |
+
chatbot.append((inputs, ""))
|
136 |
+
yield from update_ui(chatbot=chatbot, history=history, msg="等待响应") # 刷新界面
|
|
|
137 |
|
138 |
+
try:
|
139 |
+
headers, payload = generate_payload(inputs, llm_kwargs, history, system_prompt, stream)
|
140 |
+
except RuntimeError as e:
|
141 |
+
chatbot[-1] = (inputs, f"您提供的api-key不满足要求,不包含任何可用于{llm_kwargs['llm_model']}的api-key。")
|
142 |
+
yield from update_ui(chatbot=chatbot, history=history, msg="api-key不满足要求") # 刷新界面
|
143 |
+
return
|
144 |
+
|
145 |
history.append(inputs); history.append(" ")
|
146 |
|
147 |
retry = 0
|