Files
learn-languages/src/lib/actions/translatorActions.ts
goddonebianu 0bf3b718b2
All checks were successful
continuous-integration/drone/push Build is passing
...
2025-11-17 15:59:35 +08:00

30 lines
887 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use server";
import { getLLMAnswer } from "./ai";
export const genIPA = async (text: string) => {
return (
"[" +
(
await getLLMAnswer(
`${text}\n请生成以上文本的严式国际音标然后直接发给我不要附带任何说明不要擅自增减符号。`,
)
)
.replaceAll("[", "")
.replaceAll("]", "") +
"]"
);
};
export const genLocale = async (text: string) => {
return await getLLMAnswer(
`${text}\n推断以上文本的地区locale然后直接发给我形如如zh-CN不要附带任何说明不要擅自增减符号。`,
);
};
export const genTranslation = async (text: string, targetLanguage: string) => {
return await getLLMAnswer(
`${text}\n请将以上文本翻译到${targetLanguage},然后直接发给我,不要附带任何说明,不要擅自增减符号。`,
);
};