This commit is contained in:
恍兮惚兮 2024-09-06 17:21:07 +08:00
parent ec2185a96b
commit ea4c81ff5a
6 changed files with 13 additions and 13 deletions

View File

@ -6,14 +6,14 @@ from myutils.proxy import getproxy
def list_models(typename, regist):
js = requests.get(
createurl(regist["apiurl"]())[: -len("/chat/completions")] + "/models",
headers={"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0]},
createurl(regist["apiurl"]().strip())[: -len("/chat/completions")] + "/models",
headers={"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0].strip()},
proxies=getproxy(("ocr", typename)),
timeout=10,
).json()
try:
return [_["id"] for _ in js["data"]]
return sorted([_["id"] for _ in js["data"]])
except:
raise Exception(js)

View File

@ -8,7 +8,7 @@ from myutils.proxy import getproxy
def list_models(typename, regist):
js = requests.get(
"https://generativelanguage.googleapis.com/v1beta/models",
params={"key": regist["key"]().split("|")[0]},
params={"key": regist["key"]().split("|")[0].strip()},
proxies=getproxy(("ocr", typename)),
timeout=10,
).json()
@ -25,7 +25,7 @@ def list_models(typename, regist):
if name.startswith("models/"):
name = name[7:]
mm.append(name)
return mm
return sorted(mm)
class OCR(baseocr):

View File

@ -132,7 +132,7 @@ def list_models(typename, regist):
js = requests.get(
"https://api.cohere.com/v1/models",
headers={
"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0],
"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0].strip(),
"X-Client-Name": "my-cool-project",
},
proxies=getproxy(("fanyi", typename)),
@ -148,4 +148,4 @@ def list_models(typename, regist):
if "chat" not in endpoints:
continue
mm.append(m["name"])
return mm
return sorted(mm)

View File

@ -94,7 +94,7 @@ class TS(basetrans):
def list_models(typename, regist):
js = requests.get(
"https://generativelanguage.googleapis.com/v1beta/models",
params={"key": regist["SECRET_KEY"]().split("|")[0]},
params={"key": regist["SECRET_KEY"]().split("|")[0].strip()},
proxies=getproxy(("fanyi", typename)),
timeout=10,
).json()
@ -111,4 +111,4 @@ def list_models(typename, regist):
if name.startswith("models/"):
name = name[7:]
mm.append(name)
return mm
return sorted(mm)

View File

@ -7,14 +7,14 @@ from myutils.proxy import getproxy
def list_models(typename, regist):
js = requests.get(
createurl(regist["API接口地址"]())[: -len("/chat/completions")] + "/models",
headers={"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0]},
createurl(regist["API接口地址"]().strip())[: -len("/chat/completions")] + "/models",
headers={"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0].strip()},
proxies=getproxy(("fanyi", typename)),
timeout=10,
).json()
try:
return [_["id"] for _ in js["data"]]
return sorted([_["id"] for _ in js["data"]])
except:
raise Exception(js)

View File

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