feat: Add AI API Custom Header

This commit is contained in:
FlyLoongZ
2025-08-11 16:28:23 +08:00
parent e1f902c203
commit a9b858ec6f
4 changed files with 42 additions and 3 deletions

View File

@@ -563,6 +563,7 @@ const defaultOpenaiApi = {
model: "gpt-4",
systemPrompt: `You are a professional, authentic machine translation engine.`,
userPrompt: `Translate the following source text from ${INPUT_PLACE_FROM} to ${INPUT_PLACE_TO}. Output translation directly without any additional text.\n\nSource Text: ${INPUT_PLACE_TEXT}\n\nTranslated Text:`,
customHeader: "",
customBody: "",
temperature: 0,
maxTokens: 256,
@@ -578,6 +579,7 @@ const defaultOllamaApi = {
model: "llama3.1",
systemPrompt: `You are a professional, authentic machine translation engine.`,
userPrompt: `Translate the following source text from ${INPUT_PLACE_FROM} to ${INPUT_PLACE_TO}. Output translation directly without any additional text.\n\nSource Text: ${INPUT_PLACE_TEXT}\n\nTranslated Text:`,
customHeader: "",
customBody: "",
think: false,
thinkIgnore: `qwen3,deepseek-r1`,
@@ -679,6 +681,7 @@ export const DEFAULT_TRANS_APIS = {
model: "gemini-2.5-flash",
systemPrompt: `You are a professional, authentic machine translation engine.`,
userPrompt: `Translate the following source text from ${INPUT_PLACE_FROM} to ${INPUT_PLACE_TO}. Output translation directly without any additional text.\n\nSource Text: ${INPUT_PLACE_TEXT}\n\nTranslated Text:`,
customHeader: "",
customBody: "",
temperature: 0,
maxTokens: 2048,
@@ -694,6 +697,7 @@ export const DEFAULT_TRANS_APIS = {
model: "gemini-2.0-flash",
systemPrompt: `You are a professional, authentic machine translation engine.`,
userPrompt: `Translate the following source text from ${INPUT_PLACE_FROM} to ${INPUT_PLACE_TO}. Output translation directly without any additional text.\n\nSource Text: ${INPUT_PLACE_TEXT}\n\nTranslated Text:`,
customHeader: "",
customBody: "",
temperature: 0,
maxTokens: 2048,
@@ -709,6 +713,7 @@ export const DEFAULT_TRANS_APIS = {
model: "claude-3-haiku-20240307",
systemPrompt: `You are a professional, authentic machine translation engine.`,
userPrompt: `Translate the following source text from ${INPUT_PLACE_FROM} to ${INPUT_PLACE_TO}. Output translation directly without any additional text.\n\nSource Text: ${INPUT_PLACE_TEXT}\n\nTranslated Text:`,
customHeader: "",
customBody: "",
temperature: 0,
maxTokens: 1024,