提交 c411495d authored 作者: yujiejie's avatar yujiejie

821步骤七完成

上级 2dfb77de
...@@ -1542,8 +1542,48 @@ function getMentorDeployCompletenessLabel(studentId, taskKey) { ...@@ -1542,8 +1542,48 @@ function getMentorDeployCompletenessLabel(studentId, taskKey) {
} }
function maskMentorDeployApiKey(key) { function maskMentorDeployApiKey(key) {
if (!key) return '未配置'; if (!key) return '';
return '已配置 · ' + String(key).slice(0, 3) + '••••••••'; return String(key).slice(0, 3) + '••••••••';
}
function getMentorDeployApiKeyStatus(key) {
return key ? '已配置' : '未配置';
}
function copyMentorDeployApiKey(btn, key) {
var el = document.createElement('textarea');
el.value = key || '';
el.style.position = 'fixed';
el.style.opacity = '0';
document.body.appendChild(el);
el.select();
try { document.execCommand('copy'); } catch (e) {}
document.body.removeChild(el);
if (btn) {
btn.innerHTML = '<svg class="w-3.5 h-3.5" data-lucide="check"></svg>';
btn.classList.add('bg-emerald-100', 'text-emerald-700');
btn.classList.remove('bg-[#F2F3F5]', 'text-[#4E5969]');
setTimeout(function() {
btn.innerHTML = '<svg class="w-3.5 h-3.5" data-lucide="copy"></svg>';
btn.classList.add('bg-[#F2F3F5]', 'text-[#4E5969]');
btn.classList.remove('bg-emerald-100', 'text-emerald-700');
if (window.lucide) lucide.createIcons();
}, 1500);
}
if (window.lucide) lucide.createIcons();
}
function buildMentorDeployApiKeyCell(key) {
var status = getMentorDeployApiKeyStatus(key);
var statusClass = key ? 'bg-emerald-50 text-emerald-700' : 'bg-[#F2F3F5] text-[#86909C]';
var copyBtn = key
? '<button type="button" title="复制 API Key" class="w-6 h-6 flex items-center justify-center rounded bg-[#F2F3F5] text-[#4E5969] hover:bg-[#E8F3FF] hover:text-[#165DFF] transition-all flex-shrink-0" onclick="copyMentorDeployApiKey(this,\'' + mentorDeployReviewEsc(key) + '\')"><svg class="w-3.5 h-3.5" data-lucide="copy"></svg></button>'
: '';
return '<div class="flex items-center gap-1.5 mt-1 min-w-0">' +
'<span class="text-[11px] px-1.5 py-0.5 rounded flex-shrink-0 ' + statusClass + '">' + status + '</span>' +
'<span class="text-sm font-medium font-mono break-all">' + mentorDeployReviewEsc(maskMentorDeployApiKey(key)) + '</span>' +
copyBtn +
'</div>';
} }
function getMentorDeployNowTimestamp() { function getMentorDeployNowTimestamp() {
...@@ -1618,7 +1658,7 @@ function buildMentorDeploySubmissionPanel(sub) { ...@@ -1618,7 +1658,7 @@ function buildMentorDeploySubmissionPanel(sub) {
'<div class="p-3 rounded-lg bg-[#F7F8FA]"><div class="text-xs text-[#86909C]">API 地址</div><div class="text-sm font-medium mt-1 break-all font-mono">' + mentorDeployReviewEsc(a.apiUrl || '—') + '</div></div>' + '<div class="p-3 rounded-lg bg-[#F7F8FA]"><div class="text-xs text-[#86909C]">API 地址</div><div class="text-sm font-medium mt-1 break-all font-mono">' + mentorDeployReviewEsc(a.apiUrl || '—') + '</div></div>' +
'<div class="p-3 rounded-lg bg-[#F7F8FA]"><div class="text-xs text-[#86909C]">请求路径</div><div class="text-sm font-medium mt-1 font-mono">' + mentorDeployReviewEsc(a.apiPath || '—') + '</div></div>' + '<div class="p-3 rounded-lg bg-[#F7F8FA]"><div class="text-xs text-[#86909C]">请求路径</div><div class="text-sm font-medium mt-1 font-mono">' + mentorDeployReviewEsc(a.apiPath || '—') + '</div></div>' +
'<div class="p-3 rounded-lg bg-[#F7F8FA]"><div class="text-xs text-[#86909C]">端口</div><div class="text-sm font-medium mt-1 font-mono">' + mentorDeployReviewEsc(a.port || '—') + '</div></div>' + '<div class="p-3 rounded-lg bg-[#F7F8FA]"><div class="text-xs text-[#86909C]">端口</div><div class="text-sm font-medium mt-1 font-mono">' + mentorDeployReviewEsc(a.port || '—') + '</div></div>' +
'<div class="p-3 rounded-lg bg-[#F7F8FA]"><div class="text-xs text-[#86909C]">API Key</div><div class="text-sm font-medium mt-1">' + maskMentorDeployApiKey(a.apiKey) + '</div></div>' + '<div class="p-3 rounded-lg bg-[#F7F8FA]"><div class="text-xs text-[#86909C]">API Key</div>' + buildMentorDeployApiKeyCell(a.apiKey) + '</div>' +
'</div>') + '</div>') +
'</div>'; '</div>';
var logHtml = '<div class="' + (activeTab === 'log' ? '' : 'hidden') + '">' + var logHtml = '<div class="' + (activeTab === 'log' ? '' : 'hidden') + '">' +
...@@ -2178,7 +2218,7 @@ function buildMentorDeployParamsPanel(sid) { ...@@ -2178,7 +2218,7 @@ function buildMentorDeployParamsPanel(sid) {
'<p class="text-xs text-[#86909C] mb-3">已带入学生提交值,以下调整仅用于本次验收,不会修改学生原始提交内容。</p>' + '<p class="text-xs text-[#86909C] mb-3">已带入学生提交值,以下调整仅用于本次验收,不会修改学生原始提交内容。</p>' +
'<div class="space-y-2.5">' + '<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 地址</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><input class="input-field text-sm font-mono' + readonlyClass + '" type="password" value="' + mentorDeployReviewEsc(p.apiKey) + '" placeholder="sk-..."' + 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 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.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>' + '<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>' +
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论