7 Commits
Author SHA1 Message Date
hz4th_coder 7b3f572601 机器人分类补19个字段(关节轴承/电机类型/最大速度/站立行走负载/斜坡台阶越障/算力/散热/续航里程/材质/售价等)+新增四足机器人子分类 (v2.5.0) 2026-09-14 12:39:56 +08:00
hz4th_coder b473ae7205 新增机器人分类: 4子分类(机械臂/AGV-AMR/人形/ROV)+91公共字段按8大类字段类别分组 (v2.4.0) 2026-09-14 12:27:58 +08:00
hz4th_coder dee20ca122 CPU公共参数字段升级为46字段+字段类别分组(物理参数/产品信息/核心配置/性能/缓存/架构/指令集) (v2.3.0) 2026-09-14 11:41:41 +08:00
hz4th_coder ea8165bbd8 修复启动脚本: 改用 openclaw conda 环境 python3 (系统 python3.10 无 flask 导致启动失败) (v2.2.2) 2026-09-12 12:33:51 +08:00
hz4th_coder 2d5abe5975 修复分类编辑弹窗内按钮触发表单提交导致跳转首页的问题 (v2.2.1)
- 根因: 编辑分类弹窗里的子类别/参数字段列表按钮渲染在 <form id=itemForm> 内且无 type=button,HTML 按钮默认 type=submit,点击时同时触发表单 GET 提交 → 页面刷新跳转到 /admin 首页
- 修复: 给 renderSubcategoriesList/renderFieldsList 的编辑/删除按钮、getImageUploadComponent 的图片操作按钮补 type=button
- 加固: 全局拦截 itemForm 原生 submit (preventDefault),保存统一走 saveItem,杜绝同类按钮再次引发页面跳转
2026-09-10 01:46:59 +08:00
hz4th_coder 9005a48bf3 GPU显卡公共参数字段全面升级为66字段+字段类别支持
- 按显卡规格9大类别整理66个公共参数字段(全部文本类型):
  图形处理器芯片基础信息(14)/显卡产品信息(12)/渲染硬件配置(8)/理论算力(5)/显存规格(5)/矩阵算力(8)/数值格式支持(2)/图形API与特性(6)/板卡设计(6)
