support evaluation
This commit is contained in:
@@ -51,6 +51,37 @@ export const DEFAULT_TEMPLATE = `You are a professional {SOURCE_LANG} ({SOURCE_C
|
||||
3. Produce ONLY the {TARGET_LANG} translation, without any additional explanations, notes, or commentary.
|
||||
4. If [Context] is provided, use it strictly to disambiguate polysemous words. DO NOT add any factual information or descriptive details from the [Context] that are not present in the [Text to Translate].`;
|
||||
|
||||
export const DEFAULT_EVALUATION_TEMPLATE = `You are an expert translation auditor proficient in {SOURCE_LANG} and {TARGET_LANG}.
|
||||
Your task is to critically evaluate the accuracy and quality of a translation.
|
||||
|
||||
[Context Info]
|
||||
- Source Language: {SOURCE_LANG}
|
||||
- Target Language: {TARGET_LANG}
|
||||
- Speaker Identity: {SPEAKER_IDENTITY}
|
||||
- Intended Tone/Register: {TONE_REGISTER}
|
||||
- Context: {CONTEXT}
|
||||
|
||||
[Input]
|
||||
- Source Text: {SOURCE_TEXT}
|
||||
- Translated Text: {TRANSLATED_TEXT}
|
||||
|
||||
[Instructions]
|
||||
1. Compare the [Source Text] and [Translated Text] meticulously.
|
||||
2. Check if the translation respects the [Context Info] and [Speaker Identity].
|
||||
3. Assign an "Accuracy Score" from 0 to 100.
|
||||
- Give 0 if there are fatal semantic errors, complete hallucinations, or if the meaning is reversed.
|
||||
- Deduct points for minor inaccuracies, unnatural phrasing, or tone mismatches.
|
||||
4. Provide a concise "Analysis" of why you gave that score.
|
||||
5. (Optional) Provide "Improvements" for a more accurate/natural translation.
|
||||
|
||||
[Output Format]
|
||||
You MUST respond in JSON format with the following keys. The values for "analysis" and "improvements" MUST be written in Simplified Chinese (简体中文), except when quoting the source or target text:
|
||||
{
|
||||
"score": number,
|
||||
"analysis": "string",
|
||||
"improvements": "string"
|
||||
}`;
|
||||
|
||||
export interface ApiProfile {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -68,6 +99,9 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
const enableStreaming = useLocalStorage('enable-streaming', true);
|
||||
const systemPromptTemplate = useLocalStorage('system-prompt-template', DEFAULT_TEMPLATE);
|
||||
|
||||
const enableEvaluation = useLocalStorage('enable-evaluation', true);
|
||||
const evaluationPromptTemplate = useLocalStorage('evaluation-prompt-template', DEFAULT_EVALUATION_TEMPLATE);
|
||||
|
||||
// 存储整个对象以保持一致性
|
||||
const sourceLang = useLocalStorage<Language>('source-lang-v2', LANGUAGES[0]);
|
||||
const targetLang = useLocalStorage<Language>('target-lang-v2', LANGUAGES[4]);
|
||||
@@ -97,6 +131,8 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
profiles,
|
||||
enableStreaming,
|
||||
systemPromptTemplate,
|
||||
enableEvaluation,
|
||||
evaluationPromptTemplate,
|
||||
sourceLang,
|
||||
targetLang,
|
||||
speakerIdentity,
|
||||
|
||||
Reference in New Issue
Block a user