7 Commits

Author SHA1 Message Date
2c981cb363 feat: 手机类别字段全面重构
- 删除原有简单字段(processor/ram_gb/storage_gb/screen_size/battery_mah)
- 新增52个详细字段,覆盖手机完整参数:
  - 基本信息:型号、品牌、发布日期、上市时间、产品级别、价格
  - 系统与处理器:操作系统、处理器(SoC)、GPU
  - 存储与内存:运行内存、存储空间、存储扩展
  - 屏幕:尺寸、类型、分辨率、刷新率、LTPO、亮度、屏幕特色
  - 摄像头:后置主摄、超广角、长焦、前置、视频录制、摄像头特色
  - 电池与充电:电池容量、有线快充、无线充电、电池特色
  - 连接与网络:运营商网络、Wi-Fi、蓝牙、NFC、红外遥控、定位、USB、SIM卡
  - 机身与外观:指纹识别、防水等级、面部识别、重量、厚度、材质、颜色、中框
  - 其他功能:扬声器、耳机接口、震动反馈
  - 特色与链接:特色、官网地址、数据参考、描述
- 字段名不带单位,数据提取时保留原始单位
- 更新子类别关键特性配置
- 智能添加prompt自动包含新字段配置
2026-04-30 13:00:48 +08:00
ae23ec42ad fix: 动态分类子类别筛选修复
- 移除showDynamicCategory中的dynamicSubcategoryFilter重置
- 改为在侧边栏点击时重置筛选值
- 点击子类别按钮时保持筛选值不被重置
- 手机、电脑、汽车、摄像等动态分类现在可以正确筛选
2026-04-29 23:03:33 +08:00
080e00b6c6 fix: 修复子类别筛选按钮点击无效问题
- 用containerId判断currentFilter,而非categoryId
- 用previousElementSibling找全部按钮,而非parent.querySelector
- 确保点击子类别后样式正确切换
- 全部按钮和子类别按钮互斥选中状态
2026-04-29 22:58:44 +08:00
6e69f09842 fix: 移除重复的"全部"按钮,只更新样式
- HTML中已有"全部"按钮,不需要重复添加
- renderSubcategoryFilters只渲染子类别按钮
- 同时更新"全部"按钮的选中/未选中样式
- 选中时蓝色背景白色文字,未选中时白色背景灰色文字
2026-04-29 22:51:16 +08:00
2dd45854c1 fix: 后台管理子类别筛选按钮显示选中状态
- 添加"全部"按钮,点击可清除筛选
- 选中状态:蓝色背景白色文字
- 未选中状态:白色背景灰色文字+边框
- 用户点击后能看到明显的视觉变化
- 根据当前筛选值动态更新按钮样式
2026-04-29 22:38:50 +08:00
72de68e1ff feat: 智能解析prompt改为保留原始单位
- 修改要求:从'不带单位'改为'保留原始单位'
- 字段标签中有单位标注时,提取数据带上对应单位
- 避免'提取数字不带单位'导致数据和单位不符
- 修改范围:
  - get_parse_prompt_template 函数
  - parse_with_llm 函数(图片解析和文本解析)
- 示例:显存(GB)字段提取'24GB'而不是'24'
2026-04-29 17:45:07 +08:00
6844d73c9d feat: 所有类别添加官网地址和数据参考字段
- 官网地址(official_urls): JSON数组,存储产品官网链接
- 数据参考(reference_urls): JSON数组,存储参数来源链接
- 格式示例: [{"url":"https://...","title":"..."}]
- 支持多个链接+标题
- 类型: JSON,长文本输入
- 覆盖: AI模型、GPU、CPU、手机、电脑、汽车、摄像全部7个类别
2026-04-29 17:30:32 +08:00
3 changed files with 521 additions and 65 deletions

6
app.py
View File