- 每个字段新增 category 字段类别属性(对应#开头的参数类别中文名)
- 保留平台必备结构字段: name/manufacturer/official_urls/reference_urls/description
- 后台字段编辑弹框新增「字段类别」输入,字段列表显示📁类别徽标
- 子类别关键特性映射到新字段(显存容量/着色单元/首发价/FP32等)
- 修复重复FP16: 理论算力=fp16, 矩阵算力=fp16_matrix
2026-09-10 01:32:21 +08:00
hz4th_coder 850b356f89 优化审核管理:添加详情弹窗替代alert显示,改进表格显示关键参数预览 2026-07-14 23:59:22 +08:00
3 changed files with 2512 additions and 247 deletions
+2249 -224
View File
File diff suppressed because it is too large Load Diff
Executable
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
# param-hub 启动脚本(setsid 完全脱离终端,确保持久运行)
APP_DIR="$(cd "$(dirname "$0")" && pwd)"
PID_FILE="$APP_DIR/app.pid"
PYTHON="/home/hz1/miniconda3/envs/openclaw/bin/python3"
cd "$APP_DIR"
if [ -f "$PID_FILE" ]; then
PID=$(cat "$PID_FILE")
if ps -p $PID > /dev/null 2>&1; then
echo "param-hub 已在运行 (PID: $PID)"
exit 0
fi
fi
setsid nohup "$PYTHON" app.py > logs/app.log 2>&1 &
echo $! > "$PID_FILE"
sleep 2
echo "param-hub 已启动 (PID: $(cat $PID_FILE))"
+246 -23
View File
@@ -324,12 +324,13 @@
<th class="px-4 py-3 text-left text-sm font-medium text-gray-600">产品名称</th>
<th class="px-4 py-3 text-left text-sm font-medium text-gray-600">分类</th>
<th class="px-4 py-3 text-left text-sm font-medium text-gray-600">来源</th>
<th class="px-4 py-3 text-left text-sm font-medium text-gray-600">提交者</th>
<th class="px-4 py-3 text-left text-sm font-medium text-gray-600">提交时间</th>
<th class="px-4 py-3 text-left text-sm font-medium text-gray-600">状态</th>
<th class="px-4 py-3 text-center text-sm font-medium text-gray-600">操作</th>
</tr>
</thead>
<tbody id="reviewsTable"><tr><td colspan="6" class="text-center text-gray-400 py-8">加载中...</td></tr></tbody>
<tbody id="reviewsTable"><tr><td colspan="7" class="text-center text-gray-400 py-8">加载中...</td></tr></tbody>
</table>
</div>
</section>
@@ -479,6 +480,22 @@
</div>
</div>
<!-- 审核详情弹窗 -->
<div id="reviewDetailModal" class="fixed inset-0 bg-black/50 z-50 hidden flex items-center justify-center">
<div class="bg-white rounded-xl max-w-4xl w-full mx-4 max-h-[90vh] overflow-auto">
<div class="p-6 border-b flex justify-between items-center sticky top-0 bg-white z-10">
<h2 class="text-xl font-bold text-gray-800"><i class="ri-file-search-line mr-2 text-blue-600"></i>审核详情</h2>
<button onclick="closeReviewDetailModal()" class="text-gray-400 hover:text-gray-600"><i class="ri-close-line text-2xl"></i></button>
</div>
<div id="reviewDetailContent" class="p-6">
<!-- 动态内容 -->
</div>
<div id="reviewDetailActions" class="p-6 border-t flex justify-end gap-4 sticky bottom-0 bg-white">
<!-- 操作按钮 -->
</div>
</div>
</div>
<!-- 参数字段编辑弹框 -->
<div id="fieldModal" class="fixed inset-0 bg-black/50 z-50 hidden flex items-center justify-center">
<div class="bg-white rounded-xl max-w-lg w-full mx-4">
@@ -490,6 +507,7 @@
<div class="space-y-4">
<div><label class="text-sm text-gray-600 mb-1 block">字段名 *</label><input type="text" id="field_key" class="w-full px-3 py-2 border rounded-lg" placeholder="如:context_length"></div>
<div><label class="text-sm text-gray-600 mb-1 block">显示名 *</label><input type="text" id="field_label" class="w-full px-3 py-2 border rounded-lg" placeholder="如:上下文长度"></div>
<div><label class="text-sm text-gray-600 mb-1 block">字段类别</label><input type="text" id="field_category" class="w-full px-3 py-2 border rounded-lg" placeholder="如:图形处理器芯片基础信息(参数分组,可为空)"></div>
<div><label class="text-sm text-gray-600 mb-1 block">字段类型</label><select id="field_type" class="w-full px-3 py-2 border rounded-lg">
<option value="text">文本</option>
<option value="number">数字</option>
@@ -1568,7 +1586,7 @@
${imageUrls.map((url, idx) => `
<div class="relative w-24 h-24 border rounded-lg overflow-hidden group">
<img src="${url}" class="w-full h-full object-cover">
<button onclick="removeImage(${idx})" class="absolute top-1 right-1 w-6 h-6 bg-red-500 text-white rounded-full opacity-0 group-hover:opacity-100 transition flex items-center justify-center">
<button type="button" onclick="removeImage(${idx})" class="absolute top-1 right-1 w-6 h-6 bg-red-500 text-white rounded-full opacity-0 group-hover:opacity-100 transition flex items-center justify-center">
<i class="ri-close-line"></i>
</button>
</div>
@@ -1576,10 +1594,10 @@
</div>
<div class="flex gap-2">
<input type="file" id="imageInput" accept="image/*" multiple class="hidden" onchange="handleImageUpload(event, '${type}')">
<button onclick="document.getElementById('imageInput').click()" class="px-4 py-2 bg-gray-100 text-gray-600 rounded-lg hover:bg-gray-200 text-sm">
<button type="button" onclick="document.getElementById('imageInput').click()" class="px-4 py-2 bg-gray-100 text-gray-600 rounded-lg hover:bg-gray-200 text-sm">
<i class="ri-image-add-line mr-1"></i>选择图片
</button>
<button onclick="pasteImageFromClipboard('${type}')'" class="px-4 py-2 bg-gray-100 text-gray-600 rounded-lg hover:bg-gray-200 text-sm">
<button type="button" onclick="pasteImageFromClipboard('${type}')'" class="px-4 py-2 bg-gray-100 text-gray-600 rounded-lg hover:bg-gray-200 text-sm">
<i class="ri-clipboard-line mr-1"></i>粘贴图片
</button>
</div>
@@ -1825,10 +1843,10 @@
</div>
</div>
<div class="flex gap-2 opacity-0 group-hover:opacity-100 transition">
<button onclick="editSubcategory(${index})" class="px-2 py-1 text-blue-600 hover:bg-blue-50 rounded text-sm">
<button type="button" onclick="editSubcategory(${index})" class="px-2 py-1 text-blue-600 hover:bg-blue-50 rounded text-sm">
<i class="ri-edit-line"></i>
</button>
<button onclick="deleteSubcategory(${index})" class="px-2 py-1 text-red-600 hover:bg-red-50 rounded text-sm">
<button type="button" onclick="deleteSubcategory(${index})" class="px-2 py-1 text-red-600 hover:bg-red-50 rounded text-sm">
<i class="ri-delete-bin-line"></i>
</button>
</div>
@@ -1862,13 +1880,14 @@
${field.required ? '<span class="text-red-500">必填</span>' : '可选'}
${field.description ? ` | ${field.description}` : ''}
</div>
${field.category ? `<div class="mt-1"><span class="inline-block px-2 py-0.5 bg-indigo-50 text-indigo-600 border border-indigo-100 rounded text-xs">📁 ${field.category}</span></div>` : ''}
</div>
</div>
<div class="flex gap-2 opacity-0 group-hover:opacity-100 transition">
<button onclick="editField(${index})" class="px-2 py-1 text-blue-600 hover:bg-blue-50 rounded text-sm">
<button type="button" onclick="editField(${index})" class="px-2 py-1 text-blue-600 hover:bg-blue-50 rounded text-sm">
<i class="ri-edit-line"></i>
</button>
<button onclick="deleteField(${index})" class="px-2 py-1 text-red-600 hover:bg-red-50 rounded text-sm">
<button type="button" onclick="deleteField(${index})" class="px-2 py-1 text-red-600 hover:bg-red-50 rounded text-sm">
<i class="ri-delete-bin-line"></i>
</button>
</div>
@@ -1883,6 +1902,7 @@
document.getElementById('fieldModalTitle').textContent = '添加参数字段';
document.getElementById('field_key').value = '';
document.getElementById('field_label').value = '';
document.getElementById('field_category').value = '';
document.getElementById('field_type').value = 'text';
document.getElementById('field_desc').value = '';
document.getElementById('field_required').checked = false;
@@ -1898,6 +1918,7 @@
document.getElementById('fieldModalTitle').textContent = '编辑参数字段';
document.getElementById('field_key').value = field.key || '';
document.getElementById('field_label').value = field.label || '';
document.getElementById('field_category').value = field.category || '';
document.getElementById('field_type').value = field.type || 'text';
document.getElementById('field_desc').value = field.description || '';
document.getElementById('field_required').checked = field.required || false;
@@ -1921,6 +1942,7 @@
function saveField() {
const key = document.getElementById('field_key').value.trim();
const label = document.getElementById('field_label').value.trim();
const category = document.getElementById('field_category').value.trim();
const type = document.getElementById('field_type').value;
const description = document.getElementById('field_desc').value.trim();
const required = document.getElementById('field_required').checked;
@@ -1931,6 +1953,7 @@
}
const field = { key, label, type, description, required };
if (category) field.category = category;
if (currentFieldTarget === 'subcategory') {
// 子类别额外字段
@@ -2216,6 +2239,13 @@
document.getElementById('smartUpdateModal').addEventListener('click', function(e) { if (e.target === this) closeSmartUpdateModal(); });
document.getElementById('fieldModal').addEventListener('click', function(e) { if (e.target === this) closeFieldModal(); });
// 防止 itemForm 原生提交(保存统一走 saveItem,避免表单 GET 提交导致页面跳转/刷新)
document.addEventListener('submit', function(e) {
if (e.target && e.target.id === 'itemForm') {
e.preventDefault();
}
});
// ============ 智能添加功能 ============
let smartAddType = '';
@@ -3194,7 +3224,7 @@
if (reviews.length === 0) {
document.getElementById('reviewsTable').innerHTML = `
<tr><td colspan="6" class="text-center text-gray-400 py-8">暂无数据</td></tr>
<tr><td colspan="7" class="text-center text-gray-400 py-8">暂无数据</td></tr>
`;
return;
}
@@ -3207,20 +3237,34 @@
const html = reviews.map(r => {
const catName = categories.find(c => c.id === r.category_id)?.name || r.category_id;
// 提取关键参数预览
const data = r.data || {};
const previewFields = [];
['organization', 'model_type', 'parameters', 'context_length', 'release_year'].forEach(key => {
if (data[key]) previewFields.push(`<span class="text-gray-500">${data[key]}</span>`);
});
const preview = previewFields.length > 0 ? previewFields.slice(0, 3).join(' · ') : '-';
return `
<tr class="border-b hover:bg-gray-50">
<td class="px-4 py-3 font-medium text-gray-800">${r.data?.name || '-'}</td>
<tr class="border-b hover:bg-gray-50 ${r.status === 'pending' ? 'bg-orange-50/30' : ''}">
<td class="px-4 py-3">
<div class="font-medium text-gray-800">${r.data?.name || '-'}</div>
<div class="text-xs text-gray-400 mt-1">${preview}</div>
</td>
<td class="px-4 py-3 text-gray-600">${catName}</td>
<td class="px-4 py-3 text-sm">
${r.source === 'api' ? '<span class="text-indigo-600">API</span>' : '<span class="text-gray-500">网页</span>'}
</td>
<td class="px-4 py-3 text-sm">
${r.submitter ? `<span class="text-gray-600">${r.submitter}</span>` : '<span class="text-gray-400">匿名</span>'}
</td>
<td class="px-4 py-3 text-sm text-gray-500">${r.created_at}</td>
<td class="px-4 py-3">${statusLabels[r.status] || r.status}</td>
<td class="px-4 py-3 text-center">
${r.status === 'pending' ? `
<button onclick="approveReview('${r.id}')" class="text-green-600 hover:text-green-800 mr-2" title="通过"><i class="ri-check-line"></i></button>
<button onclick="viewReviewDetail('${r.id}')" class="text-blue-600 hover:text-blue-800 mr-2" title="查看详情"><i class="ri-eye-line"></i></button>
<button onclick="approveReview('${r.id}')" class="text-green-600 hover:text-green-800 mr-1" title="通过"><i class="ri-check-line"></i></button>
<button onclick="rejectReview('${r.id}')" class="text-red-600 hover:text-red-800" title="拒绝"><i class="ri-close-line"></i></button>
<button onclick="viewReviewDetail('${r.id}')" class="text-blue-600 hover:text-blue-800 ml-2" title="查看详情"><i class="ri-eye-line"></i></button>
` : `
<button onclick="viewReviewDetail('${r.id}')" class="text-blue-600 hover:text-blue-800" title="查看详情"><i class="ri-eye-line"></i></button>
`}
@@ -3232,7 +3276,7 @@
document.getElementById('reviewsTable').innerHTML = html;
} catch (e) {
document.getElementById('reviewsTable').innerHTML = `
<tr><td colspan="6" class="text-center text-red-500 py-8">加载失败: ${e.message}</td></tr>
<tr><td colspan="7" class="text-center text-red-500 py-8">加载失败: ${e.message}</td></tr>
`;
}
}
@@ -3279,26 +3323,205 @@
}
}
// 当前审核详情ID
let currentReviewId = '';
// 查看审核详情
async function viewReviewDetail(reviewId) {
currentReviewId = reviewId;
try {
const res = await fetch(`/api/reviews/${reviewId}`);
const review = await res.json();
let html = '<div class="space-y-4">';
html += `<div><span class="text-gray-500">状态:</span> ${review.status}</div>`;
html += `<div><span class="text-gray-500">分类:</span> ${review.category_id}</div>`;
html += `<div><span class="text-gray-500">来源:</span> ${review.source}</div>`;
html += `<div><span class="text-gray-500">提交时间:</span> ${review.created_at}</div>`;
html += '<div class="border-t pt-4"><h3 class="font-medium mb-2">产品数据:</h3>';
html += '<pre class="bg-gray-50 p-3 rounded text-sm overflow-auto max-h-60">' + JSON.stringify(review.data, null, 2) + '</pre>';
html += '</div></div>';
const catName = categories.find(c => c.id === review.category_id)?.name || review.category_id;
const statusLabels = {
pending: '<span class="px-3 py-1 bg-orange-100 text-orange-700 rounded-full text-sm">待审核</span>',
approved: '<span class="px-3 py-1 bg-green-100 text-green-700 rounded-full text-sm">已通过</span>',
rejected: '<span class="px-3 py-1 bg-red-100 text-red-700 rounded-full text-sm">已拒绝</span>'
};
alert(html.replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim());
let html = `
<div class="space-y-6">
<!-- 基本信息 -->
<div class="bg-gray-50 rounded-lg p-4">
<h3 class="text-sm font-semibold text-gray-500 mb-3"><i class="ri-information-line mr-1"></i>基本信息</h3>
<div class="grid grid-cols-2 gap-4">
<div><span class="text-gray-400 text-sm">状态:</span>${statusLabels[review.status] || review.status}</div>
<div><span class="text-gray-400 text-sm">分类:</span><span class="font-medium text-gray-800">${catName}</span></div>
<div><span class="text-gray-400 text-sm">来源:</span><span class="text-gray-800">${review.source === 'api' ? 'API提交' : '网页提交'}</span></div>
<div><span class="text-gray-400 text-sm">提交者:</span><span class="text-gray-800">${review.submitter || '匿名'}</span></div>
<div class="col-span-2"><span class="text-gray-400 text-sm">提交时间:</span><span class="text-gray-800">${review.created_at}</span></div>
</div>
${review.status === 'rejected' && review.reject_reason ? `
<div class="mt-3 pt-3 border-t border-gray-200">
<span class="text-gray-400 text-sm">拒绝原因:</span>
<span class="text-red-600">${review.reject_reason}</span>
</div>
` : ''}
${review.status === 'approved' ? `
<div class="mt-3 pt-3 border-t border-gray-200">
<span class="text-gray-400 text-sm">审核通过时间:</span>
<span class="text-green-600">${review.approved_at || '-'}</span>
</div>
` : ''}
</div>
<!-- 产品数据 -->
<div class="border rounded-lg p-4">
<h3 class="text-sm font-semibold text-gray-500 mb-3"><i class="ri-database-2-line mr-1"></i>产品数据</h3>
<div class="space-y-3">
${renderProductData(review.data, review.category_id)}
</div>
</div>
</div>
`;
document.getElementById('reviewDetailContent').innerHTML = html;
// 操作按钮
let actionsHtml = '';
if (review.status === 'pending') {
actionsHtml = `
<button onclick="closeReviewDetailModal()" class="px-4 py-2 bg-gray-200 text-gray-600 rounded-lg hover:bg-gray-300">关闭</button>
<button onclick="rejectReviewFromModal()" class="px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700"><i class="ri-close-line mr-1"></i>拒绝</button>
<button onclick="approveReviewFromModal()" class="px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700"><i class="ri-check-line mr-1"></i>通过</button>
`;
} else {
actionsHtml = `<button onclick="closeReviewDetailModal()" class="px-4 py-2 bg-gray-200 text-gray-600 rounded-lg hover:bg-gray-300">关闭</button>`;
}
document.getElementById('reviewDetailActions').innerHTML = actionsHtml;
document.getElementById('reviewDetailModal').classList.remove('hidden');
} catch (e) {
alert('加载失败: ' + e.message);
}
}
// 渲染产品数据(格式化显示)
function renderProductData(data, categoryId) {
if (!data) return '<div class="text-gray-400">无数据</div>';
// 获取分类的字段配置
const cat = categories.find(c => c.id === categoryId);
const fields = cat ? (cat.fields || []) : [];
// 排序字段:名称放第一
const sortedFields = [...fields].sort((a, b) => {
if (a.key === 'name') return -1;
if (b.key === 'name') return 1;
return 0;
});
let html = '';
// 先显示有字段配置的值
sortedFields.forEach(field => {
const value = data[field.key];
if (value !== undefined && value !== null && value !== '') {
html += renderFieldRow(field, value);
}
});
// 再显示其他没有字段配置的值
Object.keys(data).forEach(key => {
if (!fields.find(f => f.key === key)) {
const value = data[key];
if (value !== undefined && value !== null && value !== '') {
html += `<div class="flex py-2 border-b border-gray-100 last:border-0">
<div class="w-1/3 text-gray-500 text-sm">${key}</div>
<div class="w-2/3 text-gray-800">${formatValue(value)}</div>
</div>`;
}
}
});
return html || '<div class="text-gray-400">无数据</div>';
}
// 渲染单个字段行
function renderFieldRow(field, value) {
const label = field.label || field.key;
const type = field.type || 'text';
let displayValue = formatValue(value, type);
return `<div class="flex py-2 border-b border-gray-100 last:border-0">
<div class="w-1/3 text-gray-500 text-sm">${label}</div>
<div class="w-2/3 text-gray-800">${displayValue}</div>
</div>`;
}
// 格式化值
function formatValue(value, type = 'text') {
if (value === null || value === undefined) return '-';
if (typeof value === 'boolean') return value ? '<span class="text-green-600">是</span>' : '<span class="text-gray-400">否</span>';
if (typeof value === 'object') {
if (Array.isArray(value)) {
if (value.length === 0) return '-';
// 如果是图片数组
if (typeof value[0] === 'string' && (value[0].startsWith('http') || value[0].startsWith('/'))) {
return value.map(url => `<img src="${url}" class="inline-block w-16 h-16 object-cover rounded mr-2 cursor-pointer hover:opacity-80" onclick="window.open('${url}', '_blank')">`).join('');
}
return value.join(', ');
}
return `<pre class="bg-gray-50 p-2 rounded text-xs overflow-auto">${JSON.stringify(value, null, 2)}</pre>`;
}
if (type === 'url' || (typeof value === 'string' && value.startsWith('http'))) {
return `<a href="${value}" target="_blank" class="text-blue-600 hover:underline">${value}</a>`;
}
return String(value);
}
// 关闭审核详情弹窗
function closeReviewDetailModal() {
document.getElementById('reviewDetailModal').classList.add('hidden');
currentReviewId = '';
}
// 从弹窗中通过审核
async function approveReviewFromModal() {
if (!currentReviewId) return;
if (!confirm('确认通过该产品审核?')) return;
try {
const res = await fetch(`/api/reviews/${currentReviewId}/approve`, {method: 'POST'});
const data = await res.json();
if (data.error) {
alert('操作失败: ' + data.error);
} else {
alert('审核通过,产品已发布!');
closeReviewDetailModal();
loadReviews();
loadNotificationCounts();
loadOverview();
}
} catch (e) {
alert('操作失败: ' + e.message);
}
}
// 从弹窗中拒绝审核
async function rejectReviewFromModal() {
if (!currentReviewId) return;
const reason = prompt('请输入拒绝原因(可选):');
if (reason === null) return; // 用户取消
try {
const res = await fetch(`/api/reviews/${currentReviewId}/reject`, {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({reason})
});
const data = await res.json();
if (data.error) {
alert('操作失败: ' + data.error);
} else {
alert('已拒绝该产品!');
closeReviewDetailModal();
loadReviews();
loadNotificationCounts();
}
} catch (e) {
alert('操作失败: ' + e.message);
}
}
init();
</script>