自定义评估器 修复了 prompt置空的bug

This commit is contained in:
2026-01-21 21:57:06 +08:00
parent 7da8a042cb
commit 6c87af46ba

View File

@@ -133,7 +133,7 @@
} }
.markdown-editor { .markdown-editor {
width: 100%; width: 100%;
height: 250px; height: 350px;
font-family: 'Consolas', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace; font-family: 'Consolas', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
font-size: 14px; font-size: 14px;
line-height: 1.6; line-height: 1.6;
@@ -462,8 +462,8 @@
// 更新默认 Prompt // 更新默认 Prompt
const method = this.dataset.method; const method = this.dataset.method;
const promptEditor = document.getElementById('evalPromptEditor'); const promptEditor = document.getElementById('evalPromptEditor');
if (promptEditor && EVAL_METHOD_PROMPTS[method]) { if (promptEditor && EVAL_METHOD_PROMPTS.hasOwnProperty(method)) {
promptEditor.innerText = EVAL_METHOD_PROMPTS[method] || ''; promptEditor.innerText = EVAL_METHOD_PROMPTS[method];
updateMarkdownHighlight(); updateMarkdownHighlight();
syncEditorContent(); syncEditorContent();
} }
@@ -472,8 +472,8 @@
// 初始化默认 Prompt // 初始化默认 Prompt
const promptEditor = document.getElementById('evalPromptEditor'); const promptEditor = document.getElementById('evalPromptEditor');
if (promptEditor && EVAL_METHOD_PROMPTS[firstMethod]) { if (promptEditor && EVAL_METHOD_PROMPTS.hasOwnProperty(firstMethod)) {
promptEditor.innerText = EVAL_METHOD_PROMPTS[firstMethod] || ''; promptEditor.innerText = EVAL_METHOD_PROMPTS[firstMethod];
updateMarkdownHighlight(); updateMarkdownHighlight();
syncEditorContent(); syncEditorContent();
} }
@@ -509,7 +509,7 @@
const promptEditor = document.getElementById('evalPromptEditor'); const promptEditor = document.getElementById('evalPromptEditor');
const selectedMethod = document.querySelector('.radio-option.selected input[name="eval_method"]'); const selectedMethod = document.querySelector('.radio-option.selected input[name="eval_method"]');
const method = selectedMethod ? selectedMethod.value : 'standard'; const method = selectedMethod ? selectedMethod.value : 'standard';
if (promptEditor && EVAL_METHOD_PROMPTS[method]) { if (promptEditor && EVAL_METHOD_PROMPTS.hasOwnProperty(method)) {
promptEditor.innerText = EVAL_METHOD_PROMPTS[method]; promptEditor.innerText = EVAL_METHOD_PROMPTS[method];
updateMarkdownHighlight(); updateMarkdownHighlight();
syncEditorContent(); syncEditorContent();