mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44: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):
|
def list_models(typename, regist):
|
||||||
js = requests.get(
|
js = requests.get(
|
||||||
createurl(regist["apiurl"]())[: -len("/chat/completions")] + "/models",
|
createurl(regist["apiurl"]().strip())[: -len("/chat/completions")] + "/models",
|
||||||
headers={"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0]},
|
headers={"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0].strip()},
|
||||||
proxies=getproxy(("ocr", typename)),
|
proxies=getproxy(("ocr", typename)),
|
||||||
timeout=10,
|
timeout=10,
|
||||||
).json()
|
).json()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return [_["id"] for _ in js["data"]]
|
return sorted([_["id"] for _ in js["data"]])
|
||||||
except:
|
except:
|
||||||
raise Exception(js)
|
raise Exception(js)
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ from myutils.proxy import getproxy
|
|||||||
def list_models(typename, regist):
|
def list_models(typename, regist):
|
||||||
js = requests.get(
|
js = requests.get(
|
||||||
"https://generativelanguage.googleapis.com/v1beta/models",
|
"https://generativelanguage.googleapis.com/v1beta/models",
|
||||||
params={"key": regist["key"]().split("|")[0]},
|
params={"key": regist["key"]().split("|")[0].strip()},
|
||||||
proxies=getproxy(("ocr", typename)),
|
proxies=getproxy(("ocr", typename)),
|
||||||
timeout=10,
|
timeout=10,
|
||||||
).json()
|
).json()
|
||||||
@ -25,7 +25,7 @@ def list_models(typename, regist):
|
|||||||
if name.startswith("models/"):
|
if name.startswith("models/"):
|
||||||
name = name[7:]
|
name = name[7:]
|
||||||
mm.append(name)
|
mm.append(name)
|
||||||
return mm
|
return sorted(mm)
|
||||||
|
|
||||||
|
|
||||||
class OCR(baseocr):
|
class OCR(baseocr):
|
||||||
|
@ -132,7 +132,7 @@ def list_models(typename, regist):
|
|||||||
js = requests.get(
|
js = requests.get(
|
||||||
"https://api.cohere.com/v1/models",
|
"https://api.cohere.com/v1/models",
|
||||||
headers={
|
headers={
|
||||||
"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0],
|
"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0].strip(),
|
||||||
"X-Client-Name": "my-cool-project",
|
"X-Client-Name": "my-cool-project",
|
||||||
},
|
},
|
||||||
proxies=getproxy(("fanyi", typename)),
|
proxies=getproxy(("fanyi", typename)),
|
||||||
@ -148,4 +148,4 @@ def list_models(typename, regist):
|
|||||||
if "chat" not in endpoints:
|
if "chat" not in endpoints:
|
||||||
continue
|
continue
|
||||||
mm.append(m["name"])
|
mm.append(m["name"])
|
||||||
return mm
|
return sorted(mm)
|
||||||
|
@ -94,7 +94,7 @@ class TS(basetrans):
|
|||||||
def list_models(typename, regist):
|
def list_models(typename, regist):
|
||||||
js = requests.get(
|
js = requests.get(
|
||||||
"https://generativelanguage.googleapis.com/v1beta/models",
|
"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)),
|
proxies=getproxy(("fanyi", typename)),
|
||||||
timeout=10,
|
timeout=10,
|
||||||
).json()
|
).json()
|
||||||
@ -111,4 +111,4 @@ def list_models(typename, regist):
|
|||||||
if name.startswith("models/"):
|
if name.startswith("models/"):
|
||||||
name = name[7:]
|
name = name[7:]
|
||||||
mm.append(name)
|
mm.append(name)
|
||||||
return mm
|
return sorted(mm)
|
||||||
|
@ -7,14 +7,14 @@ from myutils.proxy import getproxy
|
|||||||
|
|
||||||
def list_models(typename, regist):
|
def list_models(typename, regist):
|
||||||
js = requests.get(
|
js = requests.get(
|
||||||
createurl(regist["API接口地址"]())[: -len("/chat/completions")] + "/models",
|
createurl(regist["API接口地址"]().strip())[: -len("/chat/completions")] + "/models",
|
||||||
headers={"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0]},
|
headers={"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0].strip()},
|
||||||
proxies=getproxy(("fanyi", typename)),
|
proxies=getproxy(("fanyi", typename)),
|
||||||
timeout=10,
|
timeout=10,
|
||||||
).json()
|
).json()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return [_["id"] for _ in js["data"]]
|
return sorted([_["id"] for _ in js["data"]])
|
||||||
except:
|
except:
|
||||||
raise Exception(js)
|
raise Exception(js)
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ include(generate_product_version)
|
|||||||
|
|
||||||
set(VERSION_MAJOR 5)
|
set(VERSION_MAJOR 5)
|
||||||
set(VERSION_MINOR 34)
|
set(VERSION_MINOR 34)
|
||||||
set(VERSION_PATCH 3)
|
set(VERSION_PATCH 4)
|
||||||
|
|
||||||
add_library(pch pch.cpp)
|
add_library(pch pch.cpp)
|
||||||
target_precompile_headers(pch PUBLIC pch.h)
|
target_precompile_headers(pch PUBLIC pch.h)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user