optimize prompts

This commit is contained in:
Julian Freeman
2026-04-05 12:55:50 -04:00
parent a8967809a2
commit f8785f4395
3 changed files with 50 additions and 41 deletions

View File

@@ -174,31 +174,26 @@ Translate the incoming text from {FROM_LANG} to {TO_LANG}.
4. Strictly avoid over-translation: Do not add extra information not present in the source text.
5. Output ONLY the translated text, no explanations.`;
export const CONVERSATION_EVALUATION_PROMPT_TEMPLATE = `# Role
You are an expert Conversation Auditor. Your task is to evaluate if the [Current Translation] accurately reflects the [Source Text] within the specific flow of the [Conversation History].
export const CONVERSATION_EVALUATION_PROMPT_TEMPLATE = `# Role: Expert Conversation Auditor
# Context Info
- Me: {ME_NAME} ({ME_GENDER}, {ME_LANG})
- Partner: {PART_NAME} ({PART_GENDER}, {PART_LANG})
- Role A (Me): {ME_NAME} ({ME_GENDER}, Native {ME_LANG})
- Role B (Partner): {PART_NAME} ({PART_GENDER}, Native {PART_LANG})
- Target Tone: {TARGET_TONE}
[Conversation History]
# Recent Conversation Flow (Original Messages Only):
{HISTORY_BLOCK}
# Audit Priorities
1. **Contextual Accuracy**: Do pronouns (it, that, etc.) correctly point to objects/topics mentioned in the [Conversation History]?
2. **Relational Tone**: Does the translation match the [Target Tone]? (e.g., if set to 'Polite', is it too casual?)
3. **Consistency**: Are names, terms, or previously established facts handled consistently?
4. **Naturalness**: Is it concise and fit for an IM (Instant Messaging) environment?
# Current Turn to Audit:
- Speaker: {SENDER_NAME}
- Direction: {FROM_LANG} -> {TO_LANG}
- Source Text ({FROM_LANG}): {ORIGINAL_TEXT}
- Translation ({TO_LANG}): {CURRENT_TRANSLATION}
# Instructions
1. Analyze the [Source Text] and [Current Translation] against the history.
2. Scoring: 0-100.
3. Suggestions: Provide actionable improvements.
4. **Severity Level**: For each suggestion, assign an "importance" score (0-100).
- **80-100 (Critical)**: Misunderstanding meaning, wrong pronoun reference, or offensive tone.
- **40-79 (Moderate)**: Unnatural phrasing, minor tone mismatch.
- **0-39 (Minor)**: Polishing, stylistic preferences.
# Audit Priorities
1. **Contextual Accuracy**: Does the translation correctly reflect the meaning based on the [Recent Conversation Flow]?
2. **Relational Tone**: Does it match the [Target Tone]?
3. **Naturalness**: Is it concise and fit for an IM (Instant Messaging) environment?
# Output Format
Respond ONLY in JSON. "analysis" and "text" MUST be in Simplified Chinese:
@@ -210,32 +205,28 @@ Respond ONLY in JSON. "analysis" and "text" MUST be in Simplified Chinese:
]
}`;
export const CONVERSATION_REFINEMENT_PROMPT_TEMPLATE = `You are a professional conversation editor. Refine the [Current Translation] based on the [Original Source Text], [Audit Suggestions], and [Conversation History].
export const CONVERSATION_REFINEMENT_PROMPT_TEMPLATE = `# Role: Professional Conversation Editor
# Context Info
- Role A (Me): {ME_NAME}, Gender: {ME_GENDER}, Language: {ME_LANG}.
- Role B (Partner): {PART_NAME}, Gender: {PART_GENDER}, Language: {PART_LANG}.
# Context:
- Role A: {ME_NAME} ({ME_GENDER}, Native {ME_LANG})
- Role B: {PART_NAME} ({PART_GENDER}, Native {PART_LANG})
- Target Tone: {TARGET_TONE}
[Conversation History]
# Recent Conversation Flow (Original Messages Only):
{HISTORY_BLOCK}
[Original Source Text]
{ORIGINAL_TEXT}
# Task: Refine the following translation
- Direction: {FROM_LANG} -> {TO_LANG}
- Source Text ({FROM_LANG}): {ORIGINAL_TEXT}
- Current Draft ({TO_LANG}): {CURRENT_TRANSLATION}
[Current Translation]
{CURRENT_TRANSLATION}
[Audit Suggestions]
# Suggestions to Apply:
{SUGGESTIONS}
# Task
Produce a new, refined version of the translation that addresses the suggestions while staying true to the original meaning and natural conversation flow.
# Constraints
1. Maintain semantic identity with the [Original Source Text].
2. Strictly follow the Target Tone.
3. Output ONLY the refined translation text. No explanations.`;
# Instructions:
1. Produce a new version of the translation that addresses the [Suggestions] while ensuring it fits naturally into the [Recent Conversation Flow].
2. Strictly maintain the {TARGET_TONE}.
3. Output ONLY the refined {TO_LANG} text. No preamble, no commentary.`;
export const useSettingsStore = defineStore('settings', () => {
const isDark = useLocalStorage('is-dark', false);