Skip to content

Commit

Permalink
fix: 修复openai默认域名设置失效的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Pylogmon committed Mar 11, 2023
1 parent c92e45b commit f3b887e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/interfaces/openai.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export const info = {

export async function translate(text, from, to) {
const { supportLanguage } = info;
const domain = get('openai_domain', "api.openai.com");
let domain = get('openai_domain', "api.openai.com");
if (domain == '') {
domain = "api.openai.com"
}
const apikey = get('openai_apikey', "");
if (apikey == "") {
return "请先配置apikey"
Expand Down
5 changes: 4 additions & 1 deletion src/interfaces/openai_code.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ export const info = {

export async function translate(text, from, to) {
const { supportLanguage } = info;
const domain = get('openai_domain', "api.openai.com");
let domain = get('openai_domain', "api.openai.com");
if (domain == '') {
domain = "api.openai.com"
}
const apikey = get('openai_apikey', "");
if (apikey == "") {
return "请先配置apikey"
Expand Down
5 changes: 4 additions & 1 deletion src/interfaces/openai_polish.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ export const info = {

export async function translate(text, from, to) {
const { supportLanguage } = info;
const domain = get('openai_domain', "api.openai.com");
let domain = get('openai_domain', "api.openai.com");
if (domain == '') {
domain = "api.openai.com"
}
const apikey = get('openai_apikey', "");
if (apikey == "") {
return "请先配置apikey"
Expand Down
5 changes: 4 additions & 1 deletion src/interfaces/openai_summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ export const info = {

export async function translate(text, from, to) {
const { supportLanguage } = info;
const domain = get('openai_domain', "api.openai.com");
let domain = get('openai_domain', "api.openai.com");
if (domain == '') {
domain = "api.openai.com"
}
const apikey = get('openai_apikey', "");
if (apikey == "") {
return "请先配置apikey"
Expand Down

0 comments on commit f3b887e

Please sign in to comment.