From e28f962816ba530acd4a616b5c9d41e3e116a1ba Mon Sep 17 00:00:00 2001 From: "sipc.ink" <92251518+SIPC@users.noreply.github.com> Date: Sun, 25 Feb 2024 23:57:23 +0800 Subject: [PATCH] fix qwen translate error --- src/pages/api/lib/chatgpt.ts | 14 +++++++------- src/pages/api/lib/gemini.ts | 6 +++--- src/pages/api/lib/qwen.ts | 14 +++++++------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/pages/api/lib/chatgpt.ts b/src/pages/api/lib/chatgpt.ts index 5043fe8..acf118b 100644 --- a/src/pages/api/lib/chatgpt.ts +++ b/src/pages/api/lib/chatgpt.ts @@ -33,22 +33,22 @@ export class ChatGPT { try { const headers = { "Content-Type": "application/json", - Authorization: `Bearer ${this.key}`, + "Authorization": `Bearer ${this.key}`, }; const data = JSON.stringify({ model: this.model, messages: [ { - role: "system", - content: `You are a professional, authentic translation engine, only returns translations.`, + "role": "system", + "content": `You are a professional, authentic translation engine, only returns translations.`, }, { - role: "user", - content: `Please translate the text from ${source} to ${target} language, without explaining my original text.`, + "role": "user", + "content": `Please translate the text from ${source} to ${target} language, without explaining my original text, the text I will send you in the next sentence.`, }, { - role: "user", - content: text, + "role": "user", + "content": text, }, ], temperature: 0.7, diff --git a/src/pages/api/lib/gemini.ts b/src/pages/api/lib/gemini.ts index ae98853..88e798f 100644 --- a/src/pages/api/lib/gemini.ts +++ b/src/pages/api/lib/gemini.ts @@ -37,13 +37,13 @@ export class Gemini { { parts: [ { - text: `You are a professional, authentic translation engine, only returns translations.`, + "text": `You are a professional, authentic translation engine, only returns translations.`, }, { - text: `Please translate the text from ${source} to ${target} language, without explaining my original text.`, + "text": `Please translate the text from ${source} to ${target} language, without explaining my original text, the text I will send you in the next sentence.`, }, { - text: text, + "text": text, }, ], }, diff --git a/src/pages/api/lib/qwen.ts b/src/pages/api/lib/qwen.ts index b08ab7b..178c3cf 100644 --- a/src/pages/api/lib/qwen.ts +++ b/src/pages/api/lib/qwen.ts @@ -34,23 +34,23 @@ export class Qwen { try { const headers = { "Content-Type": "application/json", - Authorization: `Bearer ${this.key}`, + "Authorization": `Bearer ${this.key}`, }; const data = JSON.stringify({ model: this.model, input: { messages: [ { - role: "system", - content: `You are a professional, authentic translation engine, only returns translations.`, + "role": "system", + "content": `You are a professional, authentic translation engine, only returns translations.`, }, { - role: "user", - content: `Please translate the text from ${source} to ${target} language, without explaining my original text.`, + "role": "user", + "content": `Please translate the text from ${source} to ${target} language, without explaining my original text, the text I will send you in the next sentence.`, }, { - role: "user", - content: text, + "role": "user", + "content": text, }, ], },