Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e69f09842 | |||
| 2dd45854c1 | |||
| 72de68e1ff | |||
| 6844d73c9d | |||
| 40b04ae9c1 | |||
| c8d46f6f99 |
6
app.py
6
app.py
@@ -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格式,不要包含任何其他内容
|
||||
|
||||
|
||||
@@ -205,6 +205,30 @@
|
||||
"required": false,
|
||||
"input_style": "normal"
|
||||
},
|
||||
{
|
||||
"key": "features",
|
||||
"label": "特色",
|
||||
"type": "text",
|
||||
"description": "产品特色/亮点,简短描述",
|
||||
"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": "描述",
|
||||
@@ -432,6 +456,30 @@
|
||||
"required": false,
|
||||
"input_style": "normal"
|
||||
},
|
||||
{
|
||||
"key": "features",
|
||||
"label": "特色",
|
||||
"type": "text",
|
||||
"description": "产品特色/亮点,简短描述",
|
||||
"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": "描述",
|
||||
@@ -644,6 +692,30 @@
|
||||
"required": false,
|
||||
"input_style": "normal"
|
||||
},
|
||||
{
|
||||
"key": "features",
|
||||
"label": "特色",
|
||||
"type": "text",
|
||||
"description": "产品特色/亮点,简短描述",
|
||||
"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": "描述",
|
||||
@@ -771,6 +843,30 @@
|
||||
"type": "text",
|
||||
"input_style": "normal"
|
||||
},
|
||||
{
|
||||
"key": "features",
|
||||
"label": "特色",
|
||||
"type": "text",
|
||||
"description": "产品特色/亮点,简短描述",
|
||||
"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": "产品简介",
|
||||
"key": "description",
|
||||
@@ -799,138 +895,172 @@
|
||||
"order": 5,
|
||||
"subcategories": [
|
||||
{
|
||||
"id": "gaming-laptop",
|
||||
"name": "游戏笔记本",
|
||||
"feature_labels": {
|
||||
"gpu": "显卡",
|
||||
"price": "价格",
|
||||
"processor": "处理器",
|
||||
"ram_gb": "内存"
|
||||
},
|
||||
"icon": "ri-gamepad-line",
|
||||
"id": "gaming-laptop",
|
||||
"key_features": [
|
||||
"processor",
|
||||
"gpu",
|
||||
"ram_gb",
|
||||
"price"
|
||||
],
|
||||
"feature_labels": {
|
||||
"processor": "处理器",
|
||||
"gpu": "显卡",
|
||||
"ram_gb": "内存",
|
||||
"price": "价格"
|
||||
}
|
||||
"name": "游戏笔记本"
|
||||
},
|
||||
{
|
||||
"id": "business-laptop",
|
||||
"name": "商务笔记本",
|
||||
"feature_labels": {
|
||||
"price": "价格",
|
||||
"processor": "处理器",
|
||||
"ram_gb": "内存",
|
||||
"weight_kg": "重量"
|
||||
},
|
||||
"icon": "ri-briefcase-line",
|
||||
"id": "business-laptop",
|
||||
"key_features": [
|
||||
"processor",
|
||||
"ram_gb",
|
||||
"weight_kg",
|
||||
"price"
|
||||
],
|
||||
"feature_labels": {
|
||||
"processor": "处理器",
|
||||
"ram_gb": "内存",
|
||||
"weight_kg": "重量",
|
||||
"price": "价格"
|
||||
}
|
||||
"name": "商务笔记本"
|
||||
},
|
||||
{
|
||||
"id": "5d6fe10bbada",
|
||||
"name": "台式主机",
|
||||
"icon": "ri-folder-line",
|
||||
"key_features": [],
|
||||
"feature_labels": {},
|
||||
"extra_fields": [
|
||||
{
|
||||
"key": "power",
|
||||
"label": "电源",
|
||||
"type": "text",
|
||||
"description": "",
|
||||
"required": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"description": "电脑型号",
|
||||
"input_style": "normal",
|
||||
"key": "name",
|
||||
"label": "名称",
|
||||
"type": "text",
|
||||
"description": "电脑型号",
|
||||
"required": true,
|
||||
"input_style": "normal"
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"description": "品牌",
|
||||
"input_style": "normal",
|
||||
"key": "brand",
|
||||
"label": "品牌",
|
||||
"type": "text",
|
||||
"description": "品牌",
|
||||
"required": true,
|
||||
"input_style": "normal"
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"description": "CPU型号",
|
||||
"input_style": "normal",
|
||||
"key": "processor",
|
||||
"label": "处理器",
|
||||
"type": "text",
|
||||
"description": "CPU型号",
|
||||
"required": false,
|
||||
"input_style": "normal"
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"description": "GPU型号",
|
||||
"input_style": "normal",
|
||||
"key": "gpu",
|
||||
"label": "显卡",
|
||||
"type": "text",
|
||||
"description": "GPU型号",
|
||||
"required": false,
|
||||
"input_style": "normal"
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"description": "RAM容量",
|
||||
"input_style": "normal",
|
||||
"key": "ram_gb",
|
||||
"label": "内存(GB)",
|
||||
"type": "text",
|
||||
"description": "RAM容量",
|
||||
"required": false,
|
||||
"input_style": "normal"
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"description": "存储容量",
|
||||
"input_style": "normal",
|
||||
"key": "storage_gb",
|
||||
"label": "存储(GB)",
|
||||
"type": "text",
|
||||
"description": "存储容量",
|
||||
"required": false,
|
||||
"input_style": "normal"
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"description": "屏幕尺寸",
|
||||
"input_style": "normal",
|
||||
"key": "screen_size",
|
||||
"label": "屏幕尺寸",
|
||||
"type": "text",
|
||||
"description": "屏幕尺寸",
|
||||
"required": false,
|
||||
"input_style": "normal"
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"description": "重量",
|
||||
"input_style": "normal",
|
||||
"key": "weight_kg",
|
||||
"label": "重量(kg)",
|
||||
"type": "text",
|
||||
"description": "重量",
|
||||
"required": false,
|
||||
"input_style": "normal"
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"description": "参考价格",
|
||||
"input_style": "normal",
|
||||
"key": "price",
|
||||
"label": "价格",
|
||||
"required": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"key": "features",
|
||||
"label": "特色",
|
||||
"type": "text",
|
||||
"description": "参考价格",
|
||||
"description": "产品特色/亮点,简短描述",
|
||||
"required": false,
|
||||
"input_style": "normal"
|
||||
},
|
||||
{
|
||||
"key": "year",
|
||||
"label": "年份",
|
||||
"type": "text",
|
||||
"description": "发布年份",
|
||||
"required": false,
|
||||
"input_style": "normal"
|
||||
},
|
||||
{
|
||||
"key": "description",
|
||||
"label": "描述",
|
||||
"type": "text",
|
||||
"description": "产品简介",
|
||||
"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",
|
||||
"key": "description",
|
||||
"label": "描述",
|
||||
"required": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"description": "产品发布日期,格式 YYYY-MM-DD",
|
||||
"input_style": "normal",
|
||||
"key": "publish_date",
|
||||
"label": "发布日期",
|
||||
"type": "text",
|
||||
"description": "产品发布日期,格式 YYYY-MM-DD",
|
||||
"required": false,
|
||||
"input_style": "normal"
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
],
|
||||
"visible": true,
|
||||
"updated_at": "2026-04-29 12:21:23"
|
||||
},
|
||||
{
|
||||
"id": "021dc76d36be",
|
||||
@@ -942,94 +1072,128 @@
|
||||
"created_at": "2026-04-09 10:09:01",
|
||||
"subcategories": [
|
||||
{
|
||||
"id": "sedan",
|
||||
"name": "轿车",
|
||||
"feature_labels": {
|
||||
"engine": "发动机",
|
||||
"power_kw": "功率",
|
||||
"price": "价格"
|
||||
},
|
||||
"icon": "ri-car-line",
|
||||
"id": "sedan",
|
||||
"key_features": [
|
||||
"engine",
|
||||
"power_kw",
|
||||
"price"
|
||||
],
|
||||
"feature_labels": {
|
||||
"engine": "发动机",
|
||||
"power_kw": "功率",
|
||||
"price": "价格"
|
||||
}
|
||||
"name": "轿车"
|
||||
},
|
||||
{
|
||||
"id": "suv",
|
||||
"name": "SUV",
|
||||
"feature_labels": {
|
||||
"engine": "发动机",
|
||||
"price": "价格",
|
||||
"seats": "座位数"
|
||||
},
|
||||
"icon": "ri-truck-line",
|
||||
"id": "suv",
|
||||
"key_features": [
|
||||
"engine",
|
||||
"seats",
|
||||
"price"
|
||||
],
|
||||
"feature_labels": {
|
||||
"engine": "发动机",
|
||||
"seats": "座位数",
|
||||
"price": "价格"
|
||||
}
|
||||
"name": "SUV"
|
||||
},
|
||||
{
|
||||
"id": "df938b1c0d81",
|
||||
"name": "房车",
|
||||
"icon": "ri-folder-line",
|
||||
"key_features": [],
|
||||
"feature_labels": {},
|
||||
"extra_fields": []
|
||||
}
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"description": "车型名称",
|
||||
"input_style": "normal",
|
||||
"key": "name",
|
||||
"label": "名称",
|
||||
"type": "text",
|
||||
"description": "车型名称",
|
||||
"required": true,
|
||||
"input_style": "normal"
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"description": "汽车品牌",
|
||||
"input_style": "normal",
|
||||
"key": "brand",
|
||||
"label": "品牌",
|
||||
"type": "text",
|
||||
"description": "汽车品牌",
|
||||
"required": true,
|
||||
"input_style": "normal"
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"description": "参考价格(万元)",
|
||||
"input_style": "normal",
|
||||
"key": "price",
|
||||
"label": "价格(万)",
|
||||
"type": "text",
|
||||
"description": "参考价格(万元)",
|
||||
"required": false,
|
||||
"input_style": "normal"
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"description": "生产年份",
|
||||
"input_style": "normal",
|
||||
"key": "year",
|
||||
"label": "年份",
|
||||
"type": "text",
|
||||
"description": "生产年份",
|
||||
"required": false,
|
||||
"input_style": "normal"
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"description": "详细规格参数",
|
||||
"input_style": "long",
|
||||
"key": "specs",
|
||||
"label": "参数",
|
||||
"type": "text",
|
||||
"description": "详细规格参数",
|
||||
"required": false,
|
||||
"input_style": "long"
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"key": "description",
|
||||
"label": "描述",
|
||||
"key": "features",
|
||||
"label": "特色",
|
||||
"type": "text",
|
||||
"description": "车型简介",
|
||||
"required": false,
|
||||
"input_style": "long"
|
||||
},
|
||||
{
|
||||
"key": "publish_date",
|
||||
"label": "发布日期",
|
||||
"type": "text",
|
||||
"description": "产品发布日期,格式 YYYY-MM-DD",
|
||||
"description": "产品特色/亮点,简短描述",
|
||||
"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",
|
||||
"key": "description",
|
||||
"label": "描述",
|
||||
"required": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"description": "产品发布日期,格式 YYYY-MM-DD",
|
||||
"input_style": "normal",
|
||||
"key": "publish_date",
|
||||
"label": "发布日期",
|
||||
"required": false,
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
],
|
||||
"visible": true,
|
||||
"updated_at": "2026-04-29 13:09:39"
|
||||
},
|
||||
{
|
||||
"id": "71fa2b4d818f",
|
||||
@@ -1149,6 +1313,30 @@
|
||||
"required": false,
|
||||
"input_style": "long"
|
||||
},
|
||||
{
|
||||
"key": "features",
|
||||
"label": "特色",
|
||||
"type": "text",
|
||||
"description": "产品特色/亮点,简短描述",
|
||||
"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": "描述",
|
||||
|
||||
@@ -534,11 +534,31 @@
|
||||
container.innerHTML = '';
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取当前筛选值
|
||||
let currentFilter = '';
|
||||
if (categoryId === 'ai-models') currentFilter = modelSubcategoryFilter;
|
||||
else if (categoryId === 'gpus') currentFilter = gpuSubcategoryFilter;
|
||||
else if (categoryId === 'cpus') currentFilter = cpuSubcategoryFilter;
|
||||
else if (categoryId === dynamicCategoryId) currentFilter = dynamicSubcategoryFilter;
|
||||
|
||||
// 只渲染子类别按钮,不渲染"全部"按钮(HTML里已有)
|
||||
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 parent = container.parentElement;
|
||||
if (parent) {
|
||||
const allBtn = parent.querySelector('button:first-of-type');
|
||||
if (allBtn && currentFilter === '') {
|
||||
allBtn.className = 'px-3 py-1 rounded text-sm bg-indigo-600 text-white';
|
||||
} else if (allBtn) {
|
||||
allBtn.className = 'px-3 py-1 rounded text-sm bg-white border text-gray-600 hover:bg-gray-100';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const colorMap = {
|
||||
|
||||
@@ -283,7 +283,7 @@
|
||||
</tr>
|
||||
`;
|
||||
|
||||
document.querySelector('#modelsTable thead').innerHTML = headerHtml;
|
||||
document.querySelector('table thead').innerHTML = headerHtml;
|
||||
|
||||
// 动态内容
|
||||
const html = models.map(m => {
|
||||
|
||||
Reference in New Issue
Block a user