Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 151829296e |
106
app.py
106
app.py
@@ -570,10 +570,18 @@ def api_smart_update_model(model_id):
|
||||
updated_fields.append(key)
|
||||
|
||||
model['updated_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
model['raw_text'] = model.get('raw_text', '') + '\n' + text if text else model.get('raw_text', '')
|
||||
if images:
|
||||
existing_images = model.get('images', [])
|
||||
model['images'] = existing_images + images
|
||||
|
||||
# 追加解析来源记录
|
||||
parse_source = {
|
||||
'type': 'smart_update',
|
||||
'timestamp': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'images': images,
|
||||
'text': text[:500] if text else '',
|
||||
'updated_fields': updated_fields
|
||||
}
|
||||
if 'parse_sources' not in model:
|
||||
model['parse_sources'] = []
|
||||
model['parse_sources'].append(parse_source)
|
||||
|
||||
save_data(MODELS_FILE, models)
|
||||
|
||||
@@ -609,10 +617,17 @@ def api_smart_update_gpu(gpu_id):
|
||||
updated_fields.append(key)
|
||||
|
||||
gpu['updated_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
gpu['raw_text'] = gpu.get('raw_text', '') + '\n' + text if text else gpu.get('raw_text', '')
|
||||
if images:
|
||||
existing_images = gpu.get('images', [])
|
||||
gpu['images'] = existing_images + images
|
||||
|
||||
parse_source = {
|
||||
'type': 'smart_update',
|
||||
'timestamp': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'images': images,
|
||||
'text': text[:500] if text else '',
|
||||
'updated_fields': updated_fields
|
||||
}
|
||||
if 'parse_sources' not in gpu:
|
||||
gpu['parse_sources'] = []
|
||||
gpu['parse_sources'].append(parse_source)
|
||||
|
||||
save_data(GPUS_FILE, gpus)
|
||||
|
||||
@@ -648,10 +663,17 @@ def api_smart_update_cpu(cpu_id):
|
||||
updated_fields.append(key)
|
||||
|
||||
cpu['updated_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
cpu['raw_text'] = cpu.get('raw_text', '') + '\n' + text if text else cpu.get('raw_text', '')
|
||||
if images:
|
||||
existing_images = cpu.get('images', [])
|
||||
cpu['images'] = existing_images + images
|
||||
|
||||
parse_source = {
|
||||
'type': 'smart_update',
|
||||
'timestamp': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'images': images,
|
||||
'text': text[:500] if text else '',
|
||||
'updated_fields': updated_fields
|
||||
}
|
||||
if 'parse_sources' not in cpu:
|
||||
cpu['parse_sources'] = []
|
||||
cpu['parse_sources'].append(parse_source)
|
||||
|
||||
save_data(CPUS_FILE, cpus)
|
||||
|
||||
@@ -688,10 +710,17 @@ def api_smart_update_item(category_id, item_id):
|
||||
updated_fields.append(key)
|
||||
|
||||
item['updated_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
item['raw_text'] = item.get('raw_text', '') + '\n' + text if text else item.get('raw_text', '')
|
||||
if images:
|
||||
existing_images = item.get('images', [])
|
||||
item['images'] = existing_images + images
|
||||
|
||||
parse_source = {
|
||||
'type': 'smart_update',
|
||||
'timestamp': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'images': images,
|
||||
'text': text[:500] if text else '',
|
||||
'updated_fields': updated_fields
|
||||
}
|
||||
if 'parse_sources' not in item:
|
||||
item['parse_sources'] = []
|
||||
item['parse_sources'].append(parse_source)
|
||||
|
||||
save_data(items_file, items)
|
||||
|
||||
@@ -715,17 +744,25 @@ def api_smart_add_model():
|
||||
results = []
|
||||
models = load_data(MODELS_FILE)
|
||||
|
||||
# 构建解析来源记录
|
||||
parse_source = {
|
||||
'type': 'smart_add',
|
||||
'timestamp': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'images': images,
|
||||
'text': text[:500] if text else '' # 截取前500字符
|
||||
}
|
||||
|
||||
for parsed in parsed_list:
|
||||
# 补充必要字段
|
||||
parsed['id'] = uuid.uuid4().hex[:12]
|
||||
parsed['created_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
parsed['visible'] = True
|
||||
parsed['raw_text'] = text
|
||||
parsed['images'] = images
|
||||
parsed['subcategory_id'] = subcategory_id # 保存子类别
|
||||
parsed['publish_date'] = parsed.get('publish_date', '')
|
||||
parsed['views'] = 0
|
||||
parsed['is_pinned'] = False
|
||||
parsed['product_images'] = [] # 产品展示图(不同于参数截图)
|
||||
parsed['parse_sources'] = [parse_source] # 解析来源历史
|
||||
|
||||
models.append(parsed)
|
||||
results.append(parsed)
|
||||
@@ -750,16 +787,23 @@ def api_smart_add_gpu():
|
||||
results = []
|
||||
gpus = load_data(GPUS_FILE)
|
||||
|
||||
parse_source = {
|
||||
'type': 'smart_add',
|
||||
'timestamp': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'images': images,
|
||||
'text': text[:500] if text else ''
|
||||
}
|
||||
|
||||
for parsed in parsed_list:
|
||||
parsed['id'] = uuid.uuid4().hex[:12]
|
||||
parsed['created_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
parsed['visible'] = True
|
||||
parsed['raw_text'] = text
|
||||
parsed['images'] = images
|
||||
parsed['subcategory_id'] = subcategory_id
|
||||
parsed['publish_date'] = parsed.get('publish_date', '')
|
||||
parsed['views'] = 0
|
||||
parsed['is_pinned'] = False
|
||||
parsed['product_images'] = []
|
||||
parsed['parse_sources'] = [parse_source]
|
||||
|
||||
gpus.append(parsed)
|
||||
results.append(parsed)
|
||||
@@ -784,16 +828,23 @@ def api_smart_add_cpu():
|
||||
results = []
|
||||
cpus = load_data(CPUS_FILE)
|
||||
|
||||
parse_source = {
|
||||
'type': 'smart_add',
|
||||
'timestamp': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'images': images,
|
||||
'text': text[:500] if text else ''
|
||||
}
|
||||
|
||||
for parsed in parsed_list:
|
||||
parsed['id'] = uuid.uuid4().hex[:12]
|
||||
parsed['created_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
parsed['visible'] = True
|
||||
parsed['raw_text'] = text
|
||||
parsed['images'] = images
|
||||
parsed['subcategory_id'] = subcategory_id
|
||||
parsed['publish_date'] = parsed.get('publish_date', '')
|
||||
parsed['views'] = 0
|
||||
parsed['is_pinned'] = False
|
||||
parsed['product_images'] = []
|
||||
parsed['parse_sources'] = [parse_source]
|
||||
|
||||
cpus.append(parsed)
|
||||
results.append(parsed)
|
||||
@@ -820,17 +871,24 @@ def api_smart_add_item(category_id):
|
||||
items_file = DATA_DIR / f'items_{category_id}.json'
|
||||
items = load_data(items_file)
|
||||
|
||||
parse_source = {
|
||||
'type': 'smart_add',
|
||||
'timestamp': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'images': images,
|
||||
'text': text[:500] if text else ''
|
||||
}
|
||||
|
||||
for parsed in parsed_list:
|
||||
parsed['id'] = uuid.uuid4().hex[:12]
|
||||
parsed['category_id'] = category_id
|
||||
parsed['created_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
parsed['visible'] = True
|
||||
parsed['raw_text'] = text
|
||||
parsed['images'] = images
|
||||
parsed['subcategory_id'] = subcategory_id
|
||||
parsed['publish_date'] = parsed.get('publish_date', '')
|
||||
parsed['views'] = 0
|
||||
parsed['is_pinned'] = False
|
||||
parsed['product_images'] = []
|
||||
parsed['parse_sources'] = [parse_source]
|
||||
|
||||
items.append(parsed)
|
||||
results.append(parsed)
|
||||
|
||||
@@ -616,119 +616,113 @@
|
||||
"visible": true,
|
||||
"subcategories": [
|
||||
{
|
||||
"id": "flagship",
|
||||
"name": "旗舰手机",
|
||||
"feature_labels": {
|
||||
"price": "价格",
|
||||
"processor": "处理器",
|
||||
"ram_gb": "内存",
|
||||
"storage_gb": "存储"
|
||||
},
|
||||
"icon": "ri-star-line",
|
||||
"id": "flagship",
|
||||
"key_features": [
|
||||
"processor",
|
||||
"ram_gb",
|
||||
"storage_gb",
|
||||
"price"
|
||||
],
|
||||
"feature_labels": {
|
||||
"processor": "处理器",
|
||||
"ram_gb": "内存",
|
||||
"storage_gb": "存储",
|
||||
"price": "价格"
|
||||
}
|
||||
"name": "旗舰手机"
|
||||
},
|
||||
{
|
||||
"id": "midrange",
|
||||
"name": "中端手机",
|
||||
"feature_labels": {
|
||||
"battery_mah": "电池",
|
||||
"price": "价格",
|
||||
"processor": "处理器",
|
||||
"ram_gb": "内存"
|
||||
},
|
||||
"icon": "ri-price-tag-3-line",
|
||||
"id": "midrange",
|
||||
"key_features": [
|
||||
"processor",
|
||||
"ram_gb",
|
||||
"battery_mah",
|
||||
"price"
|
||||
],
|
||||
"feature_labels": {
|
||||
"processor": "处理器",
|
||||
"ram_gb": "内存",
|
||||
"battery_mah": "电池",
|
||||
"price": "价格"
|
||||
}
|
||||
"name": "中端手机"
|
||||
}
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"description": "手机型号",
|
||||
"key": "name",
|
||||
"label": "名称",
|
||||
"type": "text",
|
||||
"description": "手机型号",
|
||||
"required": true
|
||||
"required": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"description": "手机品牌",
|
||||
"key": "brand",
|
||||
"label": "品牌",
|
||||
"type": "text",
|
||||
"description": "手机品牌",
|
||||
"required": true
|
||||
"required": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"description": "CPU型号",
|
||||
"key": "processor",
|
||||
"label": "处理器",
|
||||
"type": "text",
|
||||
"description": "CPU型号",
|
||||
"required": false
|
||||
"required": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"description": "RAM容量",
|
||||
"key": "ram_gb",
|
||||
"label": "内存(GB)",
|
||||
"type": "number",
|
||||
"description": "RAM容量",
|
||||
"required": false
|
||||
"required": false,
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"description": "存储容量",
|
||||
"key": "storage_gb",
|
||||
"label": "存储(GB)",
|
||||
"type": "number",
|
||||
"description": "存储容量",
|
||||
"required": false
|
||||
"required": false,
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"description": "屏幕尺寸(英寸)",
|
||||
"key": "screen_size",
|
||||
"label": "屏幕尺寸",
|
||||
"type": "text",
|
||||
"description": "屏幕尺寸(英寸)",
|
||||
"required": false
|
||||
"required": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"description": "电池容量",
|
||||
"key": "battery_mah",
|
||||
"label": "电池(mAh)",
|
||||
"type": "number",
|
||||
"description": "电池容量",
|
||||
"required": false
|
||||
"required": false,
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"description": "参考价格",
|
||||
"key": "price",
|
||||
"label": "价格",
|
||||
"type": "number",
|
||||
"description": "参考价格",
|
||||
"required": false
|
||||
},
|
||||
{
|
||||
"key": "year",
|
||||
"label": "年份",
|
||||
"type": "number",
|
||||
"description": "发布年份",
|
||||
"required": false
|
||||
"required": false,
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"description": "产品简介",
|
||||
"key": "description",
|
||||
"label": "描述",
|
||||
"type": "text",
|
||||
"description": "产品简介",
|
||||
"required": false
|
||||
"required": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"description": "产品发布日期,格式 YYYY-MM-DD",
|
||||
"key": "publish_date",
|
||||
"label": "发布日期",
|
||||
"type": "text",
|
||||
"description": "产品发布日期,格式 YYYY-MM-DD",
|
||||
"required": false
|
||||
"required": false,
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
],
|
||||
"updated_at": "2026-04-28 18:28:01"
|
||||
},
|
||||
{
|
||||
"id": "laptops",
|
||||
|
||||
@@ -3,18 +3,79 @@
|
||||
"name": "华为Pura X Max",
|
||||
"brand": "华为",
|
||||
"processor": "麒麟9030 Pro",
|
||||
"screen_size": 7.6,
|
||||
"screen_size": "7.6",
|
||||
"year": 2026,
|
||||
"description": "全球首款横向阔折叠屏手机,内屏7.6英寸(WQHD+分辨率),外屏5.5英寸,搭载麒麟9030 Pro芯片和鸿蒙6系统,支持AI眼动翻页和手写笔功能,素皮版重约210g",
|
||||
"id": "5ffe89899549",
|
||||
"category_id": "phones",
|
||||
"created_at": "2026-04-28 18:20:59",
|
||||
"visible": true,
|
||||
"raw_text": "华为Pura X Max:全球首款横向阔折叠屏手机,内屏7.6英寸(WQHD+分辨率),外屏5.5英寸,搭载麒麟9030 Pro芯片和鸿蒙6系统,支持AI眼动翻页和手写笔功能,素皮版重约210g,2026年4月20日上市。",
|
||||
"raw_text": "华为Pura X Max:全球首款横向阔折叠屏手机,内屏7.6英寸(WQHD+分辨率),外屏5.5英寸,搭载麒麟9030 Pro芯片和鸿蒙6系统,支持AI眼动翻页和手写笔功能,素皮版重约210g,2026年4月20日上市。\n华为 Pura X Max 是华为最新推出的大阔折叠屏手机,官方起售价10999 元,提供多种存储版本及配色选择,已在华为商城等渠道正式开售 。更多详情可访问 [华为官网](https://consumer.huawei.com/cn/phones/pura-x-max/specs/) 或 [华为商城](https://item.vmall.com/product/comdetail/index.html?prdId=10086621059876&sbomCode=2601010615007) 。\n版本价格与发售信息\n\n1. 发售时间:于 2026 年 4 月 20 日正式发布,4 月 25 日 10:08 正式开售 。\n2. 官方定价:\n - 12GB+256GB:10999 元。\n - 12GB+512GB:11999 元。\n - 16GB+512GB 典藏版:12999 元。\n - 16GB+1TB 典藏版:13999 元。\n3. 购买渠道:可通过华为官网及华为商城等官方渠道购买,部分第三方平台价格可能存在波动,建议以官方定价为准 。\n核心硬件配置\n\n1. 屏幕显示:\n - 内屏:7.7 英寸折叠柔性 OLED,支持 1-120Hz LTPO 2.0 自适应刷新率,分辨率 2584×1828 像素 。\n - 外屏:5.4 英寸 OLED,支持 1-120Hz LTPO 2.0 自适应刷新率,分辨率 1848×1264 像素 。\n - 亮度:外屏峰值亮度 3500 尼特,内屏峰值亮度 3000 尼特,户外强光下清晰可见 。\n2. 性能系统:\n - 处理器:搭载麒麟 9030 Pro 芯片,整机性能提升 30% 。\n - 操作系统:预装 HarmonyOS 6.1,支持多设备协同 。\n3. 影像系统:\n - 后置:5000 万像素超光变主摄(F1.4-F4.0)+ 1250 万像素超广角 + 5000 万像素潜望长焦 + 第二代红枫原色摄像头 。\n - 前置:内外屏均配备 800 万像素摄像头,支持外屏自拍 。\n4. 续航充电:\n - 电池:5300mAh 典型值,支持 66W 有线超级快充及 50W 无线超级快充 。\n折叠形态与 AI 体验\n\n1. 阔折叠设计:\n - 采用√2:1 黄金比例设计,内外屏比例一致,接近 A4 纸对折比例,提升阅读和办公体验 。\n - 机身重量约 229 克,折叠态厚度 11.2mm,展开态厚度 5.2mm,便携性较好 。\n2. AI 功能:\n - 支持小艺伴随式 AI、AI 灵感妙创、AI 眼动翻页等功能,提升交互效率 。\n - 首发支持华为 M-Pen 3 Mini 手写笔,适配“天生会画”App,支持动态照片手绘 。\n3. 配色材质:\n - 提供幻夜黑、橄榄金、星际蓝、活力橙、零度白 5 款配色 。\n - 外屏采用第二代昆仑玻璃,支持 IP58+IP59 级防尘防水,耐用性增强 。",
|
||||
"images": [],
|
||||
"subcategory_id": "",
|
||||
"publish_date": "2026-01-01",
|
||||
"views": 0,
|
||||
"is_pinned": false
|
||||
"is_pinned": false,
|
||||
"price": 10999,
|
||||
"specs": {
|
||||
"screen": {
|
||||
"inner": {
|
||||
"size": 7.7,
|
||||
"type": "折叠柔性OLED",
|
||||
"refreshRate": "1-120Hz LTPO 2.0自适应刷新率",
|
||||
"resolution": "2584×1828像素",
|
||||
"brightness": 3000
|
||||
},
|
||||
"outer": {
|
||||
"size": 5.4,
|
||||
"type": "OLED",
|
||||
"refreshRate": "1-120Hz LTPO 2.0自适应刷新率",
|
||||
"resolution": "1848×1264像素",
|
||||
"brightness": 3500
|
||||
}
|
||||
},
|
||||
"performance": {
|
||||
"processor": "麒麟9030 Pro芯片",
|
||||
"os": "HarmonyOS 6.1"
|
||||
},
|
||||
"memory": {
|
||||
"ram": [
|
||||
"12GB",
|
||||
"16GB"
|
||||
],
|
||||
"storage": [
|
||||
"256GB",
|
||||
"512GB",
|
||||
"1TB"
|
||||
]
|
||||
},
|
||||
"camera": {
|
||||
"rear": "5000万像素超光变主摄 + 1250万像素超广角 + 5000万像素潜望长焦 + 第二代红枫原色摄像头",
|
||||
"front": "800万像素"
|
||||
},
|
||||
"battery": {
|
||||
"capacity": 5300,
|
||||
"charging": {
|
||||
"wired": 66,
|
||||
"wireless": 50
|
||||
}
|
||||
},
|
||||
"design": {
|
||||
"weight": 229,
|
||||
"thickness": {
|
||||
"folded": 11.2,
|
||||
"unfolded": 5.2
|
||||
},
|
||||
"waterResistance": "IP58+IP59"
|
||||
},
|
||||
"colors": [
|
||||
"幻夜黑",
|
||||
"橄榄金",
|
||||
"星际蓝",
|
||||
"活力橙",
|
||||
"零度白"
|
||||
]
|
||||
},
|
||||
"updated_at": "2026-04-28 18:29:08"
|
||||
}
|
||||
]
|
||||
2762
logs/app.log
2762
logs/app.log
File diff suppressed because it is too large
Load Diff
@@ -273,9 +273,14 @@
|
||||
<button onclick="closeModal()" class="text-gray-400 hover:text-gray-600"><i class="ri-close-line text-2xl"></i></button>
|
||||
</div>
|
||||
<div id="modalContent" class="p-6"></div>
|
||||
<!-- 解析来源历史 -->
|
||||
<div id="parseSourcesArea" class="hidden border-t mx-6 pt-4">
|
||||
<h3 class="text-sm font-semibold text-gray-700 mb-2"><i class="ri-history-line mr-1"></i>解析来源记录</h3>
|
||||
<div id="parseSourcesList" class="space-y-2 mb-4"></div>
|
||||
</div>
|
||||
<div class="p-6 border-t flex justify-end gap-4 sticky bottom-0 bg-white">
|
||||
<button onclick="closeModal()" class="px-4 py-2 bg-gray-200 text-gray-600 rounded-lg hover:bg-gray-300">取消</button>
|
||||
<button onclick="openSmartUpdateModal()" id="smartUpdateBtn" class="px-4 py-2 bg-orange-600 text-white rounded-lg hover:bg-orange-700 hidden"><i class="ri-magic-line mr-1"></i>智能补充</button>
|
||||
<button onclick="openSmartUpdateModal()" id="smartUpdateBtn" class="px-4 py-2 bg-orange-600 text-white rounded-lg hover:bg-orange-700 hidden"><i class="ri-magic-line mr-1"></i>补充解析</button>
|
||||
<button onclick="saveItem()" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -285,7 +290,7 @@
|
||||
<div id="smartAddModal" 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-magic-line mr-2 text-orange-600"></i>智能添加(根据参数字段解析)</h2>
|
||||
<h2 class="text-xl font-bold text-gray-800"><i class="ri-magic-line mr-2 text-orange-600"></i>智能添加参数</h2>
|
||||
<button onclick="closeSmartAddModal()" class="text-gray-400 hover:text-gray-600"><i class="ri-close-line text-2xl"></i></button>
|
||||
</div>
|
||||
<div class="p-6">
|
||||
@@ -297,18 +302,22 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="bg-orange-50 rounded-lg p-4 mb-4">
|
||||
<p class="text-sm text-orange-700"><i class="ri-information-line mr-1"></i>上传<strong>产品参数截图</strong>或<strong>参数文本</strong>,AI将根据类别字段配置自动解析参数。支持多次解析,每次来源都会被记录。</p>
|
||||
</div>
|
||||
|
||||
<div class="mb-6">
|
||||
<p class="text-sm text-gray-500 mb-3">上传产品图片,AI将根据类别参数字段配置自动识别并解析参数。支持一次上传多张图片,可识别多个产品。</p>
|
||||
<p class="text-sm text-gray-500 mb-3">上传参数截图(规格表、参数页面等),AI将识别并解析参数数据</p>
|
||||
<div class="flex flex-wrap gap-3 mb-3" id="smartImagePreviewArea">
|
||||
<!-- 图片预览区 -->
|
||||
</div>
|
||||
<div class="flex gap-3">
|
||||
<input type="file" id="smartImageInput" accept="image/*" multiple class="hidden" onchange="handleSmartImageUpload(event)">
|
||||
<button onclick="document.getElementById('smartImageInput').click()" class="px-4 py-2 bg-orange-100 text-orange-600 rounded-lg hover:bg-orange-200 text-sm">
|
||||
<i class="ri-image-add-line mr-1"></i>选择图片(支持多选)
|
||||
<i class="ri-image-add-line mr-1"></i>上传参数截图(支持多选)
|
||||
</button>
|
||||
<button onclick="pasteSmartImageFromClipboard()" 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>粘贴图片
|
||||
<i class="ri-clipboard-line mr-1"></i>粘贴截图
|
||||
</button>
|
||||
<button onclick="clearSmartImages()" class="px-4 py-2 bg-gray-100 text-gray-600 rounded-lg hover:bg-gray-200 text-sm">
|
||||
<i class="ri-delete-bin-line mr-1"></i>清空图片
|
||||
@@ -316,12 +325,12 @@
|
||||
</div>
|
||||
<div class="mt-3 text-xs text-gray-400">
|
||||
<i class="ri-information-line mr-1"></i>
|
||||
已选择 <span id="smartImageCount">0</span> 张图片
|
||||
已选择 <span id="smartImageCount">0</span> 张参数截图
|
||||
</div>
|
||||
</div>
|
||||
<div class="border-t pt-4">
|
||||
<label class="text-sm text-gray-600 mb-2 block">补充文本(可选)</label>
|
||||
<textarea id="smartAddText" rows="4" class="w-full p-4 border border-gray-200 rounded-lg focus:outline-none focus:border-orange-400 text-gray-700" placeholder="可粘贴补充信息文本,与图片一起解析..."></textarea>
|
||||
<label class="text-sm text-gray-600 mb-2 block">参数文本(可选,可粘贴产品规格说明)</label>
|
||||
<textarea id="smartAddText" rows="4" class="w-full p-4 border border-gray-200 rounded-lg focus:outline-none focus:border-orange-400 text-gray-700" placeholder="可粘贴产品参数文本、规格说明等..."></textarea>
|
||||
</div>
|
||||
<div id="smartAddPreview" class="mt-4 hidden">
|
||||
<h3 class="text-sm font-semibold text-gray-700 mb-2"><i class="ri-checkbox-circle-line text-green-600 mr-1"></i>解析结果预览:</h3>
|
||||
@@ -408,25 +417,25 @@
|
||||
<div id="smartUpdateModal" 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-magic-line mr-2 text-orange-600"></i>智能补充参数</h2>
|
||||
<h2 class="text-xl font-bold text-gray-800"><i class="ri-magic-line mr-2 text-orange-600"></i>补充解析参数</h2>
|
||||
<button onclick="closeSmartUpdateModal()" class="text-gray-400 hover:text-gray-600"><i class="ri-close-line text-2xl"></i></button>
|
||||
</div>
|
||||
<div class="p-6">
|
||||
<div class="bg-blue-50 rounded-lg p-4 mb-4">
|
||||
<p class="text-sm text-blue-700"><i class="ri-information-line mr-1"></i>上传图片或输入文本,AI将识别参数并补充到现有数据中。只会填充缺失的字段,不会覆盖已有值。</p>
|
||||
<p class="text-sm text-blue-700"><i class="ri-information-line mr-1"></i>上传<strong>参数截图</strong>或<strong>参数文本</strong>,AI将识别并补充缺失的参数字段。只会填充空白字段,不会覆盖已有数据。</p>
|
||||
</div>
|
||||
<div class="mb-6">
|
||||
<p class="text-sm text-gray-500 mb-3">上传产品图片,AI将自动识别并解析参数</p>
|
||||
<p class="text-sm text-gray-500 mb-3">上传产品参数截图(规格表、参数页面等),AI将识别并解析参数数据</p>
|
||||
<div class="flex flex-wrap gap-3 mb-3" id="smartUpdateImagePreviewArea">
|
||||
<!-- 图片预览区 -->
|
||||
</div>
|
||||
<div class="flex gap-3">
|
||||
<input type="file" id="smartUpdateImageInput" accept="image/*" multiple class="hidden" onchange="handleSmartUpdateImageUpload(event)">
|
||||
<button onclick="document.getElementById('smartUpdateImageInput').click()" class="px-4 py-2 bg-orange-100 text-orange-600 rounded-lg hover:bg-orange-200 text-sm">
|
||||
<i class="ri-image-add-line mr-1"></i>选择图片(支持多选)
|
||||
<i class="ri-image-add-line mr-1"></i>上传参数截图
|
||||
</button>
|
||||
<button onclick="pasteSmartUpdateImageFromClipboard()" 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>粘贴图片
|
||||
<i class="ri-clipboard-line mr-1"></i>粘贴截图
|
||||
</button>
|
||||
<button onclick="clearSmartUpdateImages()" class="px-4 py-2 bg-gray-100 text-gray-600 rounded-lg hover:bg-gray-200 text-sm">
|
||||
<i class="ri-delete-bin-line mr-1"></i>清空图片
|
||||
@@ -434,12 +443,12 @@
|
||||
</div>
|
||||
<div class="mt-3 text-xs text-gray-400">
|
||||
<i class="ri-information-line mr-1"></i>
|
||||
已选择 <span id="smartUpdateImageCount">0</span> 张图片
|
||||
已选择 <span id="smartUpdateImageCount">0</span> 张参数截图
|
||||
</div>
|
||||
</div>
|
||||
<div class="border-t pt-4">
|
||||
<label class="text-sm text-gray-600 mb-2 block">补充文本(可选)</label>
|
||||
<textarea id="smartUpdateText" rows="4" class="w-full p-4 border border-gray-200 rounded-lg focus:outline-none focus:border-orange-400 text-gray-700" placeholder="可粘贴补充信息文本,如产品规格表、参数说明等..."></textarea>
|
||||
<label class="text-sm text-gray-600 mb-2 block">参数文本(可选)</label>
|
||||
<textarea id="smartUpdateText" rows="4" class="w-full p-4 border border-gray-200 rounded-lg focus:outline-none focus:border-orange-400 text-gray-700" placeholder="可粘贴产品参数文本、规格说明等..."></textarea>
|
||||
</div>
|
||||
<div id="smartUpdatePreview" class="mt-4 hidden">
|
||||
<h3 class="text-sm font-semibold text-gray-700 mb-2"><i class="ri-checkbox-circle-line text-green-600 mr-1"></i>解析结果:</h3>
|
||||
@@ -1192,6 +1201,7 @@
|
||||
const forms = {category: getCategoryForm, model: getModelForm, gpu: getGpuForm, cpu: getCpuForm, knowledge: getKnowledgeForm};
|
||||
document.getElementById('modalContent').innerHTML = forms[type](currentData);
|
||||
showSmartUpdateButton(); // 显示智能补充按钮
|
||||
showParseSources(currentData); // 显示解析来源历史
|
||||
document.getElementById('editModal').classList.remove('hidden');
|
||||
}
|
||||
|
||||
@@ -1204,8 +1214,51 @@
|
||||
document.getElementById('modalTitle').textContent = '编辑数据';
|
||||
document.getElementById('modalContent').innerHTML = getDynamicForm(currentData);
|
||||
showSmartUpdateButton(); // 显示智能补充按钮
|
||||
showParseSources(currentData); // 显示解析来源历史
|
||||
document.getElementById('editModal').classList.remove('hidden');
|
||||
}
|
||||
|
||||
// 显示解析来源历史
|
||||
function showParseSources(data) {
|
||||
const sources = data.parse_sources || [];
|
||||
const area = document.getElementById('parseSourcesArea');
|
||||
const list = document.getElementById('parseSourcesList');
|
||||
|
||||
if (sources.length === 0) {
|
||||
area.classList.add('hidden');
|
||||
return;
|
||||
}
|
||||
|
||||
area.classList.remove('hidden');
|
||||
list.innerHTML = sources.map((source, idx) => {
|
||||
const typeLabel = source.type === 'smart_add' ? '智能添加' : '补充解析';
|
||||
const time = source.timestamp || '未知时间';
|
||||
const updatedFields = source.updated_fields || [];
|
||||
|
||||
let contentHtml = '';
|
||||
if (source.images && source.images.length > 0) {
|
||||
contentHtml += `<div class="flex gap-2 mb-2">${source.images.map(img =>
|
||||
`<img src="${img}" class="w-20 h-20 object-cover rounded border cursor-pointer hover:scale-105 transition" onclick="window.open('${img}', '_blank')">`
|
||||
).join('')}</div>`;
|
||||
}
|
||||
if (source.text) {
|
||||
contentHtml += `<div class="text-xs text-gray-500 bg-gray-50 p-2 rounded max-h-20 overflow-auto">${source.text}</div>`;
|
||||
}
|
||||
if (updatedFields.length > 0) {
|
||||
contentHtml += `<div class="text-xs text-green-600 mt-1">补充字段: ${updatedFields.join(', ')}</div>`;
|
||||
}
|
||||
|
||||
return `
|
||||
<div class="bg-gray-50 rounded-lg p-3">
|
||||
<div class="flex justify-between items-center mb-2">
|
||||
<span class="text-sm font-medium text-gray-700">#${idx + 1} ${typeLabel}</span>
|
||||
<span class="text-xs text-gray-400">${time}</span>
|
||||
</div>
|
||||
${contentHtml}
|
||||
</div>
|
||||
`;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
// 删除项
|
||||
async function deleteItem(type, id) {
|
||||
|
||||
Reference in New Issue
Block a user