提交 807688ef authored 作者: yujiejie's avatar yujiejie

821步骤十完成

上级 664f16f3
...@@ -1851,9 +1851,9 @@ function getMentorDeployRequestHeaders() { ...@@ -1851,9 +1851,9 @@ function getMentorDeployRequestHeaders() {
return headers; return headers;
} }
function runMentorDeployModelsTest() { function runMentorDeployModelsTest(taskKey) {
var sid = Number(mentorState.deployReviewStudentId); var sid = Number(mentorState.deployReviewStudentId);
var tk = 'text-model'; var tk = taskKey || getMentorDeployTaskKey(sid);
var p = getMentorDeployReviewParams(sid, tk); var p = getMentorDeployReviewParams(sid, tk);
var base = getMentorDeployBaseUrl(); var base = getMentorDeployBaseUrl();
if (!base) { if (!base) {
...@@ -1919,7 +1919,7 @@ function runMentorDeployModelsTest() { ...@@ -1919,7 +1919,7 @@ function runMentorDeployModelsTest() {
function runMentorDeployChatTest() { function runMentorDeployChatTest() {
var sid = Number(mentorState.deployReviewStudentId); var sid = Number(mentorState.deployReviewStudentId);
var tk = getMentorDeployTaskKey(sid); var tk = 'text-model';
var p = getMentorDeployReviewParams(sid, tk); var p = getMentorDeployReviewParams(sid, tk);
var base = getMentorDeployBaseUrl(); var base = getMentorDeployBaseUrl();
if (!base) { if (!base) {
...@@ -2025,7 +2025,7 @@ function mentorDeployPickTaskInfo(data) { ...@@ -2025,7 +2025,7 @@ function mentorDeployPickTaskInfo(data) {
function runMentorDeployGenSubmitTest() { function runMentorDeployGenSubmitTest() {
var sid = Number(mentorState.deployReviewStudentId); var sid = Number(mentorState.deployReviewStudentId);
var tk = getMentorDeployTaskKey(sid); var tk = 'image-gen';
var p = getMentorDeployReviewParams(sid, tk); var p = getMentorDeployReviewParams(sid, tk);
var base = getMentorDeployBaseUrl(); var base = getMentorDeployBaseUrl();
if (!base) { if (!base) {
...@@ -2098,7 +2098,7 @@ function runMentorDeployGenSubmitTest() { ...@@ -2098,7 +2098,7 @@ function runMentorDeployGenSubmitTest() {
function runMentorDeployGenStatusTest() { function runMentorDeployGenStatusTest() {
var sid = Number(mentorState.deployReviewStudentId); var sid = Number(mentorState.deployReviewStudentId);
var tk = getMentorDeployTaskKey(sid); var tk = 'image-gen';
var p = getMentorDeployReviewParams(sid, tk); var p = getMentorDeployReviewParams(sid, tk);
var base = getMentorDeployBaseUrl(); var base = getMentorDeployBaseUrl();
if (!base) { if (!base) {
...@@ -2321,7 +2321,7 @@ function buildMentorDeployTextModelItems(sid) { ...@@ -2321,7 +2321,7 @@ function buildMentorDeployTextModelItems(sid) {
: '') + : '') +
buildMentorDeployTestError(modelsResult) + buildMentorDeployTestError(modelsResult) +
(modelsResult && modelsResult.raw != null ? '<pre class="mt-2 bg-[#1D2129] text-emerald-300 rounded p-3 text-[10px] overflow-auto max-h-32 leading-relaxed">' + mentorDeployReviewEsc(modelsResult.raw) + '</pre>' : '') + (modelsResult && modelsResult.raw != null ? '<pre class="mt-2 bg-[#1D2129] text-emerald-300 rounded p-3 text-[10px] overflow-auto max-h-32 leading-relaxed">' + mentorDeployReviewEsc(modelsResult.raw) + '</pre>' : '') +
'<button class="btn-outline w-full mt-3 py-2 text-sm" onclick="runMentorDeployModelsTest()"' + (modelsLoading ? ' disabled' : '') + '>' + (modelsLoading ? '测试中…' : '测试') + '</button>' + '<button class="btn-outline w-full mt-3 py-2 text-sm" onclick="runMentorDeployModelsTest(\'text-model\')"' + (modelsLoading ? ' disabled' : '') + '>' + (modelsLoading ? '测试中…' : '测试') + '</button>' +
'</div>' + '</div>' +
'<div class="p-3 rounded-lg bg-[#F7F8FA]">' + '<div class="p-3 rounded-lg bg-[#F7F8FA]">' +
buildMentorDeployTestItemHeader('POST', taskDef.mainPath || '/v1/chat/completions', '聊天补全', chatResult) + buildMentorDeployTestItemHeader('POST', taskDef.mainPath || '/v1/chat/completions', '聊天补全', chatResult) +
...@@ -2353,9 +2353,21 @@ function getMentorDeploySizeOptions(current) { ...@@ -2353,9 +2353,21 @@ function getMentorDeploySizeOptions(current) {
}).join(''); }).join('');
} }
function resetMentorDeployImageGenParams() {
var sid = Number(mentorState.deployReviewStudentId);
var map = getMentorDeployReviewNode('params', sid, 'image-gen');
if (!map[sid]) map[sid] = {};
delete map[sid].imagePrompt;
delete map[sid].size;
delete map[sid].seed;
renderContent();
}
function buildMentorDeployImageGenItems(sid) { function buildMentorDeployImageGenItems(sid) {
var p = getMentorDeployReviewParams(sid); var taskKey = 'image-gen';
var tests = getMentorDeployReviewNode('tests', sid)[sid] || {}; var taskDef = MENTOR_DEPLOY_TASKS[taskKey] || {};
var p = getMentorDeployReviewParams(sid, taskKey);
var tests = getMentorDeployReviewNode('tests', sid, taskKey)[sid] || {};
var modelsResult = tests.models || null; var modelsResult = tests.models || null;
var genResult = tests.genSubmit || null; var genResult = tests.genSubmit || null;
var statusResult = tests.genStatus || null; var statusResult = tests.genStatus || null;
...@@ -2363,29 +2375,35 @@ function buildMentorDeployImageGenItems(sid) { ...@@ -2363,29 +2375,35 @@ function buildMentorDeployImageGenItems(sid) {
var genLoading = !!(genResult && genResult.status === 'loading'); var genLoading = !!(genResult && genResult.status === 'loading');
var statusLoading = !!(statusResult && statusResult.status === 'loading'); var statusLoading = !!(statusResult && statusResult.status === 'loading');
return '<div class="bg-white rounded-lg border border-[#E5E6EB] p-4 mb-4">' + return '<div class="bg-white rounded-lg border border-[#E5E6EB] p-4 mb-4">' +
buildMentorDeployTaskIntro(taskKey) +
'<div class="flex items-center justify-between mb-3"><h3 class="font-semibold text-[#1D2129]">图像生成验收项</h3><span class="text-xs px-2 py-1 rounded bg-[#F2F3F5] text-[#86909C]">' + buildMentorDeployTestSummary(tests, ['models', 'genSubmit', 'genStatus']) + '</span></div>' + '<div class="flex items-center justify-between mb-3"><h3 class="font-semibold text-[#1D2129]">图像生成验收项</h3><span class="text-xs px-2 py-1 rounded bg-[#F2F3F5] text-[#86909C]">' + buildMentorDeployTestSummary(tests, ['models', 'genSubmit', 'genStatus']) + '</span></div>' +
'<div class="p-3 rounded-lg bg-[#F7F8FA] mb-3">' + '<div class="p-3 rounded-lg bg-[#F7F8FA] mb-3">' +
buildMentorDeployTestItemHeader('GET', '/v1/models', '图像模型列表', modelsResult) + buildMentorDeployTestItemHeader('GET', taskDef.modelsPath || '/v1/models', '图像模型列表', modelsResult) +
'<div class="mt-2 text-xs font-mono text-[#4E5969] bg-white border border-[#E5E6EB] rounded p-2 break-all">' + mentorDeployReviewEsc(getMentorDeployModelsUrl()) + '</div>' + '<div class="mt-2 text-xs font-mono text-[#4E5969] bg-white border border-[#E5E6EB] rounded p-2 break-all">' + mentorDeployReviewEsc(getMentorDeployModelsUrl()) + '</div>' +
buildMentorDeployTestMeta(modelsResult) + buildMentorDeployTestMeta(modelsResult) +
buildMentorDeployTestError(modelsResult) + buildMentorDeployTestError(modelsResult) +
'<button class="btn-outline w-full mt-3 py-2 text-sm" onclick="runMentorDeployModelsTest()" ' + (modelsLoading ? ' disabled' : '') + '>' + (modelsLoading ? '测试中…' : '测试') + '</button>' + '<button class="btn-outline w-full mt-3 py-2 text-sm" onclick="runMentorDeployModelsTest(\'image-gen\')" ' + (modelsLoading ? ' disabled' : '') + '>' + (modelsLoading ? '测试中…' : '测试') + '</button>' +
'</div>' + '</div>' +
'<div class="p-3 rounded-lg bg-[#F7F8FA] mb-3">' + '<div class="p-3 rounded-lg bg-[#F7F8FA] mb-3">' +
buildMentorDeployTestItemHeader('POST', '/v1/generations', '提交生成任务', genResult) + buildMentorDeployTestItemHeader('POST', taskDef.mainPath || '/v1/generations', '提交生成任务', genResult) +
'<div class="mt-2 text-xs font-mono text-[#4E5969] bg-white border border-[#E5E6EB] rounded p-2 break-all">' + mentorDeployReviewEsc(getMentorDeployGenSubmitUrl()) + '</div>' + '<div class="mt-2 text-xs font-mono text-[#4E5969] bg-white border border-[#E5E6EB] rounded p-2 break-all">' + mentorDeployReviewEsc(getMentorDeployGenSubmitUrl()) + '</div>' +
'<div class="mt-2"><label class="text-xs font-medium text-[#4E5969] block mb-1">生成描述</label><textarea class="input-field text-sm min-h-[64px] resize-none" oninput="setMentorDeployReviewParam(\'imagePrompt\', this.value)">' + mentorDeployReviewEsc(p.imagePrompt) + '</textarea></div>' + '<div class="mt-2 flex items-center justify-between gap-2">' +
'<label class="text-xs font-medium text-[#4E5969] block">生成描述</label>' +
'<button class="text-xs px-2 py-1 rounded bg-[#F2F3F5] text-[#4E5969] hover:bg-[#E8F3FF] hover:text-[#165DFF]" type="button" onclick="resetMentorDeployImageGenParams()">恢复任务默认值</button>' +
'</div>' +
'<textarea class="input-field text-sm min-h-[64px] resize-none mt-1" oninput="setMentorDeployReviewParam(\'imagePrompt\', this.value)">' + mentorDeployReviewEsc(p.imagePrompt) + '</textarea>' +
'<div class="grid grid-cols-2 gap-2 mt-2">' + '<div class="grid grid-cols-2 gap-2 mt-2">' +
'<div><label class="text-xs font-medium text-[#4E5969] block mb-1">图片尺寸</label><select class="input-field text-sm" onchange="setMentorDeployReviewParam(\'size\', this.value)">' + getMentorDeploySizeOptions(p.size) + '</select></div>' + '<div><label class="text-xs font-medium text-[#4E5969] block mb-1">图片尺寸</label><select class="input-field text-sm" onchange="setMentorDeployReviewParam(\'size\', this.value)">' + getMentorDeploySizeOptions(p.size) + '</select></div>' +
'<div><label class="text-xs font-medium text-[#4E5969] block mb-1">随机种子</label><input class="input-field text-sm" placeholder="可选" value="' + mentorDeployReviewEsc(p.seed) + '" oninput="setMentorDeployReviewParam(\'seed\', this.value)"></div>' + '<div><label class="text-xs font-medium text-[#4E5969] block mb-1">随机种子</label><input class="input-field text-sm" placeholder="可选" value="' + mentorDeployReviewEsc(p.seed) + '" oninput="setMentorDeployReviewParam(\'seed\', this.value)"></div>' +
'</div>' + '</div>' +
'<div class="mt-2 text-xs text-[#86909C]">默认值:描述「' + mentorDeployReviewEsc(taskDef.defaultImagePrompt || '') + '」,尺寸 ' + mentorDeployReviewEsc(taskDef.defaultSize || '') + '</div>' +
buildMentorDeployTestMeta(genResult) + buildMentorDeployTestMeta(genResult) +
(genResult && genResult.taskId ? '<div class="mt-1.5 text-xs text-[#4E5969]">任务 ID:<b class="font-mono">' + mentorDeployReviewEsc(genResult.taskId) + '</b></div>' : '') + (genResult && genResult.taskId ? '<div class="mt-1.5 text-xs text-[#4E5969]">任务 ID:<b class="font-mono">' + mentorDeployReviewEsc(genResult.taskId) + '</b></div>' : '') +
buildMentorDeployTestError(genResult) + buildMentorDeployTestError(genResult) +
'<button class="btn-primary w-full mt-3 py-2 text-sm" onclick="runMentorDeployGenSubmitTest()" ' + (genLoading ? ' disabled' : '') + '>' + (genLoading ? '提交中…' : '提交生成任务') + '</button>' + '<button class="btn-primary w-full mt-3 py-2 text-sm" onclick="runMentorDeployGenSubmitTest()" ' + (genLoading ? ' disabled' : '') + '>' + (genLoading ? '提交中…' : '提交生成任务') + '</button>' +
'</div>' + '</div>' +
'<div class="p-3 rounded-lg bg-[#F7F8FA]">' + '<div class="p-3 rounded-lg bg-[#F7F8FA]">' +
buildMentorDeployTestItemHeader('GET', '/v1/generations/{id}', '查询生成任务', statusResult) + buildMentorDeployTestItemHeader('GET', taskDef.statusPath || '/v1/generations/{id}', '查询生成任务', statusResult) +
'<div class="mt-2 text-xs font-mono text-[#4E5969] bg-white border border-[#E5E6EB] rounded p-2 break-all">' + mentorDeployReviewEsc(getMentorDeployGenStatusUrl()) + '</div>' + '<div class="mt-2 text-xs font-mono text-[#4E5969] bg-white border border-[#E5E6EB] rounded p-2 break-all">' + mentorDeployReviewEsc(getMentorDeployGenStatusUrl()) + '</div>' +
buildMentorDeployTestMeta(statusResult) + buildMentorDeployTestMeta(statusResult) +
(statusResult && statusResult.taskStatus (statusResult && statusResult.taskStatus
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论