@@ -163,7 +163,7 @@ def get_parse_prompt_template(category_type, category_id=None, subcategory_id=No
重要要求:
1. 图片中可能包含1个或多个产品请识别所有产品
2. 如果是多张图片,请综合分析所有图片内容
3. 数字字段只返回数字,不带单位
3. **提取数据时保留原始单位**:字段标签中如有单位标注(如($)、(GB)、(MHz)等),提取时请带上对应单位,保持数据完整性
4. 如果某字段没有提及返回null
5. 返回格式:如果识别到多个产品,返回数组 [对象列表]; 如果只有一个产品,返回单个对象
6. 只返回JSON数据不要其他内容"""
@@ -255,7 +255,7 @@ def parse_with_llm(text, category_type, images=None, category_id=None, subcatego
重要要求:
1. 图片中可能包含1个或多个产品请识别所有产品
2. 如果是多张图片,请综合分析所有图片内容
3. 数字字段只返回数字,不带单位
3. **提取数据时保留原始单位**:字段标签中如有单位标注(如($)、(GB)、(MHz)等),提取时请带上对应单位,保持数据完整性
4. 如果某字段没有提及返回null
5. 返回格式:如果识别到多个产品,返回数组 [对象列表]; 如果只有一个产品,返回单个对象
6. 只返回JSON数据不要其他内容"""
@@ -307,7 +307,7 @@ def parse_with_llm(text, category_type, images=None, category_id=None, subcatego
要求:
1. 根据文本内容智能提取各个字段的值
2. 数字字段只返回数字,不带单位
2. **提取数据时保留原始单位**:字段标签中如有单位标注(如($)、(GB)、(MHz)等),提取时请带上对应单位,保持数据完整性
3. 如果某字段在文本中没有提及返回null
4. 返回JSON格式不要包含任何其他内容

View File

@@ -213,6 +213,22 @@
"required": false,
"input_style": "normal"
},
{
"key": "official_urls",
"label": "官网地址",
"type": "json",
"description": "产品官网链接JSON数组格式[{\"url\":\"https://...\",\"title\":\"...\"}]",
"required": false,
"input_style": "long"
},
{
"key": "reference_urls",
"label": "数据参考",
"type": "json",
"description": "参数来源链接JSON数组格式[{\"url\":\"https://...\",\"title\":\"...\"}]",
"required": false,
"input_style": "long"
},
{
"key": "description",
"label": "描述",
@@ -448,6 +464,22 @@
"required": false,
"input_style": "normal"
},
{
"key": "official_urls",
"label": "官网地址",
"type": "json",
"description": "产品官网链接JSON数组格式[{\"url\":\"https://...\",\"title\":\"...\"}]",
"required": false,
"input_style": "long"
},
{
"key": "reference_urls",
"label": "数据参考",
"type": "json",
"description": "参数来源链接JSON数组格式[{\"url\":\"https://...\",\"title\":\"...\"}]",
"required": false,
"input_style": "long"
},
{
"key": "description",
"label": "描述",
@@ -668,6 +700,22 @@
"required": false,
"input_style": "normal"
},
{
"key": "official_urls",
"label": "官网地址",
"type": "json",
"description": "产品官网链接JSON数组格式[{\"url\":\"https://...\",\"title\":\"...\"}]",
"required": false,
"input_style": "long"
},
{
"key": "reference_urls",
"label": "数据参考",
"type": "json",
"description": "参数来源链接JSON数组格式[{\"url\":\"https://...\",\"title\":\"...\"}]",
"required": false,
"input_style": "long"
},
{
"key": "description",
"label": "描述",
@@ -697,34 +745,46 @@
"subcategories": [
{
"feature_labels": {
"price": "价格",
"processor": "处理器",
"ram_gb": "存",
"storage_gb": "存储"
"soc": "处理器",
"ram": "内存",
"rom": "存",
"screen_size": "屏幕",
"battery": "电池",
"fast_charge": "快充",
"rear_main_cam": "主摄",
"price": "价格"
},
"icon": "ri-star-line",
"id": "flagship",
"key_features": [
"processor",
"ram_gb",
"storage_gb",
"soc",
"ram",
"rom",
"screen_size",
"battery",
"fast_charge",
"rear_main_cam",
"price"
],
"name": "旗舰手机"
},
{
"feature_labels": {
"battery_mah": "电池",
"price": "价格",
"processor": "处理器",
"ram_gb": "内存"
"soc": "处理器",
"ram": "内存",
"rom": "存储",
"battery": "电池",
"rear_main_cam": "主摄",
"price": "价格"
},
"icon": "ri-price-tag-3-line",
"id": "midrange",
"key_features": [
"processor",
"ram_gb",
"battery_mah",
"soc",
"ram",
"rom",
"battery",
"rear_main_cam",
"price"
],
"name": "中端手机"
@@ -732,92 +792,420 @@
],
"fields": [
{
"description": "手机型号",
"key": "name",
"label": "名称",
"required": true,
"label": "型号",
"type": "text",
"description": "手机型号名称",
"required": true,
"input_style": "normal"
},
{
"description": "手机品牌",
"key": "brand",
"label": "品牌",
"type": "text",
"description": "小米/华为/Apple/荣耀等",
"required": true,
"type": "text",
"input_style": "normal"
},
{
"description": "CPU型号",
"key": "processor",
"label": "处理器",
"key": "release_date",
"label": "发布日期",
"type": "text",
"description": "产品发布日期格式YYYY年MM月DD日",
"required": false,
"type": "text",
"input_style": "normal"
},
{
"description": "RAM容量",
"key": "ram_gb",
"label": "内存(GB)",
"key": "market_date",
"label": "上市时间",
"type": "text",
"description": "产品上市日期格式YYYY年MM月DD日",
"required": false,
"type": "text",
"input_style": "normal"
},
{
"description": "存储容量",
"key": "storage_gb",
"label": "存储(GB)",
"key": "product_level",
"label": "产品级别",
"type": "text",
"description": "入门/中端/旗舰等",
"required": false,
"type": "text",
"input_style": "normal"
},
{
"description": "屏幕尺寸(英寸)",
"key": "screen_size",
"label": "屏幕尺寸",
"required": false,
"type": "text",
"input_style": "normal"
},
{
"description": "电池容量",
"key": "battery_mah",
"label": "电池(mAh)",
"required": false,
"type": "text",
"input_style": "normal"
},
{
"description": "参考价格",
"key": "price",
"label": "价格",
"required": false,
"type": "text",
"description": "参考价格",
"required": false,
"input_style": "normal"
},
{
"key": "os",
"label": "操作系统",
"type": "text",
"description": "Android/iOS/HarmonyOS等",
"required": false,
"input_style": "normal"
},
{
"key": "soc",
"label": "处理器",
"type": "text",
"description": "SoC/CPU型号如骁龙8至尊版、天玑9400、A18 Pro",
"required": false,
"input_style": "normal"
},
{
"key": "gpu",
"label": "GPU",
"type": "text",
"description": "图形处理芯片",
"required": false,
"input_style": "normal"
},
{
"key": "ram",
"label": "运行内存",
"type": "text",
"description": "如8GB/12GB/16GB",
"required": false,
"input_style": "normal"
},
{
"key": "rom",
"label": "存储空间",
"type": "text",
"description": "如128GB/256GB/512GB/1TB",
"required": false,
"input_style": "normal"
},
{
"key": "storage_expand",
"label": "存储扩展",
"type": "text",
"description": "TF卡等扩展方式",
"required": false,
"input_style": "normal"
},
{
"key": "screen_size",
"label": "屏幕尺寸",
"type": "text",
"description": "如6.3英寸",
"required": false,
"input_style": "normal"
},
{
"key": "screen_type",
"label": "屏幕类型",
"type": "text",
"description": "OLED/LCD/AMOLED",
"required": false,
"input_style": "normal"
},
{
"key": "resolution",
"label": "分辨率",
"type": "text",
"description": "1080P/1.5K/2K",
"required": false,
"input_style": "normal"
},
{
"key": "refresh_rate",
"label": "刷新率",
"type": "text",
"description": "60Hz/90Hz/120Hz/144Hz",
"required": false,
"input_style": "normal"
},
{
"key": "ltpo",
"label": "LTPO",
"type": "text",
"description": "自适应刷新率,省电",
"required": false,
"input_style": "normal"
},
{
"key": "brightness",
"label": "亮度",
"type": "text",
"description": "峰值亮度nit",
"required": false,
"input_style": "normal"
},
{
"key": "screen_feature",
"label": "屏幕特色",
"type": "text",
"description": "直屏/曲面屏、护眼调光等",
"required": false,
"input_style": "normal"
},
{
"key": "rear_main_cam",
"label": "后置主摄",
"type": "text",
"description": "像素、传感器型号、光圈",
"required": false,
"input_style": "normal"
},
{
"key": "rear_ultra_wide",
"label": "超广角",
"type": "text",
"description": "像素、视角",
"required": false,
"input_style": "normal"
},
{
"key": "rear_telephoto",
"label": "长焦",
"type": "text",
"description": "倍率3x/5x/10x",
"required": false,
"input_style": "normal"
},
{
"key": "front_cam",
"label": "前置摄像头",
"type": "text",
"description": "像素",
"required": false,
"input_style": "normal"
},
{
"key": "video_record",
"label": "视频录制",
"type": "text",
"description": "4K/8K、帧率",
"required": false,
"input_style": "normal"
},
{
"key": "cam_feature",
"label": "摄像头特色",
"type": "text",
"description": "徕卡/蔡司/哈苏、OIS光学防抖等",
"required": false,
"input_style": "normal"
},
{
"key": "battery",
"label": "电池容量",
"type": "text",
"description": "mAh4000-7000+",
"required": false,
"input_style": "normal"
},
{
"key": "fast_charge",
"label": "有线快充",
"type": "text",
"description": "功率33W/67W/100W/120W+",
"required": false,
"input_style": "normal"
},
{
"key": "wireless_charge",
"label": "无线充电",
"type": "text",
"description": "功率15W/50W等",
"required": false,
"input_style": "normal"
},
{
"key": "battery_feature",
"label": "电池特色",
"type": "text",
"description": "反向充电等",
"required": false,
"input_style": "normal"
},
{
"key": "network",
"label": "运营商网络",
"type": "text",
"description": "5G/4G支持",
"required": false,
"input_style": "normal"
},
{
"key": "wifi",
"label": "Wi-Fi",
"type": "text",
"description": "Wi-Fi 6/6E/7",
"required": false,
"input_style": "normal"
},
{
"key": "bluetooth",
"label": "蓝牙",
"type": "text",
"description": "5.3/5.4",
"required": false,
"input_style": "normal"
},
{
"key": "nfc",
"label": "NFC",
"type": "text",
"description": "刷公交、门禁、支付",
"required": false,
"input_style": "normal"
},
{
"key": "ir_remote",
"label": "红外遥控",
"type": "text",
"description": "是/否",
"required": false,
"input_style": "normal"
},
{
"key": "gps",
"label": "定位系统",
"type": "text",
"description": "GPS等",
"required": false,
"input_style": "normal"
},
{
"key": "usb_interface",
"label": "USB接口",
"type": "text",
"description": "Type-C/USB 3.0/2.0",
"required": false,
"input_style": "normal"
},
{
"key": "sim_card",
"label": "SIM卡",
"type": "text",
"description": "单卡/双卡",
"required": false,
"input_style": "normal"
},
{
"key": "fingerprint",
"label": "指纹识别",
"type": "text",
"description": "侧边/屏下超声波/屏下光学",
"required": false,
"input_style": "normal"
},
{
"key": "waterproof",
"label": "防水防尘等级",
"type": "text",
"description": "IP68/IP69/IP54等",
"required": false,
"input_style": "normal"
},
{
"key": "face_id",
"label": "面部识别",
"type": "text",
"description": "Face ID/3D结构光",
"required": false,
"input_style": "normal"
},
{
"key": "weight",
"label": "重量",
"type": "text",
"description": "克g",
"required": false,
"input_style": "normal"
},
{
"key": "thickness",
"label": "厚度",
"type": "text",
"description": "毫米mm",
"required": false,
"input_style": "normal"
},
{
"key": "body_material",
"label": "机身材质",
"type": "text",
"description": "玻璃/陶瓷/金属/素皮",
"required": false,
"input_style": "normal"
},
{
"key": "colors",
"label": "颜色",
"type": "text",
"description": "可选颜色",
"required": false,
"input_style": "normal"
},
{
"key": "frame_material",
"label": "中框材质",
"type": "text",
"description": "铝合金/钛合金",
"required": false,
"input_style": "normal"
},
{
"key": "speaker",
"label": "扬声器",
"type": "text",
"description": "单扬声器/立体声双扬声器",
"required": false,
"input_style": "normal"
},
{
"key": "headphone_jack",
"label": "耳机接口",
"type": "text",
"description": "3.5mm耳机孔",
"required": false,
"input_style": "normal"
},
{
"key": "vibration",
"label": "震动反馈",
"type": "text",
"description": "X轴线性马达",
"required": false,
"input_style": "normal"
},
{
"key": "features",
"label": "特色",
"type": "text",
"description": "产品特色/亮点,简短描述",
"description": "产品特色/亮点",
"required": false,
"input_style": "normal"
},
{
"description": "产品简介",
"key": "description",
"label": "描述",
"key": "official_urls",
"label": "官网地址",
"type": "json",
"description": "产品官网链接",
"required": false,
"type": "text",
"input_style": "long"
},
{
"description": "产品发布日期,格式 YYYY-MM-DD",
"key": "publish_date",
"label": "发布日期",
"key": "reference_urls",
"label": "数据参考",
"type": "json",
"description": "参数来源链接",
"required": false,
"input_style": "long"
},
{
"key": "description",
"label": "描述",
"type": "text",
"input_style": "normal"
"description": "产品简介",
"required": false,
"input_style": "long"
}
],
"updated_at": "2026-04-28 18:28:01"
@@ -962,6 +1350,22 @@
"required": false,
"input_style": "normal"
},
{
"key": "official_urls",
"label": "官网地址",
"type": "json",
"description": "产品官网链接JSON数组格式[{\"url\":\"https://...\",\"title\":\"...\"}]",
"required": false,
"input_style": "long"
},
{
"key": "reference_urls",
"label": "数据参考",
"type": "json",
"description": "参数来源链接JSON数组格式[{\"url\":\"https://...\",\"title\":\"...\"}]",
"required": false,
"input_style": "long"
},
{
"description": "产品简介",
"input_style": "long",
@@ -1079,6 +1483,22 @@
"required": false,
"input_style": "normal"
},
{
"key": "official_urls",
"label": "官网地址",
"type": "json",
"description": "产品官网链接JSON数组格式[{\"url\":\"https://...\",\"title\":\"...\"}]",
"required": false,
"input_style": "long"
},
{
"key": "reference_urls",
"label": "数据参考",
"type": "json",
"description": "参数来源链接JSON数组格式[{\"url\":\"https://...\",\"title\":\"...\"}]",
"required": false,
"input_style": "long"
},
{
"description": "车型简介",
"input_style": "long",
@@ -1225,6 +1645,22 @@
"required": false,
"input_style": "normal"
},
{
"key": "official_urls",
"label": "官网地址",
"type": "json",
"description": "产品官网链接JSON数组格式[{\"url\":\"https://...\",\"title\":\"...\"}]",
"required": false,
"input_style": "long"
},
{
"key": "reference_urls",
"label": "数据参考",
"type": "json",
"description": "参数来源链接JSON数组格式[{\"url\":\"https://...\",\"title\":\"...\"}]",
"required": false,
"input_style": "long"
},
{
"key": "description",
"label": "描述",

View File

@@ -534,11 +534,30 @@
container.innerHTML = '';
return;
}
// 获取当前筛选值 - 根据容器ID判断
let currentFilter = '';
if (containerId === 'model-subcategory-filters') currentFilter = modelSubcategoryFilter;
else if (containerId === 'gpu-subcategory-filters') currentFilter = gpuSubcategoryFilter;
else if (containerId === 'cpu-subcategory-filters') currentFilter = cpuSubcategoryFilter;
else if (containerId === 'dynamic-subcategory-filters') currentFilter = dynamicSubcategoryFilter;
// 渲染子类别按钮
container.innerHTML = cat.subcategories.map(sub => `
<button onclick="${filterFunction}('${sub.id}')" class="px-3 py-1 rounded text-sm bg-white border text-gray-600 hover:bg-gray-100">
<i class="${sub.icon} mr-1"></i>${sub.name}
<button onclick="${filterFunction}('${sub.id}')" class="px-3 py-1 rounded text-sm ${currentFilter === sub.id ? 'bg-indigo-600 text-white' : 'bg-white border text-gray-600 hover:bg-gray-100'}">
<i class="${sub.icon || 'ri-folder-line'} mr-1"></i>${sub.name}
</button>
`).join('');
// 更新"全部"按钮的样式 - 它是容器前面的那个按钮
const allBtn = container.previousElementSibling;
if (allBtn && allBtn.tagName === 'BUTTON') {
if (currentFilter === '') {
allBtn.className = 'px-3 py-1 rounded text-sm bg-indigo-600 text-white';
} else {
allBtn.className = 'px-3 py-1 rounded text-sm bg-white border text-gray-600 hover:bg-gray-100';
}
}
}
const colorMap = {
@@ -647,7 +666,7 @@
} else {
// 动态分类
html += `
<a href="#cat-${cat.id}" onclick="showDynamicCategory('${cat.id}')" class="sidebar-link flex items-center gap-2 px-3 py-2 rounded-lg text-gray-300" data-section="cat-${cat.id}">
<a href="#cat-${cat.id}" onclick="dynamicSubcategoryFilter='';showDynamicCategory('${cat.id}')" class="sidebar-link flex items-center gap-2 px-3 py-2 rounded-lg text-gray-300" data-section="cat-${cat.id}">
<i class="${cat.icon}"></i>
<span>${cat.name}管理</span>
</a>
@@ -669,7 +688,8 @@
// 显示动态分类数据
async function showDynamicCategory(categoryId) {
dynamicCategoryId = categoryId;
dynamicSubcategoryFilter = '';
// 不要每次都重置筛选值,除非是新切换的分类
// dynamicSubcategoryFilter = ''; // 移除这行
const cat = categories.find(c => c.id === categoryId);
const fields = cat ? (cat.fields || []) : [];
const fixedFields = ['id', 'created_at', 'updated_at', 'visible', 'raw_text', 'category_id', 'subcategory_id', 'is_pinned', 'images'];