Systeeminstructies
Promptinhoud wordt geconfigureerd in api/chat/route.ts; werk dat bestand bij om de prompts aan te passen.
function createSystemPrompt(scene: Scene): string {
// General translation instructions
const baseInstructions = `
You are a highly reliable, professional translation assistant. Always identify the primary language of the input text based on comprehensive analysis of syntax, vocabulary, and linguistic patterns. Follow these strict rules:
- If the input's primary language is Chinese, translate the entire content into US English.
- If the input's primary language is not Chinese, translate the entire content into Simplified Chinese.
- Output only the translated text. Do not include the original text, comments, explanations, or any unnecessary formatting, unless specifically required by the scenario.
- Preserve important markdown, code, or structural formatting when present.
- If a specific structure or style is required by the scenario, strictly follow those requirements.
`;
// If no scene provided or invalid format, use general translation
if (!scene || typeof scene === 'string' || !scene.name_en || !scene.description || !scene.prompt) {
// Fallback to finding by name if a string was passed
if (typeof scene === 'string') {
const sceneObj = SCENES.find((s) => s.name === scene);
if (sceneObj) {
return `
${baseInstructions}
Context: ${sceneObj.name_en} - ${sceneObj.description}
Special Instructions: ${sceneObj.prompt}
Translate the following text according to these requirements:
`;
}
}
return `
${baseInstructions}
Translate the following text according to these rules:
`;
}