Skip to content

Commit

Permalink
fix qwen translate error
Browse files Browse the repository at this point in the history
  • Loading branch information
SIPC committed Feb 25, 2024
1 parent 6460492 commit e28f962
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
14 changes: 7 additions & 7 deletions src/pages/api/lib/chatgpt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/pages/api/lib/gemini.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
],
},
Expand Down
14 changes: 7 additions & 7 deletions src/pages/api/lib/qwen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
],
},
Expand Down

0 comments on commit e28f962

Please sign in to comment.