Skip to content

Commit

Permalink
fix: 修复OpenAI请求路径
Browse files Browse the repository at this point in the history
  • Loading branch information
Pylogmon committed May 18, 2023
1 parent 6b361fe commit 0c40eae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/interfaces/openai_code.js
Expand Up @@ -78,7 +78,7 @@ export async function translate(text, from, to, setText) {
}

if (stream) {
const res = await window.fetch(`https://${domain}/v1/chat/completions`, {
const res = await window.fetch(`https://${domain}${path}`, {
method: 'POST',
headers: headers,
body: JSON.stringify(body)
Expand Down Expand Up @@ -127,7 +127,7 @@ export async function translate(text, from, to, setText) {
throw 'http请求出错\n' + JSON.stringify(res);
}
} else {
let res = await fetch(`https://${domain}/v1/chat/completions`, {
let res = await fetch(`https://${domain}${path}`, {
method: 'POST',
headers: headers,
body: { type: 'Json', payload: body },
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/openai_polish.js
Expand Up @@ -75,7 +75,7 @@ export async function translate(text, from, to, setText) {
}

if (stream) {
const res = await window.fetch(`https://${domain}/v1/chat/completions`, {
const res = await window.fetch(`https://${domain}${path}`, {
method: 'POST',
headers: headers,
body: JSON.stringify(body)
Expand Down Expand Up @@ -124,7 +124,7 @@ export async function translate(text, from, to, setText) {
throw 'http请求出错\n' + JSON.stringify(res);
}
} else {
let res = await fetch(`https://${domain}/v1/chat/completions`, {
let res = await fetch(`https://${domain}${path}`, {
method: 'POST',
headers: headers,
body: { type: 'Json', payload: body },
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/openai_summary.js
Expand Up @@ -75,7 +75,7 @@ export async function translate(text, from, to, setText) {
}

if (stream) {
const res = await window.fetch(`https://${domain}/v1/chat/completions`, {
const res = await window.fetch(`https://${domain}${path}`, {
method: 'POST',
headers: headers,
body: JSON.stringify(body)
Expand Down Expand Up @@ -124,7 +124,7 @@ export async function translate(text, from, to, setText) {
throw 'http请求出错\n' + JSON.stringify(res);
}
} else {
let res = await fetch(`https://${domain}/v1/chat/completions`, {
let res = await fetch(`https://${domain}${path}`, {
method: 'POST',
headers: headers,
body: { type: 'Json', payload: body },
Expand Down

0 comments on commit 0c40eae

Please sign in to comment.