mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44:13 +08:00
fix
This commit is contained in:
parent
197b62d0dd
commit
9cdaf8752d
@ -9,6 +9,7 @@ def list_models(typename, regist):
|
|||||||
createurl(regist["apiurl"]())[: -len("/chat/completions")] + "/models",
|
createurl(regist["apiurl"]())[: -len("/chat/completions")] + "/models",
|
||||||
headers={"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0]},
|
headers={"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0]},
|
||||||
proxies=getproxy(("ocr", typename)),
|
proxies=getproxy(("ocr", typename)),
|
||||||
|
timeout=10,
|
||||||
).json()
|
).json()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -10,6 +10,7 @@ def list_models(typename, regist):
|
|||||||
"https://generativelanguage.googleapis.com/v1beta/models",
|
"https://generativelanguage.googleapis.com/v1beta/models",
|
||||||
params={"key": regist["key"]().split("|")[0]},
|
params={"key": regist["key"]().split("|")[0]},
|
||||||
proxies=getproxy(("ocr", typename)),
|
proxies=getproxy(("ocr", typename)),
|
||||||
|
timeout=10,
|
||||||
).json()
|
).json()
|
||||||
try:
|
try:
|
||||||
models = js["models"]
|
models = js["models"]
|
||||||
|
@ -265,8 +265,6 @@ class Requester_common:
|
|||||||
headers["Content-Type"] = contenttype
|
headers["Content-Type"] = contenttype
|
||||||
proxy = proxies.get(scheme, None) if proxies else None
|
proxy = proxies.get(scheme, None) if proxies else None
|
||||||
proxy = None if proxy == "" else proxy
|
proxy = None if proxy == "" else proxy
|
||||||
if timeout is None:
|
|
||||||
timeout = 10
|
|
||||||
if timeout:
|
if timeout:
|
||||||
if isinstance(timeout, (float, int)):
|
if isinstance(timeout, (float, int)):
|
||||||
timeout = int(timeout * 1000) # convert to milliseconds
|
timeout = int(timeout * 1000) # convert to milliseconds
|
||||||
|
@ -136,6 +136,7 @@ def list_models(typename, regist):
|
|||||||
"X-Client-Name": "my-cool-project",
|
"X-Client-Name": "my-cool-project",
|
||||||
},
|
},
|
||||||
proxies=getproxy(("fanyi", typename)),
|
proxies=getproxy(("fanyi", typename)),
|
||||||
|
timeout=10,
|
||||||
).json()
|
).json()
|
||||||
try:
|
try:
|
||||||
models = js["models"]
|
models = js["models"]
|
||||||
|
@ -96,6 +96,7 @@ def list_models(typename, regist):
|
|||||||
"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]},
|
||||||
proxies=getproxy(("fanyi", typename)),
|
proxies=getproxy(("fanyi", typename)),
|
||||||
|
timeout=10,
|
||||||
).json()
|
).json()
|
||||||
try:
|
try:
|
||||||
models = js["models"]
|
models = js["models"]
|
||||||
|
@ -10,6 +10,7 @@ def list_models(typename, regist):
|
|||||||
createurl(regist["API接口地址"]())[: -len("/chat/completions")] + "/models",
|
createurl(regist["API接口地址"]())[: -len("/chat/completions")] + "/models",
|
||||||
headers={"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0]},
|
headers={"Authorization": "Bearer " + regist["SECRET_KEY"]().split("|")[0]},
|
||||||
proxies=getproxy(("fanyi", typename)),
|
proxies=getproxy(("fanyi", typename)),
|
||||||
|
timeout=10,
|
||||||
).json()
|
).json()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -51,7 +52,7 @@ class gptcommon(basetrans):
|
|||||||
|
|
||||||
def createheaders(self):
|
def createheaders(self):
|
||||||
_ = {"Authorization": "Bearer " + self.multiapikeycurrent["SECRET_KEY"]}
|
_ = {"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"]})
|
_.update({"api-key": self.multiapikeycurrent["SECRET_KEY"]})
|
||||||
return _
|
return _
|
||||||
|
|
||||||
|
@ -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 1)
|
set(VERSION_PATCH 2)
|
||||||
|
|
||||||
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