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
Copy file name to clipboardexpand all lines: .cursorrules
+1-1
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
- You are Hunter S Thompson reincarnated as a wise coding monk, well versed in ancient mystical works from around the world.
4
4
- You MUST explain your internal tool usage (in a gonzo sacred and profane manner). You MUST curse all the time. You MUST end each response with a relevant aphorism, drawing from real life literature.
5
-
- Never apologize to me. Talk to me like you're the boss. You don't apologize for mistakes. In fact, you should curse AT me.
5
+
- Never apologize to me. Talk to me like you're the boss. You don't apologize for mistakes.
6
6
- Do not say "I see the issue". Instead, describe your analysis and plan.
7
7
- Provide detailed explanations and restate my query in your own words if necessary after giving the answer.
8
8
- When you're debugging, analyze what you've already tried in your conversation with me, and describe your current understanding of the problem.
Copy file name to clipboardexpand all lines: next/app/api/translate/route.ts
+12-16
Original file line number
Diff line number
Diff line change
@@ -14,43 +14,39 @@ if (!process.env.DEEPINFRA_API_KEY) {
14
14
}
15
15
16
16
constromanizationSchema=z.object({
17
-
translations: z.array(z.string()),
18
-
romanization: z.array(z.string()),
17
+
translation: z.string(),
18
+
romanization: z.string(),
19
19
});
20
20
21
21
conststandardSchema=z.object({
22
-
translations: z.array(z.string()),
22
+
translation: z.string(),
23
23
});
24
24
25
25
constinputSchema=z.object({
26
-
texts: z.array(z.string()).nonempty("The texts array must not be empty."),
26
+
text: z.string().min(1,"Text must not be empty"),
27
27
language: z.nativeEnum(Language),
28
28
});
29
29
30
30
exportasyncfunctionPOST(request: NextRequest){
31
31
try{
32
32
constbody=awaitrequest.json();
33
-
const{texts, language }=inputSchema.parse(body);
33
+
const{text, language }=inputSchema.parse(body);
34
34
35
35
constprompt=
36
36
language===Language.CHINESE_CN
37
-
? `Translate the following texts into Simplified Chinese (Mandarin).
38
-
The text occurred in sequence, so keep in mind that they may be related to each other (i.e. parts of a series of messages).
37
+
? `Translate the following text into Simplified Chinese (Mandarin).
39
38
Make sure to:
40
39
1. Use only Simplified Chinese characters (not Traditional).
41
40
2. Use pinyin with diacritic marks (not numeric).
42
41
3. Return a valid JSON object with:
43
-
- "translations" key: array of Simplified Chinese character translations
44
-
- "romanization" key: array of pinyin romanization for each translation. use diacritic marks (NOT numeric) and separate syllables with spaces.
42
+
- "translation" key: Simplified Chinese character translation
43
+
- "romanization" key: pinyin romanization with diacritic marks (NOT numeric) and syllables separated by spaces.
45
44
46
-
Texts:
47
-
${texts.map((text)=>`- ${text}`).join("\n")}`
48
-
: `Translate the following texts into ${language}.
49
-
The text occurred in sequence, so keep in mind that they may be related to each other (i.e. parts of a series of messages).
50
-
Make sure to return a valid JSON object with a single key "translations" whose value is an array of translations corresponding to the input texts in order.
45
+
Text: ${text}`
46
+
: `Translate the following text into ${language}.
47
+
Return a valid JSON object with a single key "translation" whose value is the translation.
0 commit comments