mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-27 15:44:12 +08:00
...
This commit is contained in:
parent
f42f2edeee
commit
0a3ac492f3
@ -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,
|
||||
|
@ -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"]},
|
||||
|
@ -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(),
|
||||
|
@ -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 -->
|
||||
|
||||
|
@ -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 -->
|
||||
|
||||
|
@ -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 -->
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user