feat: support AI terms

This commit is contained in:
Gabe
2025-10-01 16:18:19 +08:00
parent 261bb7aa6f
commit 3c5ffc045f
8 changed files with 91 additions and 74 deletions

View File

@@ -573,6 +573,7 @@ export const genTransReq = async ({ reqHook, resHook, ...args }) => {
to,
texts,
docInfo,
glossary,
customHeader,
customBody,
} = args;
@@ -587,7 +588,14 @@ export const genTransReq = async ({ reqHook, resHook, ...args }) => {
if (API_SPE_TYPES.ai.has(apiType)) {
args.systemPrompt = genSystemPrompt({ systemPrompt, from, to });
args.userPrompt = genUserPrompt({ userPrompt, from, to, texts, docInfo });
args.userPrompt = genUserPrompt({
userPrompt,
from,
to,
texts,
docInfo,
glossary,
});
}
const {
@@ -784,7 +792,17 @@ export const parseTransRes = async (
*/
export const handleTranslate = async (
texts = [],
{ from, to, fromLang, toLang, langMap, docInfo, apiSetting, usePool }
{
from,
to,
fromLang,
toLang,
langMap,
docInfo,
glossary,
apiSetting,
usePool,
}
) => {
let history = null;
let hisMsgs = [];
@@ -815,6 +833,7 @@ export const handleTranslate = async (
toLang,
langMap,
docInfo,
glossary,
hisMsgs,
token,
...apiSetting,