Skip to content
This repository has been archived by the owner on Jan 4, 2025. It is now read-only.

Commit

Permalink
Remove 2 models.
Browse files Browse the repository at this point in the history
  • Loading branch information
SIPC committed Feb 15, 2024
1 parent a3619e8 commit 06706ae
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 19 deletions.
2 changes: 0 additions & 2 deletions src/components/ResultBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ export function ResultContainer({ loading, result }: ResultContainerProps) {
<ResultBox loading={loading} name="Microsoft" content={result.microsoft} />
<ResultBox loading={loading} name="Google" content={result.google} />
<ResultBox loading={loading} name="Transmart" content={result.transmart} />
<ResultBox loading={loading} name="Niutrans" content={result.niutrans} />
<ResultBox loading={loading} name="M2m100" content={result.m2m100} />
</div>
);
}
4 changes: 0 additions & 4 deletions src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ export type TranslateResult = {
microsoft: string;
google: string;
sougou: string;
niutrans: string;
transmart: string;
m2m100: string;
};

export type TranslateResponse = {
Expand All @@ -26,9 +24,7 @@ export const initializeTranslateState: TranslateResult = {
microsoft: "",
google: "",
sougou: "",
niutrans: "",
transmart: "",
m2m100: "",
};

export async function translateContent(
Expand Down
6 changes: 3 additions & 3 deletions src/pages/api/lib/chatgpt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class ChatGPT {
}

export const ChatGPTInstance = new ChatGPT(
process.env.OpenAI_API_KEY as string,
process.env.OpenAI_API_ENDPOINT as string,
process.env.OpenAI_MODEL as string,
process.env.OpenAI_API_KEY!,
process.env.OpenAI_API_ENDPOINT!,
process.env.OpenAI_MODEL!,
);
2 changes: 1 addition & 1 deletion src/pages/api/lib/deeplx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ export class DeepLX {
}

export const DeeplXInstance = new DeepLX(
process.env.DEEPL_X_API_URL || "https://api.sipc.ink/translate",
process.env.DEEPL_X_API_URL!,
);
File renamed without changes.
File renamed without changes.
12 changes: 3 additions & 9 deletions src/pages/api/translate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { ChatGPTInstance } from "./lib/chatgpt";
import { DeeplXInstance } from "./lib/deeplx";
import { MicrosoftInstance } from "./lib/microsoft";
import { GoogleInstance } from "./lib/google";
import { NiutransInstance } from "./lib/niutrans";
import { M2m100Instance } from "./lib/m2m100";
import { GeminiInstance } from "./lib/gemini";
import { TransmartInstance } from "./lib/transmart";
import { autodetect } from "./lib/autodetect";
Expand All @@ -17,9 +15,7 @@ type TranslateResult = {
microsoft: string;
google: string;
gemini: string;
niutrans: string;
transmart: string;
m2m100: string;
};

type TranslateResponse = {
Expand Down Expand Up @@ -53,21 +49,19 @@ export default async function handler(

// code from sipc
if (text.length < 5000) {
const [chatgpt, gemini, deeplx, microsoft, google, niutrans, transmart, m2m100] =
const [chatgpt, gemini, deeplx, microsoft, google, transmart] =
await Promise.all([
ChatGPTInstance.translate(text, targetLanguage, sourceLanguage).catch((e) => e.message,),
GeminiInstance.translate(text, targetLanguage, sourceLanguage).catch((e) => e.message,),
DeeplXInstance.translate(text, targetLanguage, sourceLanguage).catch((e) => e.message,),
MicrosoftInstance.translate(text, targetLanguage, sourceLanguage).catch((e) => e.message,),
GoogleInstance.translate(text, targetLanguage, sourceLanguage).catch((e) => e.message,),
NiutransInstance.translate(text, targetLanguage, sourceLanguage).catch((e) => e.message,),
TransmartInstance.translate(text, targetLanguage, sourceLanguage).catch((e) => e.message,),
M2m100Instance.translate(text, targetLanguage, sourceLanguage).catch((e) => e.message,),
]);
res.status(200).json({
status: true,
source: sourceLanguage,
data: { chatgpt, gemini, deeplx, microsoft, google, niutrans, transmart, m2m100},
data: { chatgpt, gemini, deeplx, microsoft, google, transmart},
});
} else {
const [chatgpt, gemini, microsoft] =
Expand All @@ -79,7 +73,7 @@ export default async function handler(
res.status(200).json({
status: true,
source: sourceLanguage,
data: { chatgpt, gemini, deeplx:'Extra-long', microsoft, google:'Extra-long', niutrans:'Extra-long', transmart:'Extra-long', m2m100:'Extra-long'},
data: { chatgpt, gemini, deeplx:'Extra-long', microsoft, google:'Extra-long', transmart:'Extra-long'},
});
}
} catch (e) {
Expand Down

0 comments on commit 06706ae

Please sign in to comment.