fix: openAiBaseUrl为空的情况

This commit is contained in:
ikechan8370 2023-03-11 20:38:28 +08:00
parent 36cdd701f9
commit b140a9955b

View file

@ -23,6 +23,9 @@ export async function createImage (prompt, n = 1, size = '512x512') {
// 如果配了proxy而且有反代但是没开启强制反代
basePath = defaultOpenAIReverseProxy
}
if (!Config.openAiBaseUrl) {
basePath = defaultOpenAIReverseProxy
}
const configuration = new Configuration({
apiKey: Config.apiKey,
basePath: basePath + '/v1'
@ -50,6 +53,9 @@ export async function imageVariation (imageUrl, n = 1, size = '512x512') {
// 如果配了proxy而且有反代但是没开启强制反代
basePath = defaultOpenAIReverseProxy
}
if (!Config.openAiBaseUrl) {
basePath = defaultOpenAIReverseProxy
}
const configuration = new Configuration({
apiKey: Config.apiKey,
basePath: basePath + '/v1'
@ -124,6 +130,9 @@ export async function editImage (originalImage, mask = [], prompt, num = 1, size
// 如果配了proxy而且有反代但是没开启强制反代
basePath = defaultOpenAIReverseProxy
}
if (!Config.openAiBaseUrl) {
basePath = defaultOpenAIReverseProxy
}
const configuration = new Configuration({
apiKey: Config.apiKey,
basePath: basePath + '/v1'