提交 7946cab5 authored 作者: yujiejie's avatar yujiejie

821步骤八完成

上级 c411495d
......@@ -1469,6 +1469,9 @@ function issueMentorAutodl() {
function selectMentorDeployReviewStudent(id) {
mentorState.deployReviewStudentId = Number(id);
// 切换学生时重置全局配置临时变量,避免上一学生输入残留
window.__mentorDeployTempApiUrl = null;
window.__mentorDeployTempApiKey = null;
renderContent();
}
......@@ -1776,9 +1779,12 @@ function getMentorDeployReviewParams(studentId, taskKey) {
var a = (sub && sub.artifact) || {};
var saved = getMentorDeployReviewNode('params', sid, tk)[sid] || {};
var def = MENTOR_DEPLOY_TASKS[tk] || {};
// 全局配置区临时变量优先于已应用状态与学生提交值
var tempUrl = window.__mentorDeployTempApiUrl;
var tempKey = window.__mentorDeployTempApiKey;
return {
apiUrl: saved.apiUrl != null ? saved.apiUrl : (a.apiUrl || ''),
apiKey: saved.apiKey != null ? saved.apiKey : (a.apiKey || ''),
apiUrl: tempUrl != null ? tempUrl : (saved.apiUrl != null ? saved.apiUrl : (a.apiUrl || '')),
apiKey: tempKey != null ? tempKey : (saved.apiKey != null ? saved.apiKey : (a.apiKey || '')),
modelName: saved.modelName != null ? saved.modelName : (a.modelName || ''),
apiPath: saved.apiPath != null ? saved.apiPath : (a.apiPath || def.mainPath || '/v1/chat/completions'),
prompt: saved.prompt != null ? saved.prompt : (def.defaultPrompt || '请用一句话介绍你自己。'),
......@@ -2217,8 +2223,6 @@ function buildMentorDeployParamsPanel(sid) {
'<div class="flex items-center justify-between mb-2"><h3 class="font-semibold text-[#1D2129]">验收参数</h3>' + (locked ? '<span class="text-xs px-2 py-1 rounded bg-rose-100 text-rose-700">提交后只读</span>' : '<span class="text-xs px-2 py-1 rounded bg-[#E8F3FF] text-[#165DFF]">临时调整</span>') + '</div>' +
'<p class="text-xs text-[#86909C] mb-3">已带入学生提交值,以下调整仅用于本次验收,不会修改学生原始提交内容。</p>' +
'<div class="space-y-2.5">' +
'<div><label class="text-xs font-medium text-[#4E5969] block mb-1">API 地址</label><input class="input-field text-sm font-mono' + readonlyClass + '" value="' + mentorDeployReviewEsc(p.apiUrl) + '" placeholder="http://IP:端口"' + disabled + '></div>' +
'<div><label class="text-xs font-medium text-[#4E5969] block mb-1">API Key</label>' + buildMentorDeployApiKeyCell(p.apiKey) + '</div>' +
'<div class="grid grid-cols-2 gap-2">' +
'<div><label class="text-xs font-medium text-[#4E5969] block mb-1">模型名称</label><input class="input-field text-sm font-mono' + readonlyClass + '" value="' + mentorDeployReviewEsc(p.modelName) + '"' + disabled + '></div>' +
'<div><label class="text-xs font-medium text-[#4E5969] block mb-1">请求路径</label><input class="input-field text-sm font-mono' + readonlyClass + '" value="' + mentorDeployReviewEsc(p.apiPath) + '"' + disabled + '></div>' +
......@@ -2228,6 +2232,45 @@ function buildMentorDeployParamsPanel(sid) {
'</div>';
}
function buildMentorDeployGlobalConfig(sid) {
var p = getMentorDeployReviewParams(sid);
var tempUrl = window.__mentorDeployTempApiUrl != null ? window.__mentorDeployTempApiUrl : p.apiUrl;
var tempKey = window.__mentorDeployTempApiKey != null ? window.__mentorDeployTempApiKey : p.apiKey;
return '<div class="bg-white rounded-lg border border-[#E5E6EB] p-4 mb-4">' +
'<div class="flex items-center justify-between mb-2"><h3 class="font-semibold text-[#1D2129]">全局配置</h3><span class="text-xs px-2 py-1 rounded bg-[#E8F3FF] text-[#165DFF]">所有测试项共用</span></div>' +
'<p class="text-xs text-[#86909C] mb-3">API 地址与 Key 全局生效,默认带入学生提交值,可修改后点击「应用」。</p>' +
'<div class="space-y-2.5">' +
'<div><label class="text-xs font-medium text-[#4E5969] block mb-1">API 地址</label><input class="input-field text-sm font-mono" value="' + mentorDeployReviewEsc(tempUrl) + '" placeholder="http://IP:端口" oninput="window.__mentorDeployTempApiUrl=this.value"></div>' +
'<div><label class="text-xs font-medium text-[#4E5969] block mb-1">API Key</label><input class="input-field text-sm font-mono" type="password" value="' + mentorDeployReviewEsc(tempKey) + '" placeholder="sk-..." oninput="window.__mentorDeployTempApiKey=this.value"></div>' +
'</div>' +
'<div class="flex gap-2 mt-3">' +
'<button class="btn-primary flex-1 py-2 text-sm" onclick="applyMentorDeployTempConfig()">应用</button>' +
'<button class="btn-outline flex-1 py-2 text-sm" onclick="resetMentorDeployTempConfig()">恢复学生值</button>' +
'</div>' +
'</div>';
}
function applyMentorDeployTempConfig() {
var sid = Number(mentorState.deployReviewStudentId);
var map = getMentorDeployReviewNode('params', sid);
if (!map[sid]) map[sid] = {};
map[sid].apiUrl = String(window.__mentorDeployTempApiUrl == null ? '' : window.__mentorDeployTempApiUrl).trim();
map[sid].apiKey = String(window.__mentorDeployTempApiKey == null ? '' : window.__mentorDeployTempApiKey).trim();
renderContent();
}
function resetMentorDeployTempConfig() {
window.__mentorDeployTempApiUrl = null;
window.__mentorDeployTempApiKey = null;
var sid = Number(mentorState.deployReviewStudentId);
var map = getMentorDeployReviewNode('params', sid);
if (map[sid]) {
delete map[sid].apiUrl;
delete map[sid].apiKey;
}
renderContent();
}
function buildMentorDeployTextModelItems(sid) {
var p = getMentorDeployReviewParams(sid);
var tests = getMentorDeployReviewNode('tests', sid)[sid] || {};
......@@ -2604,10 +2647,11 @@ function buildMentorDeployReviewPanel(student) {
var locked = isMentorDeployReviewLocked(sid);
var leftHtml = buildMentorDeployReviewHistoryHtml(sid) + buildMentorDeployParamsPanel(sid) + itemsHtml;
var rightHtml = locked ? buildMentorDeployLockedReviewPanel(sid) : buildMentorDeployScoreCard(sid) + buildMentorDeployConclusionPanel(sid);
return '<div class="grid grid-cols-12 gap-4 items-start">' +
'<div class="col-span-7 min-w-0">' + leftHtml + '</div>' +
'<div class="col-span-5 min-w-0">' + rightHtml + '</div>' +
'</div>';
return buildMentorDeployGlobalConfig(sid) +
'<div class="grid grid-cols-12 gap-4 items-start">' +
'<div class="col-span-7 min-w-0">' + leftHtml + '</div>' +
'<div class="col-span-5 min-w-0">' + rightHtml + '</div>' +
'</div>';
}
function getMentorDeployMissingApiTests(sid) {
......@@ -2772,6 +2816,9 @@ function switchMentorDeployTask(taskKey) {
if (typeof stopMentorDeployGenPolling === 'function') stopMentorDeployGenPolling();
mentorDeployReviewState.activeTask = taskKey;
mentorDeployReviewState.contentTab = 'artifact';
// 切换任务时重置全局配置临时变量
window.__mentorDeployTempApiUrl = null;
window.__mentorDeployTempApiKey = null;
renderContent();
}
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论