You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -33,17 +40,17 @@ export const model = 'deepseek-chat';
33
40
exportconstsystemPrompt=
34
41
'You are a professional technical translator specializing in software documentation. You are particularly skilled at translating React, web development, and programming terminology, keeping the translations consistent and readable.';
35
42
36
-
// Improved $translateDocument function with language-specific prompts
37
-
exportasyncfunction$translateDocument({
38
-
content,
39
-
langConfig,
40
-
context='',
41
-
}: TranslateDocumentParams): Promise<string>{
43
+
// Helper function to translate a single chunk
44
+
asyncfunctiontranslateChunk(
45
+
chunk: string,
46
+
langConfig: LangConfig,
47
+
context: string,
48
+
): Promise<string>{
42
49
if(!openai){
43
50
thrownewError('OPENAI_API_KEY is not set.');
44
51
}
45
52
46
-
consttextLength=content.length;
53
+
consttextLength=chunk.length;
47
54
constprompt=`
48
55
Translate the following documentation from English to ${langConfig.name}.
49
56
The document being translated is of MDX file type, which means there are components in the text. Please ensure component closing tags are not missing, for example:
@@ -60,33 +67,101 @@ HERE IS THE TEXT TO TRANSLATE:
0 commit comments