This commit is contained in:
恍兮惚兮 2024-07-19 23:47:48 +08:00
parent ca50467324
commit e5c86a212e

View File

@ -128,16 +128,19 @@ class gptcommon(basetrans):
message.append({"role": "user", "content": query})
usingstream = self.config["流式输出"]
url = self.config["API接口地址"]
if url.endswith("/chat/completions"):
pass
else:
url = self.checkv1(url) + "/chat/completions"
response = self.proxysession.post(
url,
self.createurl(),
headers=self.createheaders(),
params=self.createparam(),
json=self.createdata(message),
stream=usingstream,
)
return self.commonparseresponse(query, response, usingstream)
def createurl(self):
url = self.config["API接口地址"]
if url.endswith("/chat/completions"):
pass
else:
url = self.checkv1(url) + "/chat/completions"
return url