mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
sort
This commit is contained in:
parent
ec2185a96b
commit
ea4c81ff5a
@ -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)
|
||||
|
||||
|
@ -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):
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user