This commit is contained in:
恍兮惚兮 2024-10-18 16:24:00 +08:00
parent f42f2edeee
commit 0a3ac492f3
7 changed files with 18 additions and 8 deletions

View File

@ -48,7 +48,7 @@ class TS(basetrans):
stream=usingstream,
)
response = self.proxysession.post(
urlpathjoin(checkv1(self.config["BASE_URL"]), "messages"),
urlpathjoin(checkv1(self.config["BASE_URL"].strip()), "messages"),
headers=headers,
json=data,
stream=usingstream,

View File

@ -62,7 +62,7 @@ class TS(basetrans):
payload = {**contents, **safety, **sys_message, **gen_config}
res = self.proxysession.post(
urlpathjoin(
self.config["BASE_URL"],
self.config["BASE_URL"].strip(),
f"v1beta/models/{model}:{['generateContent','streamGenerateContent'][usingstream]}",
),
params={"key": self.multiapikeycurrent["SECRET_KEY"]},

View File

@ -25,7 +25,9 @@ def list_models(typename, regist):
class gptcommon(basetrans):
@property
def apiurl(self):
return self.config.get("API接口地址", self.config.get("OPENAI_API_BASE", ""))
return self.config.get(
"API接口地址", self.config.get("OPENAI_API_BASE", "")
).strip()
def langmap(self):
return createenglishlangmap()
@ -86,7 +88,8 @@ class gptcommon(basetrans):
break
try:
json_data = json.loads(response_data)
if len(json_data["choices"]) == 0:
continue
msg = json_data["choices"][0].get("delta", {}).get("content", None)
if msg:
message += msg
@ -124,6 +127,7 @@ class gptcommon(basetrans):
if prefill:
message.append({"role": "assistant", "content": prefill})
usingstream = self.config["流式输出"]
print(self.createurl())
response = self.proxysession.post(
self.createurl(),
headers=self.createheaders(),

View File

@ -57,7 +57,9 @@
### **Azure**
https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#completions
**API Endpoint URL** `https://{endpoint}.openai.azure.com/openai/deployments/{deployName}/chat/completions?api-version=2023-12-01-preview`
Replace `{endpoint}` and `{deployName}` with your endpoint and deployName.
<!-- tabs:end -->

View File

@ -57,7 +57,9 @@
### **Azure**
https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#completions
**Адрес API интерфейса** `https://{endpoint}.openai.azure.com/openai/deployments/{deployName}/chat/completions?api-version=2023-12-01-preview`
Замените `{endpoint}` и `{deployName}` на ваш endpoint и deployName.
<!-- tabs:end -->

View File

@ -59,7 +59,9 @@
### **Azure**
https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#completions
**API接口地址** `https://{endpoint}.openai.azure.com/openai/deployments/{deployName}/chat/completions?api-version=2023-12-01-preview`
其中,将`{endpoint}`和`{deployName}`替换成你的endpoint和deployName
<!-- tabs:end -->

View File

@ -29,7 +29,7 @@ include(generate_product_version)
set(VERSION_MAJOR 5)
set(VERSION_MINOR 43)
set(VERSION_PATCH 1)
set(VERSION_PATCH 2)
add_library(pch pch.cpp)
target_precompile_headers(pch PUBLIC pch.h)