This commit is contained in:
恍兮惚兮 2024-09-05 22:40:11 +08:00
parent 197b62d0dd
commit 9cdaf8752d
7 changed files with 7 additions and 4 deletions

View File

@ -9,6 +9,7 @@ def list_models(typename, regist):
createurl(regist["apiurl"]())[: -len("/chat/completions")] + "/models",
headers={"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0]},
proxies=getproxy(("ocr", typename)),
timeout=10,
).json()
try:

View File

@ -10,6 +10,7 @@ def list_models(typename, regist):
"https://generativelanguage.googleapis.com/v1beta/models",
params={"key": regist["key"]().split("|")[0]},
proxies=getproxy(("ocr", typename)),
timeout=10,
).json()
try:
models = js["models"]

View File

@ -265,8 +265,6 @@ class Requester_common:
headers["Content-Type"] = contenttype
proxy = proxies.get(scheme, None) if proxies else None
proxy = None if proxy == "" else proxy
if timeout is None:
timeout = 10
if timeout:
if isinstance(timeout, (float, int)):
timeout = int(timeout * 1000) # convert to milliseconds

View File

@ -136,6 +136,7 @@ def list_models(typename, regist):
"X-Client-Name": "my-cool-project",
},
proxies=getproxy(("fanyi", typename)),
timeout=10,
).json()
try:
models = js["models"]

View File

@ -96,6 +96,7 @@ def list_models(typename, regist):
"https://generativelanguage.googleapis.com/v1beta/models",
params={"key": regist["SECRET_KEY"]().split("|")[0]},
proxies=getproxy(("fanyi", typename)),
timeout=10,
).json()
try:
models = js["models"]

View File

@ -10,6 +10,7 @@ def list_models(typename, regist):
createurl(regist["API接口地址"]())[: -len("/chat/completions")] + "/models",
headers={"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0]},
proxies=getproxy(("fanyi", typename)),
timeout=10,
).json()
try:
@ -51,7 +52,7 @@ class gptcommon(basetrans):
def createheaders(self):
_ = {"Authorization": "Bearer " + self.multiapikeycurrent["SECRET_KEY"]}
if "openai.azure.com/openai/deployments/" in self.config["API接口地址"]:
if "openai.azure.com/openai/deployments/" in self.config("API接口地址", ""):
_.update({"api-key": self.multiapikeycurrent["SECRET_KEY"]})
return _

View File

@ -29,7 +29,7 @@ include(generate_product_version)
set(VERSION_MAJOR 5)
set(VERSION_MINOR 34)
set(VERSION_PATCH 1)
set(VERSION_PATCH 2)
add_library(pch pch.cpp)
target_precompile_headers(pch PUBLIC pch.h)