1. 修改了评测页面的关联模型和数据集的bug
This commit is contained in:
@@ -363,6 +363,7 @@
|
||||
const textMap = {
|
||||
'train': '训练数据',
|
||||
'test': '测试数据',
|
||||
'eval': '评测数据',
|
||||
'val': '验证数据',
|
||||
'other': '其他'
|
||||
};
|
||||
|
||||
@@ -227,18 +227,18 @@
|
||||
</label>
|
||||
<div class="flex items-center space-x-6">
|
||||
<label class="flex items-center cursor-pointer">
|
||||
<input type="radio" name="data_source" value="dataset" class="mr-2" onchange="toggleDataSource('dataset')">
|
||||
<input type="radio" name="data_source" value="dataset" checked class="mr-2" onchange="toggleDataSource('dataset')">
|
||||
<span class="text-sm text-gray-700">评测数据集</span>
|
||||
</label>
|
||||
<label class="flex items-center cursor-pointer">
|
||||
<input type="radio" name="data_source" value="inference" checked class="mr-2" onchange="toggleDataSource('inference')">
|
||||
<input type="radio" name="data_source" value="inference" class="mr-2" onchange="toggleDataSource('inference')">
|
||||
<span class="text-sm text-gray-700">推理结果集</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 推理结果集上传 -->
|
||||
<div id="inferenceUpload" class="border-2 border-dashed border-gray-200 rounded-lg p-8 text-center hover:border-primary/50 transition-colors cursor-pointer">
|
||||
<div id="inferenceUpload" class="hidden border-2 border-dashed border-gray-200 rounded-lg p-8 text-center hover:border-primary/50 transition-colors cursor-pointer">
|
||||
<i class="fa fa-cloud-upload text-gray-400 text-xl mb-2"></i>
|
||||
<p class="text-gray-700 text-sm">点击或拖拽上传推理结果集</p>
|
||||
<p class="text-xs text-gray-400 mt-1">支持 .xls .xlsx 格式,不超过2MB</p>
|
||||
@@ -248,13 +248,13 @@
|
||||
</div>
|
||||
|
||||
<!-- 评测数据集选择 -->
|
||||
<div id="datasetSelect" class="hidden mb-6">
|
||||
<div id="datasetSelect" class="mb-6">
|
||||
<h3 class="text-sm font-semibold text-gray-700 mb-4 pb-2 border-b border-gray-100">评测数据集</h3>
|
||||
<div class="flex items-center">
|
||||
<select name="dataset_id" class="form-select flex-1 max-w-md">
|
||||
<select name="dataset_id" id="testDatasetSelect" class="form-select flex-1 max-w-md">
|
||||
<option value="">请选择评测数据集</option>
|
||||
</select>
|
||||
<button type="button" class="ml-2 text-primary text-sm flex items-center hover:text-primary/80">
|
||||
<button type="button" class="ml-2 text-primary text-sm flex items-center hover:text-primary/80" onclick="loadTestDatasets()">
|
||||
<i class="fa fa-refresh"></i>
|
||||
</button>
|
||||
<button type="button" class="ml-3 bg-white border border-primary text-primary rounded px-3 py-1.5 text-sm hover:bg-primary/5" onclick="window.location.href='dataset-create.html'">
|
||||
@@ -337,9 +337,15 @@
|
||||
// 初始化评测方式样式
|
||||
updateEvalTypeStyle('custom');
|
||||
|
||||
// 初始化数据来源显示
|
||||
toggleDataSource('dataset');
|
||||
|
||||
// 加载模型列表
|
||||
loadModels();
|
||||
|
||||
// 加载评测数据集
|
||||
loadTestDatasets();
|
||||
|
||||
// 设置侧边栏当前页高亮
|
||||
const currentPage = 'model-eval';
|
||||
document.querySelectorAll('.nav-link').forEach(link => {
|
||||
@@ -419,7 +425,7 @@
|
||||
// 加载模型列表
|
||||
async function loadModels() {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE}/my-models`);
|
||||
const response = await fetch(`${API_BASE}/model-manage`);
|
||||
const result = await response.json();
|
||||
if (result.code === 0) {
|
||||
const select = document.getElementById('modelSelect');
|
||||
@@ -431,6 +437,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 加载评测数据集(type="eval")
|
||||
async function loadTestDatasets() {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE}/dataset-manage`);
|
||||
const result = await response.json();
|
||||
if (result.code === 0) {
|
||||
// 筛选类型为 eval 的数据集
|
||||
const evalDatasets = (result.data || []).filter(d => d.type === 'eval');
|
||||
const select = document.getElementById('testDatasetSelect');
|
||||
select.innerHTML = '<option value="">请选择评测数据集</option>' +
|
||||
evalDatasets.map(d => `<option value="${d.id}">${d.name}</option>`).join('');
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('加载评测数据集失败:', e);
|
||||
}
|
||||
}
|
||||
|
||||
// 提交表单
|
||||
async function submitForm() {
|
||||
const form = document.getElementById('evalForm');
|
||||
|
||||
Reference in New Issue
Block a user