Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e69f09842 | |||
| 2dd45854c1 | |||
| 72de68e1ff | |||
| 6844d73c9d | |||
| 40b04ae9c1 | |||
| c8d46f6f99 | |||
| f2bb5dd2e8 | |||
| a3448ed5fe | |||
| 1a65d408f7 | |||
| 643a934c83 | |||
| 151829296e | |||
| 2ef5d0b3d3 | |||
| 4b5e70a3bf | |||
| ea60d4b4c6 | |||
| e572fbb29b | |||
| 5273cf6f03 |
356
app.py
356
app.py
@@ -101,72 +101,61 @@ def save_data(file_path, data):
|
||||
|
||||
# ============ 大模型智能解析 ============
|
||||
|
||||
def parse_with_llm(text, category_type, images=None):
|
||||
def get_parse_prompt_template(category_type, category_id=None, subcategory_id=None):
|
||||
"""
|
||||
使用大模型解析文本/图片,提取结构化数据
|
||||
支持多张图片输入,可能解析出多个产品
|
||||
获取解析 prompt 模板(供前端显示和编辑)
|
||||
"""
|
||||
# 从类别配置中获取字段定义
|
||||
categories = load_data(CATEGORIES_FILE)
|
||||
|
||||
# 根据类型定义字段模板
|
||||
field_templates = {
|
||||
'model': {
|
||||
'name': '模型名称',
|
||||
'organization': '厂商/组织',
|
||||
'parameters': '参数量(数字,单位B)',
|
||||
'context_length': '上下文长度(数字)',
|
||||
'architecture': '架构类型',
|
||||
'is_open_source': '是否开源(true/false)',
|
||||
'mmlu': 'MMLU分数(数字)',
|
||||
'input_price': '输入价格(数字)',
|
||||
'output_price': '输出价格(数字)',
|
||||
'license': '许可证',
|
||||
'description': '简介描述',
|
||||
},
|
||||
'gpu': {
|
||||
'name': 'GPU名称',
|
||||
'manufacturer': '厂商',
|
||||
'architecture': '架构',
|
||||
'memory_gb': '显存大小(数字,单位GB)',
|
||||
'cuda_cores': 'CUDA核心数(数字)',
|
||||
'tensor_cores': 'Tensor核心数(数字)',
|
||||
'memory_bandwidth_gbs': '显存带宽(数字,单位GB/s)',
|
||||
'fp16_tflops': 'FP16性能(数字,单位TF)',
|
||||
'price_usd': '价格(数字)',
|
||||
'release_year': '发布年份(数字)',
|
||||
'description': '简介描述',
|
||||
},
|
||||
'cpu': {
|
||||
'name': 'CPU名称',
|
||||
'manufacturer': '厂商',
|
||||
'architecture': '架构',
|
||||
'cores': '核心数(数字)',
|
||||
'threads': '线程数(数字)',
|
||||
'base_clock_ghz': '基础频率(数字,单位GHz)',
|
||||
'boost_clock_ghz': '加速频率(数字,单位GHz)',
|
||||
'l3_cache_mb': 'L3缓存(数字,单位MB)',
|
||||
'tdp_watts': 'TDP功耗(数字,单位W)',
|
||||
'price_usd': '价格(数字)',
|
||||
'description': '简介描述',
|
||||
},
|
||||
'dynamic': {
|
||||
# 确定类别ID
|
||||
if category_id:
|
||||
cat = next((c for c in categories if c['id'] == category_id), None)
|
||||
else:
|
||||
type_to_cat_id = {'model': 'ai-models', 'gpu': 'gpus', 'cpu': 'cpus', 'dynamic': None}
|
||||
cat_id = type_to_cat_id.get(category_type)
|
||||
cat = next((c for c in categories if c['id'] == cat_id), None)
|
||||
|
||||
# 构建字段模板
|
||||
fields = {}
|
||||
|
||||
if cat and 'fields' in cat:
|
||||
for field in cat['fields']:
|
||||
field_desc = field['label']
|
||||
if field.get('input_style') == 'long':
|
||||
field_desc += '(长文本)'
|
||||
else:
|
||||
field_desc += '(文本)'
|
||||
if field.get('description'):
|
||||
field_desc += f" - {field['description']}"
|
||||
fields[field['key']] = field_desc
|
||||
|
||||
if subcategory_id:
|
||||
subcat = next((s for s in cat.get('subcategories', []) if s['id'] == subcategory_id), None)
|
||||
if subcat and 'extra_fields' in subcat:
|
||||
for field in subcat['extra_fields']:
|
||||
field_desc = field['label']
|
||||
if field.get('input_style') == 'long':
|
||||
field_desc += '(长文本)'
|
||||
else:
|
||||
field_desc += '(文本)'
|
||||
if field.get('description'):
|
||||
field_desc += f" - {field['description']}"
|
||||
fields[field['key']] = field_desc
|
||||
else:
|
||||
fields = {
|
||||
'name': '名称',
|
||||
'brand': '品牌',
|
||||
'price': '价格(数字)',
|
||||
'year': '年份(数字)',
|
||||
'specs': '规格参数',
|
||||
'specs': '规格参数(JSON对象)',
|
||||
'description': '简介描述',
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
fields = field_templates.get(category_type, field_templates['dynamic'])
|
||||
fields_json = json.dumps(fields, ensure_ascii=False, indent=2)
|
||||
|
||||
# 构建消息内容
|
||||
content_parts = []
|
||||
|
||||
# 如果有图片,添加图片内容
|
||||
if images and len(images) > 0:
|
||||
prompt_text = """请分析图片中的产品参数信息,提取结构化数据。
|
||||
# 图片解析 prompt
|
||||
image_prompt = """请分析图片中的产品参数信息,提取结构化数据。
|
||||
|
||||
需要提取的字段:
|
||||
""" + fields_json + """
|
||||
@@ -174,7 +163,99 @@ def parse_with_llm(text, category_type, images=None):
|
||||
重要要求:
|
||||
1. 图片中可能包含1个或多个产品,请识别所有产品
|
||||
2. 如果是多张图片,请综合分析所有图片内容
|
||||
3. 数字字段只返回数字,不带单位
|
||||
3. **提取数据时保留原始单位**:字段标签中如有单位标注(如($)、(GB)、(MHz)等),提取时请带上对应单位,保持数据完整性
|
||||
4. 如果某字段没有提及,返回null
|
||||
5. 返回格式:如果识别到多个产品,返回数组 [对象列表]; 如果只有一个产品,返回单个对象
|
||||
6. 只返回JSON数据,不要其他内容"""
|
||||
|
||||
return {
|
||||
'fields': fields,
|
||||
'fields_json': fields_json,
|
||||
'image_prompt': image_prompt,
|
||||
'category_name': cat.get('name', '') if cat else ''
|
||||
}
|
||||
|
||||
|
||||
def parse_with_llm(text, category_type, images=None, category_id=None, subcategory_id=None, custom_prompt=None):
|
||||
"""
|
||||
使用大模型解析文本/图片,提取结构化数据
|
||||
支持多张图片输入,可能解析出多个产品
|
||||
根据类别配置的参数字段进行解析
|
||||
支持自定义 prompt(优先使用自定义)
|
||||
"""
|
||||
|
||||
# 从类别配置中获取字段定义
|
||||
categories = load_data(CATEGORIES_FILE)
|
||||
|
||||
# 确定类别ID
|
||||
if category_id:
|
||||
cat = next((c for c in categories if c['id'] == category_id), None)
|
||||
else:
|
||||
# 根据类型映射到内置类别ID
|
||||
type_to_cat_id = {'model': 'ai-models', 'gpu': 'gpus', 'cpu': 'cpus'}
|
||||
cat_id = type_to_cat_id.get(category_type)
|
||||
cat = next((c for c in categories if c['id'] == cat_id), None)
|
||||
|
||||
# 构建字段模板
|
||||
fields = {}
|
||||
|
||||
if cat and 'fields' in cat:
|
||||
# 使用类别配置的字段
|
||||
for field in cat['fields']:
|
||||
field_desc = field['label']
|
||||
# 所有字段都是文本类型
|
||||
if field.get('input_style') == 'long':
|
||||
field_desc += '(长文本)'
|
||||
else:
|
||||
field_desc += '(文本)'
|
||||
if field.get('description'):
|
||||
field_desc += f" - {field['description']}"
|
||||
fields[field['key']] = field_desc
|
||||
|
||||
# 如果有子类别,添加子类别的额外字段
|
||||
if subcategory_id:
|
||||
subcat = next((s for s in cat.get('subcategories', []) if s['id'] == subcategory_id), None)
|
||||
if subcat and 'extra_fields' in subcat:
|
||||
for field in subcat['extra_fields']:
|
||||
field_desc = field['label']
|
||||
if field.get('input_style') == 'long':
|
||||
field_desc += '(长文本)'
|
||||
else:
|
||||
field_desc += '(文本)'
|
||||
if field.get('description'):
|
||||
field_desc += f" - {field['description']}"
|
||||
fields[field['key']] = field_desc
|
||||
else:
|
||||
# 兜底:使用默认字段模板
|
||||
fields = {
|
||||
'name': '名称',
|
||||
'brand': '品牌',
|
||||
'price': '价格(数字)',
|
||||
'year': '年份(数字)',
|
||||
'specs': '规格参数(JSON对象)',
|
||||
'description': '简介描述',
|
||||
}
|
||||
|
||||
fields_json = json.dumps(fields, ensure_ascii=False, indent=2)
|
||||
|
||||
# 构建消息内容
|
||||
content_parts = []
|
||||
|
||||
# 如果有图片,添加图片内容
|
||||
if images and len(images) > 0:
|
||||
# 优先使用自定义 prompt,否则使用默认
|
||||
if custom_prompt and custom_prompt.strip():
|
||||
prompt_text = custom_prompt
|
||||
else:
|
||||
prompt_text = """请分析图片中的产品参数信息,提取结构化数据。
|
||||
|
||||
需要提取的字段:
|
||||
""" + fields_json + """
|
||||
|
||||
重要要求:
|
||||
1. 图片中可能包含1个或多个产品,请识别所有产品
|
||||
2. 如果是多张图片,请综合分析所有图片内容
|
||||
3. **提取数据时保留原始单位**:字段标签中如有单位标注(如($)、(GB)、(MHz)等),提取时请带上对应单位,保持数据完整性
|
||||
4. 如果某字段没有提及,返回null
|
||||
5. 返回格式:如果识别到多个产品,返回数组 [对象列表]; 如果只有一个产品,返回单个对象
|
||||
6. 只返回JSON数据,不要其他内容"""
|
||||
@@ -226,7 +307,7 @@ def parse_with_llm(text, category_type, images=None):
|
||||
|
||||
要求:
|
||||
1. 根据文本内容智能提取各个字段的值
|
||||
2. 数字字段只返回数字,不带单位
|
||||
2. **提取数据时保留原始单位**:字段标签中如有单位标注(如($)、(GB)、(MHz)等),提取时请带上对应单位,保持数据完整性
|
||||
3. 如果某字段在文本中没有提及,返回null
|
||||
4. 返回JSON格式,不要包含任何其他内容
|
||||
|
||||
@@ -491,6 +572,25 @@ def api_toggle_model_visible(model_id):
|
||||
|
||||
return jsonify({'success': True, 'visible': model['visible']})
|
||||
|
||||
# ============ 获取解析Prompt模板API ============
|
||||
|
||||
@app.route('/api/parse-prompt', methods=['POST'])
|
||||
def api_get_parse_prompt():
|
||||
"""
|
||||
获取智能解析的 prompt 模板(供前端显示和编辑)
|
||||
"""
|
||||
data = request.get_json()
|
||||
category_type = data.get('category_type', 'dynamic')
|
||||
category_id = data.get('category_id')
|
||||
subcategory_id = data.get('subcategory_id')
|
||||
|
||||
template = get_parse_prompt_template(category_type, category_id, subcategory_id)
|
||||
|
||||
return jsonify({
|
||||
'success': True,
|
||||
'template': template
|
||||
})
|
||||
|
||||
# ============ 图片解析API(预览) ============
|
||||
|
||||
@app.route('/api/parse-images', methods=['POST'])
|
||||
@@ -498,11 +598,15 @@ def api_parse_images():
|
||||
"""
|
||||
解析图片中的产品参数(预览模式,不保存)
|
||||
支持多张图片,可能返回多个产品
|
||||
根据类别配置的参数字段进行解析
|
||||
支持自定义 prompt(可选)
|
||||
"""
|
||||
data = request.get_json()
|
||||
text = data.get('text', '')
|
||||
images = data.get('images', [])
|
||||
category_type = data.get('category_type', 'dynamic')
|
||||
subcategory_id = data.get('subcategory_id', '')
|
||||
custom_prompt = data.get('custom_prompt', '') # 自定义 prompt
|
||||
|
||||
if not text and not images:
|
||||
return jsonify({'error': '文本或图片不能都为空'}), 400
|
||||
@@ -510,8 +614,12 @@ def api_parse_images():
|
||||
if not images:
|
||||
return jsonify({'error': '请上传至少一张图片'}), 400
|
||||
|
||||
# 调用大模型解析
|
||||
parsed_list = parse_with_llm(text, category_type, images)
|
||||
# 确定类别ID
|
||||
type_to_cat_id = {'model': 'ai-models', 'gpu': 'gpus', 'cpu': 'cpus', 'dynamic': None}
|
||||
category_id = type_to_cat_id.get(category_type)
|
||||
|
||||
# 调用大模型解析(根据类别字段配置,支持自定义 prompt)
|
||||
parsed_list = parse_with_llm(text, category_type, images, category_id=category_id, subcategory_id=subcategory_id, custom_prompt=custom_prompt)
|
||||
|
||||
return jsonify({
|
||||
'success': True,
|
||||
@@ -558,10 +666,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)
|
||||
|
||||
@@ -597,10 +713,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)
|
||||
|
||||
@@ -636,10 +759,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)
|
||||
|
||||
@@ -676,10 +806,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)
|
||||
|
||||
@@ -691,34 +828,44 @@ def api_smart_add_model():
|
||||
data = request.get_json()
|
||||
text = data.get('text', '')
|
||||
images = data.get('images', [])
|
||||
subcategory_id = data.get('subcategory_id', '') # 子类别ID
|
||||
custom_prompt = data.get('custom_prompt', '') # 自定义 prompt
|
||||
|
||||
if not text and not images:
|
||||
return jsonify({'error': '文本或图片不能都为空'}), 400
|
||||
|
||||
# 大模型解析(支持多图)
|
||||
parsed_list = parse_with_llm(text, 'model', images)
|
||||
# 大模型解析(根据类别字段配置,支持自定义 prompt)
|
||||
parsed_list = parse_with_llm(text, 'model', images, category_id='ai-models', subcategory_id=subcategory_id, custom_prompt=custom_prompt)
|
||||
|
||||
# 处理多个产品
|
||||
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)
|
||||
|
||||
save_data(MODELS_FILE, models)
|
||||
|
||||
# 返回添加的产品列表
|
||||
return jsonify({'success': True, 'count': len(results), 'products': results})
|
||||
|
||||
@app.route('/api/gpus/smart-add', methods=['POST'])
|
||||
@@ -727,24 +874,34 @@ def api_smart_add_gpu():
|
||||
data = request.get_json()
|
||||
text = data.get('text', '')
|
||||
images = data.get('images', [])
|
||||
subcategory_id = data.get('subcategory_id', '')
|
||||
custom_prompt = data.get('custom_prompt', '') # 自定义 prompt
|
||||
|
||||
if not text and not images:
|
||||
return jsonify({'error': '文本或图片不能都为空'}), 400
|
||||
|
||||
parsed_list = parse_with_llm(text, 'gpu', images)
|
||||
parsed_list = parse_with_llm(text, 'gpu', images, category_id='gpus', subcategory_id=subcategory_id, custom_prompt=custom_prompt)
|
||||
|
||||
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)
|
||||
@@ -759,24 +916,34 @@ def api_smart_add_cpu():
|
||||
data = request.get_json()
|
||||
text = data.get('text', '')
|
||||
images = data.get('images', [])
|
||||
subcategory_id = data.get('subcategory_id', '')
|
||||
custom_prompt = data.get('custom_prompt', '') # 自定义 prompt
|
||||
|
||||
if not text and not images:
|
||||
return jsonify({'error': '文本或图片不能都为空'}), 400
|
||||
|
||||
parsed_list = parse_with_llm(text, 'cpu', images)
|
||||
parsed_list = parse_with_llm(text, 'cpu', images, category_id='cpus', subcategory_id=subcategory_id, custom_prompt=custom_prompt)
|
||||
|
||||
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)
|
||||
@@ -791,26 +958,37 @@ def api_smart_add_item(category_id):
|
||||
data = request.get_json()
|
||||
text = data.get('text', '')
|
||||
images = data.get('images', [])
|
||||
subcategory_id = data.get('subcategory_id', '')
|
||||
custom_prompt = data.get('custom_prompt', '') # 自定义 prompt
|
||||
|
||||
if not text and not images:
|
||||
return jsonify({'error': '文本或图片不能都为空'}), 400
|
||||
|
||||
parsed_list = parse_with_llm(text, 'dynamic', images)
|
||||
# 使用类别配置的字段解析,支持自定义 prompt
|
||||
parsed_list = parse_with_llm(text, 'dynamic', images, category_id=category_id, subcategory_id=subcategory_id, custom_prompt=custom_prompt)
|
||||
|
||||
results = []
|
||||
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)
|
||||
|
||||
1098
data/categories.json
1098
data/categories.json
File diff suppressed because it is too large
Load Diff
@@ -11,9 +11,9 @@
|
||||
"l3_cache_mb": 384,
|
||||
"tdp_watts": 360,
|
||||
"price_usd": 11000,
|
||||
"release_year": 2022,
|
||||
"description": "AMD顶级服务器CPU,96核心",
|
||||
"subcategory_id": "server"
|
||||
"subcategory_id": "server",
|
||||
"publish_date": "2022-01-01"
|
||||
},
|
||||
{
|
||||
"id": "epyc9554",
|
||||
@@ -27,9 +27,9 @@
|
||||
"l3_cache_mb": 256,
|
||||
"tdp_watts": 360,
|
||||
"price_usd": 6800,
|
||||
"release_year": 2022,
|
||||
"description": "64核心高性能服务器CPU",
|
||||
"subcategory_id": "server"
|
||||
"subcategory_id": "server",
|
||||
"publish_date": "2022-01-01"
|
||||
},
|
||||
{
|
||||
"id": "epyc9454",
|
||||
@@ -43,9 +43,9 @@
|
||||
"l3_cache_mb": 192,
|
||||
"tdp_watts": 290,
|
||||
"price_usd": 4100,
|
||||
"release_year": 2022,
|
||||
"description": "48核心服务器CPU",
|
||||
"subcategory_id": "server"
|
||||
"subcategory_id": "server",
|
||||
"publish_date": "2022-01-01"
|
||||
},
|
||||
{
|
||||
"id": "xeonw9359x",
|
||||
@@ -59,9 +59,9 @@
|
||||
"l3_cache_mb": 105,
|
||||
"tdp_watts": 350,
|
||||
"price_usd": 6200,
|
||||
"release_year": 2023,
|
||||
"description": "Intel顶级工作站CPU",
|
||||
"subcategory_id": "server"
|
||||
"subcategory_id": "server",
|
||||
"publish_date": "2023-01-01"
|
||||
},
|
||||
{
|
||||
"id": "xeonw5345",
|
||||
@@ -75,9 +75,9 @@
|
||||
"l3_cache_mb": 45,
|
||||
"tdp_watts": 230,
|
||||
"price_usd": 950,
|
||||
"release_year": 2023,
|
||||
"description": "中端工作站CPU",
|
||||
"subcategory_id": "server"
|
||||
"subcategory_id": "server",
|
||||
"publish_date": "2023-01-01"
|
||||
},
|
||||
{
|
||||
"id": "ryzen97950x",
|
||||
@@ -91,9 +91,9 @@
|
||||
"l3_cache_mb": 64,
|
||||
"tdp_watts": 170,
|
||||
"price_usd": 550,
|
||||
"release_year": 2022,
|
||||
"description": "顶级消费级CPU,适合AI开发",
|
||||
"subcategory_id": "desktop"
|
||||
"subcategory_id": "desktop",
|
||||
"publish_date": "2022-01-01"
|
||||
},
|
||||
{
|
||||
"id": "ryzen97950x3d",
|
||||
@@ -107,9 +107,9 @@
|
||||
"l3_cache_mb": 144,
|
||||
"tdp_watts": 120,
|
||||
"price_usd": 700,
|
||||
"release_year": 2023,
|
||||
"description": "带3D V-Cache,游戏性能更强",
|
||||
"subcategory_id": "mobile"
|
||||
"subcategory_id": "mobile",
|
||||
"publish_date": "2023-01-01"
|
||||
},
|
||||
{
|
||||
"id": "intel14900k",
|
||||
@@ -123,9 +123,9 @@
|
||||
"l3_cache_mb": 36,
|
||||
"tdp_watts": 125,
|
||||
"price_usd": 580,
|
||||
"release_year": 2023,
|
||||
"description": "Intel顶级消费级CPU",
|
||||
"subcategory_id": "desktop"
|
||||
"subcategory_id": "desktop",
|
||||
"publish_date": "2023-01-01"
|
||||
},
|
||||
{
|
||||
"name": "AMD 锐龙 AI 9 H 365",
|
||||
@@ -142,7 +142,7 @@
|
||||
"created_at": "2026-04-20 23:19:20",
|
||||
"visible": true,
|
||||
"raw_text": "AMD 锐龙 AI 9 H 365\nAMD 锐龙 AI 处理器助力打造卓越 AI PC\n\n \n全部折叠\n一般规格\n名称\nAMD 锐龙 AI 9 H 365\n产品系列\n锐龙\n系列\n锐龙 AI 300 系列\n外形规格\n笔记本电脑 , 台式机\nAMD PRO 技术\n否\n区域供货状况\n中国\n原代号\nStrix Point\n处理器架构\n4x Zen 5 , 6x Zen 5c\nCPU 核心数\n10\n多线程 (SMT)\n是\n线程数\n20\n最高加速时钟频率 \n最高可达 5 GHz\nMax Zen5c Clock \n最高可达 3.3 GHz\n基准时钟频率 \n2 GHz\nZen5 Base Clock\n2 GHz\nZen5c Base Clock\n2 GHz\nL2 高速缓存\n10 MB\nL3 高速缓存\n24 MB\n默认热设计功耗 (TDP)\n28W\nAMD 可配置热设计功耗 (cTDP)\n15-54W\nCPU 核心的处理器工艺\nTSMC 4nm FinFET\n封装芯片计数\n1\nAMD EXPO™ 内存超频技术\n是\n精准频率提升 (PBO)\n是\n曲线优化器电压偏移\n是\nCPU 平台\nFP8\n支持的扩展\nAES , AMD-V , AVX , AVX2 , AVX512 , FMA3 , MMX-plus , SHA , SSE , SSE2 , SSE3 , SSE4.1 , SSE4.2 , SSE4A , SSSE3 , x86-64\n最高工作温度 (Tjmax)\n100°C\n*支持的操作系统\nWindows 11 - 64-Bit Edition , RHEL x86 64-Bit , Ubuntu x86 64-Bit\n连接\nNative USB 4 (40Gbps)\n2\nNative USB 3.2 Gen 2 (10Gbps)\n2\nNative USB 2.0 (480Mbps)\n4\nPCI Express® Version\nPCIe® 4.0\n原生 PCIe® 通道 (总共/可用)\n16 , 16\nNVMe 支持\nBoot , RAID0 , RAID1\n系统内存类型\nDDR5 (FP8) , LPDDR5X (FP8)\n内存通道数\n2\n最大内存\n256 GB\n最高内存速度\n2x2R\tDDR5-5600, LPDDR5x-8000\n支持 ECC\n否\n显卡功能\n显卡型号\nAMD Radeon™ 880M\n显卡核心数\n12\n显卡频率\n2900 MHz\nDirectX® 版本\n12\nDisplayPort™ 版本\n2.1\nDisplayPort 扩展功能\nAdaptive-Sync , HDR Metadata , UHBR10\nDisplayPort 最高刷新率 (SDR)\n7680x4320 @ 60Hz , 3840x2160 @ 240Hz , 3440x1440 @ 360Hz , 2560x1440 @ 480Hz , 1920x1080 @ 600Hz\nDisplayPort 最高刷新率 (HDR)\n7680x4320 @ 60Hz , 3840x2160 @ 240Hz , 3440x1440 @ 360Hz , 2560x1440 @ 480Hz , 1920x1080 @ 600Hz\nHDMI® 版本\n2.1\n支持的 HDCP 版本\n2.3\nUSB Type-C® DisplayPort™ 备用模式\n是\n支持多个显示器\n是\n显示器个数上限\n4\nAMD FreeSync™\n是\n无线显示\nMiracast\n最大视频编码带宽 (SDR)\n1080p630 8bpc H.264, 1440p373 8bpc H.264, 2160p175 8bpc H.264, 1080p630 8bpc H.265, 1440p373 8bpc H.265, 2160p175 8bpc H.265, 4320p43 8bpc H.265, 1080p864 8/10bpc AV1, 1440p513 8/10bpc AV1, 2160p240 8/10bpc AV1, 4320p60 8/10bpc AV1\n\n最大视频解码带宽\n1080p60 8bpc MPEG2, 1080p60 8bpc VC1, 1080p786 8/10bpc VP9, 2160p196 8/10bpc VP9, 4320p49 8/10bpc VP9, 1080p1200 8bpc H.264, 2160p300 8bpc H.264, 4320p75 8bpc H.264, 1080p786 8/10bpc H.265, 2160p196 8/10bpc H.265, 4320p49 8/10bpc H.265, 1080p960 8/10bpc\n\nAMD SmartShift MAX\n是\nAMD 显存智取技术\n支持\nAI 引擎性能\nAMD Ryzen™ AI\n支持\nOverall TOPS\n最高可达 73 TOPS\nNPU TOPS\n最高可达 50 TOPS\n产品 ID\nTray 产品 ID\n100-000001530 (FP8)\n安全\nAMD 增强病毒防护 (NX bit)\n是",
|
||||
"publish_date": "",
|
||||
"publish_date": "2022-01-01",
|
||||
"views": 0,
|
||||
"is_pinned": false,
|
||||
"subcategory_id": "mobile"
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
"fp16_tflops": 1979,
|
||||
"int8_perf_tops": 3958,
|
||||
"price_usd": 30000,
|
||||
"release_year": 2022,
|
||||
"description": "数据中心顶级GPU,专为AI训练设计",
|
||||
"subcategory_id": "datacenter"
|
||||
"subcategory_id": "datacenter",
|
||||
"publish_date": "2022-01-01"
|
||||
},
|
||||
{
|
||||
"id": "a100",
|
||||
@@ -29,9 +29,9 @@
|
||||
"fp16_tflops": 312,
|
||||
"int8_perf_tops": 624,
|
||||
"price_usd": 10000,
|
||||
"release_year": 2020,
|
||||
"description": "数据中心主力GPU,AI训练推理通用",
|
||||
"subcategory_id": "datacenter"
|
||||
"subcategory_id": "datacenter",
|
||||
"publish_date": "2020-01-01"
|
||||
},
|
||||
{
|
||||
"id": "a10040g",
|
||||
@@ -46,9 +46,9 @@
|
||||
"fp16_tflops": 312,
|
||||
"int8_perf_tops": 624,
|
||||
"price_usd": 6000,
|
||||
"release_year": 2020,
|
||||
"description": "A100 40GB版本,性价比更高",
|
||||
"subcategory_id": "datacenter"
|
||||
"subcategory_id": "datacenter",
|
||||
"publish_date": "2020-01-01"
|
||||
},
|
||||
{
|
||||
"id": "l40s",
|
||||
@@ -63,9 +63,9 @@
|
||||
"fp16_tflops": 362,
|
||||
"int8_perf_tops": 724,
|
||||
"price_usd": 7000,
|
||||
"release_year": 2023,
|
||||
"description": "新一代数据中心GPU,推理优化",
|
||||
"subcategory_id": "datacenter"
|
||||
"subcategory_id": "datacenter",
|
||||
"publish_date": "2023-01-01"
|
||||
},
|
||||
{
|
||||
"id": "rtx4090",
|
||||
@@ -80,9 +80,9 @@
|
||||
"fp16_tflops": 330,
|
||||
"int8_perf_tops": 660,
|
||||
"price_usd": 1600,
|
||||
"release_year": 2022,
|
||||
"description": "消费级最强GPU,适合个人AI开发",
|
||||
"subcategory_id": "gaming"
|
||||
"subcategory_id": "gaming",
|
||||
"publish_date": "2022-01-01"
|
||||
},
|
||||
{
|
||||
"id": "rtx4090d",
|
||||
@@ -97,9 +97,9 @@
|
||||
"fp16_tflops": 294,
|
||||
"int8_perf_tops": 588,
|
||||
"price_usd": 1400,
|
||||
"release_year": 2024,
|
||||
"description": "4090中国特供版,性能略降",
|
||||
"subcategory_id": "gaming"
|
||||
"subcategory_id": "gaming",
|
||||
"publish_date": "2024-01-01"
|
||||
},
|
||||
{
|
||||
"id": "rtx3090",
|
||||
@@ -114,9 +114,9 @@
|
||||
"fp16_tflops": 142,
|
||||
"int8_perf_tops": 284,
|
||||
"price_usd": 1200,
|
||||
"release_year": 2020,
|
||||
"description": "上一代旗舰,性价比高",
|
||||
"subcategory_id": "gaming"
|
||||
"subcategory_id": "gaming",
|
||||
"publish_date": "2020-01-01"
|
||||
},
|
||||
{
|
||||
"id": "rtx3080",
|
||||
@@ -131,9 +131,9 @@
|
||||
"fp16_tflops": 119,
|
||||
"int8_perf_tops": 238,
|
||||
"price_usd": 700,
|
||||
"release_year": 2020,
|
||||
"description": "中高端消费级GPU",
|
||||
"subcategory_id": "gaming"
|
||||
"subcategory_id": "gaming",
|
||||
"publish_date": "2020-01-01"
|
||||
},
|
||||
{
|
||||
"id": "v100",
|
||||
@@ -148,9 +148,9 @@
|
||||
"fp16_tflops": 118,
|
||||
"int8_perf_tops": 236,
|
||||
"price_usd": 4000,
|
||||
"release_year": 2017,
|
||||
"description": "上一代数据中心GPU,仍有价值",
|
||||
"subcategory_id": "datacenter"
|
||||
"subcategory_id": "datacenter",
|
||||
"publish_date": "2017-01-01"
|
||||
},
|
||||
{
|
||||
"id": "mi300x",
|
||||
@@ -165,9 +165,9 @@
|
||||
"fp16_tflops": 1307,
|
||||
"int8_perf_tops": 2614,
|
||||
"price_usd": 15000,
|
||||
"release_year": 2023,
|
||||
"description": "AMD最强AI GPU,192GB显存",
|
||||
"subcategory_id": "datacenter"
|
||||
"subcategory_id": "datacenter",
|
||||
"publish_date": "2023-01-01"
|
||||
},
|
||||
{
|
||||
"name": "RTX 6000D",
|
||||
@@ -184,7 +184,8 @@
|
||||
"updated_at": "2026-04-28 11:56:48",
|
||||
"subcategory_id": "professional",
|
||||
"views": 0,
|
||||
"images": []
|
||||
"images": [],
|
||||
"publish_date": "2024-01-01"
|
||||
},
|
||||
{
|
||||
"name": "RTX PRO 6000",
|
||||
@@ -202,6 +203,7 @@
|
||||
"manufacturer": "NVIDIA",
|
||||
"subcategory_id": "professional",
|
||||
"views": 0,
|
||||
"images": []
|
||||
"images": [],
|
||||
"publish_date": "2020-01-01"
|
||||
}
|
||||
]
|
||||
@@ -10,7 +10,8 @@
|
||||
"subcategory_id": "suv",
|
||||
"views": 0,
|
||||
"images": [],
|
||||
"updated_at": "2026-04-28 12:32:13"
|
||||
"updated_at": "2026-04-28 12:32:13",
|
||||
"publish_date": "2021-01-01"
|
||||
},
|
||||
{
|
||||
"name": "秦PLUS",
|
||||
@@ -34,6 +35,7 @@
|
||||
"created_at": "2026-04-11 02:03:45",
|
||||
"visible": true,
|
||||
"raw_text": "秦PLUS的外观设计极具现代感和运动气息,前脸采用了家族化设计语言,标志性的大尺寸进气格栅占据了前脸的大部分空间,搭配锐利的LED大灯组,营造出强烈的视觉冲击力。车身线条流畅,腰线从车头贯穿至车尾,增强了整车的运动感。车尾部分,简洁大方的设计与前脸相呼应,整体风格时尚而不失稳重。\n\n上海:秦PLUS优惠促销,最新报价5.98万!轻松开新车\n\n秦PLUS拥有4780*1837*1515mm的长宽高尺寸和2718mm的轴距,赋予其宽敞的内部空间。车侧线条流畅且动感十足,从前轮距1580mm到后轮距1590mm,车轮布局合理,增强了车辆的稳定性和操控性。配备的225/60 R16轮胎规格,匹配独特风格的轮圈,为车辆增添了一抹动感与时尚的气息。\n\n上海:秦PLUS优惠促销,最新报价5.98万!轻松开新车\n\n秦PLUS的内饰风格简洁大气,给人以科技感和舒适感。中控台布局合理,配备了10.1英寸的中控屏幕,支持语音识别控制系统,可轻松操作多媒体系统、导航、电话和空调等功能。方向盘采用皮质材料,手感舒适,支持手动上下和前后调节,方便驾驶员调整到最佳驾驶姿势。座椅采用仿皮材质,主驾驶座椅具备前后调节、靠背调节和高低调节功能,而副驾驶座椅则支持前后调节和靠背调节,确保了乘客的舒适度。后排座椅可以按比例放倒,增加储物空间,同时,车内还配备了USB和Type-C接口,方便乘客为电子设备充电。\n\n上海:秦PLUS优惠促销,最新报价5.98万!轻松开新车\n\n秦PLUS搭载了一台1.5L 101马力的L4发动机,最大功率为74kW,最大扭矩为126N·m。与之匹配的是E-CVT无级变速器,这使得车辆在提供平稳的动力输出的同时,还能有效降低油耗。\n\n汽车之家车主@天艺风云 表示,外观设计是他当初选择秦PLUS的原因之一。他赞赏整体造型时尚大气,龙脸设计搭配犀利的大灯,辨识度极高。车身线条流畅,溜背式造型增添了几分运动感。全新的“龙鳞辉熠”格栅,精致又霸气,每次停车都有人问这是什么车,外观确实很吸引人。",
|
||||
"subcategory_id": "sedan"
|
||||
"subcategory_id": "sedan",
|
||||
"publish_date": "2023-01-01"
|
||||
}
|
||||
]
|
||||
@@ -10,7 +10,7 @@
|
||||
"visible": true,
|
||||
"raw_text": "",
|
||||
"images": [],
|
||||
"publish_date": "",
|
||||
"publish_date": "2023-01-01",
|
||||
"views": 0,
|
||||
"is_pinned": false,
|
||||
"subcategory_id": "90ce312b560d",
|
||||
@@ -27,7 +27,7 @@
|
||||
"visible": true,
|
||||
"raw_text": "",
|
||||
"images": [],
|
||||
"publish_date": "",
|
||||
"publish_date": "2023-01-01",
|
||||
"views": 0,
|
||||
"is_pinned": false,
|
||||
"subcategory_id": "90ce312b560d",
|
||||
@@ -44,10 +44,40 @@
|
||||
"visible": true,
|
||||
"raw_text": "",
|
||||
"images": [],
|
||||
"publish_date": "",
|
||||
"publish_date": "2023-01-01",
|
||||
"views": 0,
|
||||
"is_pinned": false,
|
||||
"subcategory_id": "90ce312b560d",
|
||||
"updated_at": "2026-04-28 12:32:50"
|
||||
},
|
||||
{
|
||||
"name": "EOS R7",
|
||||
"brand": "佳能 (Canon)",
|
||||
"year": 2022,
|
||||
"specs": "{\n \"RAW照片输出\": \"14bit\",\n \"上市时间\": \"2022-06\",\n \"传感器尺寸\": \"APS-C\",\n \"传感器类型\": \"CMOS\",\n \"像素\": \"3000-4000万\",\n \"功能\": \"Wi-Fi 4K视频 5轴防抖 高速连拍 翻转自拍\",\n \"取景器类型\": \"电子取景器\",\n \"品牌\": \"佳能 (Canon)\",\n \"商品编号\": \"10090975539899\",\n \"型号\": \"EOS R7\",\n \"外接电源\": \"支持外接电源\",\n \"存储介质\": \"SD卡 SDHC卡 SDXC卡\",\n \"店铺\": \"佳能 (Canon) 数码旗舰店\",\n \"接口\": \"Wi-Fi 蓝牙 HDMI\",\n \"最大光圈\": \"F3.5\",\n \"有效像素\": \"3250万\",\n \"标准ISO感光度\": \"ISO 100-32000\",\n \"液晶屏像素\": \"162万\",\n \"液晶屏尺寸\": \"3.2英寸\",\n \"液晶屏类型\": \"侧翻屏 旋转屏\",\n \"滤镜直径\": \"55mm\",\n \"焦点数量\": \"5915个\",\n \"电池类型\": \"锂离子电池\",\n \"类型\": \"机身\",\n \"视频拍摄能力\": \"4K 60P\",\n \"视频采样\": \"4:2:2\",\n \"连拍速度\": \"电子最高约30张/秒,机械最高约15张/秒\",\n \"适用对象\": \"入门级\",\n \"镜头卡口\": \"佳能RF卡口\",\n \"高清摄像\": \"4K超高清视频\"\n}",
|
||||
"description": "入门级机身",
|
||||
"id": "c8c3f124b2ce",
|
||||
"category_id": "71fa2b4d818f",
|
||||
"created_at": "2026-04-28 16:38:03",
|
||||
"visible": true,
|
||||
"raw_text": "",
|
||||
"images": [],
|
||||
"publish_date": "2022-06-01",
|
||||
"views": 0,
|
||||
"is_pinned": false,
|
||||
"updated_at": "2026-04-29 00:24:06",
|
||||
"parse_sources": [
|
||||
{
|
||||
"type": "smart_update",
|
||||
"timestamp": "2026-04-28 23:32:40",
|
||||
"images": [
|
||||
"/static/uploads/deca243eff98_1777390343.png"
|
||||
],
|
||||
"text": "",
|
||||
"updated_fields": []
|
||||
}
|
||||
],
|
||||
"subcategory_id": "dslr",
|
||||
"megapixels": "3000"
|
||||
}
|
||||
]
|
||||
81
data/items_phones.json
Normal file
81
data/items_phones.json
Normal file
@@ -0,0 +1,81 @@
|
||||
[
|
||||
{
|
||||
"name": "华为Pura X Max",
|
||||
"brand": "华为",
|
||||
"processor": "麒麟9030 Pro",
|
||||
"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日上市。\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,
|
||||
"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"
|
||||
}
|
||||
]
|
||||
@@ -18,7 +18,8 @@
|
||||
"raw_text": "\nGPT-4 Turbo version with 128K context length, price is $10 per 1M input tokens",
|
||||
"subcategory_id": "chat",
|
||||
"views": 0,
|
||||
"images": []
|
||||
"images": [],
|
||||
"publish_date": "2023-03-14"
|
||||
},
|
||||
{
|
||||
"id": "gpt4turbo",
|
||||
@@ -35,7 +36,8 @@
|
||||
"license": "Proprietary",
|
||||
"description": "GPT-4增强版,128K上下文",
|
||||
"created_at": "2024-01-01",
|
||||
"subcategory_id": "chat"
|
||||
"subcategory_id": "chat",
|
||||
"publish_date": "2023-11-06"
|
||||
},
|
||||
{
|
||||
"id": "gpt35",
|
||||
@@ -52,7 +54,8 @@
|
||||
"license": "Proprietary",
|
||||
"description": "性价比高的通用模型",
|
||||
"created_at": "2024-01-01",
|
||||
"subcategory_id": "chat"
|
||||
"subcategory_id": "chat",
|
||||
"publish_date": "2023-03-01"
|
||||
},
|
||||
{
|
||||
"id": "claude3opus",
|
||||
@@ -69,7 +72,8 @@
|
||||
"license": "Proprietary",
|
||||
"description": "Anthropic最强模型,200K上下文",
|
||||
"created_at": "2024-01-01",
|
||||
"subcategory_id": "code"
|
||||
"subcategory_id": "code",
|
||||
"publish_date": "2024-03-04"
|
||||
},
|
||||
{
|
||||
"id": "claude3sonnet",
|
||||
@@ -86,7 +90,8 @@
|
||||
"license": "Proprietary",
|
||||
"description": "平衡性能与成本",
|
||||
"created_at": "2024-01-01",
|
||||
"subcategory_id": "chat"
|
||||
"subcategory_id": "chat",
|
||||
"publish_date": "2024-03-04"
|
||||
},
|
||||
{
|
||||
"id": "llama270b",
|
||||
@@ -103,7 +108,8 @@
|
||||
"license": "Llama 2 Community",
|
||||
"description": "Meta开源大模型,70B参数",
|
||||
"created_at": "2024-01-01",
|
||||
"subcategory_id": "chat"
|
||||
"subcategory_id": "chat",
|
||||
"publish_date": "2023-07-18"
|
||||
},
|
||||
{
|
||||
"id": "llama3",
|
||||
@@ -120,7 +126,8 @@
|
||||
"license": "Llama 3 Community",
|
||||
"description": "Meta最新开源模型,性能接近GPT-4",
|
||||
"created_at": "2024-01-01",
|
||||
"subcategory_id": "code"
|
||||
"subcategory_id": "code",
|
||||
"publish_date": "2024-04-18"
|
||||
},
|
||||
{
|
||||
"id": "mistral7b",
|
||||
@@ -137,7 +144,8 @@
|
||||
"license": "Apache 2.0",
|
||||
"description": "小巧高效的开源模型",
|
||||
"created_at": "2024-01-01",
|
||||
"subcategory_id": "chat"
|
||||
"subcategory_id": "chat",
|
||||
"publish_date": "2023-09-27"
|
||||
},
|
||||
{
|
||||
"id": "mixtral8x7b",
|
||||
@@ -154,7 +162,8 @@
|
||||
"license": "Apache 2.0",
|
||||
"description": "MoE架构,高效推理",
|
||||
"created_at": "2024-01-01",
|
||||
"subcategory_id": "chat"
|
||||
"subcategory_id": "chat",
|
||||
"publish_date": "2023-12-11"
|
||||
},
|
||||
{
|
||||
"id": "qwen72b",
|
||||
@@ -171,7 +180,8 @@
|
||||
"license": "Apache 2.0",
|
||||
"description": "阿里开源大模型,中文能力强",
|
||||
"created_at": "2024-01-01",
|
||||
"subcategory_id": "chat"
|
||||
"subcategory_id": "chat",
|
||||
"publish_date": "2024-02-05"
|
||||
},
|
||||
{
|
||||
"id": "deepseekv3",
|
||||
@@ -188,7 +198,8 @@
|
||||
"license": "MIT",
|
||||
"description": "DeepSeek最新模型,性价比极高",
|
||||
"created_at": "2024-01-01",
|
||||
"subcategory_id": "code"
|
||||
"subcategory_id": "code",
|
||||
"publish_date": "2024-12-26"
|
||||
},
|
||||
{
|
||||
"id": "glm4",
|
||||
@@ -206,6 +217,7 @@
|
||||
"description": "智谱AI大模型,中文能力强",
|
||||
"created_at": "2024-01-01",
|
||||
"visible": true,
|
||||
"subcategory_id": "chat"
|
||||
"subcategory_id": "chat",
|
||||
"publish_date": "2024-01-01"
|
||||
}
|
||||
]
|
||||
28328
logs/app.log
28328
logs/app.log
File diff suppressed because it is too large
Load Diff
BIN
static/uploads/9703a1d16424_1777365365.png
Normal file
BIN
static/uploads/9703a1d16424_1777365365.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
BIN
static/uploads/deca243eff98_1777390343.png
Normal file
BIN
static/uploads/deca243eff98_1777390343.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
File diff suppressed because it is too large
Load Diff
@@ -49,7 +49,7 @@
|
||||
<i class="ri-search-line absolute left-4 top-1/2 -translate-y-1/2 text-gray-400"></i>
|
||||
<input type="text" id="searchInput" placeholder="搜索..."
|
||||
class="w-full pl-12 pr-4 py-2 border border-gray-200 rounded-lg focus:outline-none focus:border-indigo-400"
|
||||
onkeyup="filterItems()">
|
||||
oninput="filterItems()">
|
||||
</div>
|
||||
<select id="sortBy" onchange="loadItems()" class="px-4 py-2 border border-gray-200 rounded-lg focus:outline-none">
|
||||
<option value="default">默认排序(置顶优先)</option>
|
||||
@@ -65,14 +65,32 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 数据列表 -->
|
||||
<div class="bg-white rounded-xl shadow-sm p-6">
|
||||
<div id="itemsList" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
<div class="text-center text-gray-400 py-8">加载中...</div>
|
||||
</div>
|
||||
<!-- 数据表格 -->
|
||||
<div class="bg-white rounded-xl shadow-sm overflow-hidden">
|
||||
<table class="w-full">
|
||||
<thead class="bg-gray-50 border-b" id="tableHead">
|
||||
<!-- 动态生成 -->
|
||||
</thead>
|
||||
<tbody id="itemsTable">
|
||||
<tr><td colspan="10" class="text-center text-gray-400 py-8">加载中...</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- 详情弹窗 -->
|
||||
<div id="detailModal" class="fixed inset-0 bg-black/50 z-50 hidden flex items-center justify-center">
|
||||
<div class="bg-white rounded-xl max-w-2xl w-full mx-4 max-h-[80vh] 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" id="modalTitle">详情</h2>
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<!-- 页脚 -->
|
||||
<footer class="bg-white border-t mt-8 py-6 text-center text-gray-500 text-sm">
|
||||
ParamHub - 参数百科
|
||||
@@ -82,12 +100,23 @@
|
||||
const categoryId = '{{ category.id }}';
|
||||
let allItems = [];
|
||||
let categories = [];
|
||||
let currentCategory = null;
|
||||
let displayFields = []; // 显示的字段列表
|
||||
|
||||
// 加载导航
|
||||
async function loadNav() {
|
||||
const res = await fetch('/api/categories');
|
||||
categories = await res.json();
|
||||
|
||||
// 获取当前类别
|
||||
currentCategory = categories.find(c => c.id === categoryId);
|
||||
if (currentCategory && currentCategory.fields) {
|
||||
// 过滤要显示的字段(排除id、created_at等内部字段)
|
||||
displayFields = currentCategory.fields
|
||||
.filter(f => !['id', 'category_id', 'created_at', 'updated_at', 'visible', 'is_pinned', 'views', 'publish_date', 'subcategory_id', 'parse_sources', 'product_images'].includes(f.key))
|
||||
.slice(0, 6); // 最多显示6个字段
|
||||
}
|
||||
|
||||
// 内置页面映射
|
||||
const builtinPages = [
|
||||
{id: 'home', name: '首页', href: '/'},
|
||||
@@ -129,50 +158,78 @@
|
||||
allItems = await res.json();
|
||||
|
||||
document.getElementById('itemCount').textContent = allItems.length;
|
||||
renderTableHead();
|
||||
renderItems(allItems);
|
||||
}
|
||||
|
||||
// 渲染数据
|
||||
// 渲染表格头部
|
||||
function renderTableHead() {
|
||||
let html = '<tr>';
|
||||
|
||||
// 名称列
|
||||
html += '<th class="px-4 py-3 text-left text-sm font-medium text-gray-600">名称</th>';
|
||||
|
||||
// 动态字段列
|
||||
displayFields.forEach(f => {
|
||||
html += `<th class="px-4 py-3 text-left text-sm font-medium text-gray-600">${f.label}</th>`;
|
||||
});
|
||||
|
||||
// 发布日期列
|
||||
html += '<th class="px-4 py-3 text-left text-sm font-medium text-gray-600">发布日期</th>';
|
||||
|
||||
// 操作列
|
||||
html += '<th class="px-4 py-3 text-center text-sm font-medium text-gray-600">操作</th>';
|
||||
|
||||
html += '</tr>';
|
||||
document.getElementById('tableHead').innerHTML = html;
|
||||
}
|
||||
|
||||
// 渲染数据表格
|
||||
function renderItems(items) {
|
||||
if (items.length === 0) {
|
||||
document.getElementById('itemsList').innerHTML = `
|
||||
<div class="col-span-3 text-center py-12">
|
||||
const colCount = displayFields.length + 3; // 名称 + 字段 + 日期 + 操作
|
||||
document.getElementById('itemsTable').innerHTML = `
|
||||
<tr><td colspan="${colCount}" class="text-center py-12">
|
||||
<i class="ri-inbox-line text-4xl text-gray-300 mb-4 block"></i>
|
||||
<p class="text-gray-400">暂无数据</p>
|
||||
</div>
|
||||
</td></tr>
|
||||
`;
|
||||
return;
|
||||
}
|
||||
|
||||
document.getElementById('itemsList').innerHTML = items.map(item => {
|
||||
const fields = Object.entries(item)
|
||||
.filter(([key, val]) => !['id', 'category_id', 'created_at', 'updated_at', 'visible', 'is_pinned', 'views', 'publish_date'].includes(key) && val)
|
||||
.slice(0, 5)
|
||||
.map(([key, val]) => `<span class="text-gray-500 text-sm">${key}: ${val}</span>`)
|
||||
.join('<br>');
|
||||
|
||||
return `
|
||||
<div class="border border-gray-200 rounded-lg p-4 hover:shadow-md transition group ${item.is_pinned ? 'bg-yellow-50 border-yellow-300' : ''}">
|
||||
<div class="flex items-start justify-between">
|
||||
<div>
|
||||
<h3 class="font-medium text-gray-800 group-hover:text-indigo-600 flex items-center gap-2">
|
||||
${item.is_pinned ? '<i class="ri-pushpin-fill text-yellow-500" title="置顶"></i>' : ''}
|
||||
${item.name || item.title || '未命名'}
|
||||
</h3>
|
||||
<div class="mt-2 space-y-1">
|
||||
${fields}
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right">
|
||||
<div class="text-xs text-gray-400">
|
||||
${item.publish_date || (item.created_at ? item.created_at.split(' ')[0] : '')}
|
||||
</div>
|
||||
${item.views ? `<div class="text-xs text-gray-400 mt-1"><i class="ri-eye-line"></i> ${item.views}</div>` : ''}
|
||||
</div>
|
||||
</div>
|
||||
const html = items.map(item => {
|
||||
let row = `<tr class="border-b hover:bg-gray-50 transition ${item.is_pinned ? 'bg-yellow-50' : ''}">`;
|
||||
|
||||
// 名称列
|
||||
row += `<td class="px-4 py-3">
|
||||
<div class="font-medium text-gray-800 flex items-center gap-2">
|
||||
${item.is_pinned ? '<i class="ri-pushpin-fill text-yellow-500" title="置顶"></i>' : ''}
|
||||
${item.name || item.title || '未命名'}
|
||||
</div>
|
||||
`;
|
||||
${item.views ? `<div class="text-xs text-gray-400 mt-1"><i class="ri-eye-line mr-1"></i>${item.views}</div>` : ''}
|
||||
</td>`;
|
||||
|
||||
// 动态字段列
|
||||
displayFields.forEach(f => {
|
||||
const value = item[f.key] || '-';
|
||||
row += `<td class="px-4 py-3 text-gray-600 text-sm">${value}</td>`;
|
||||
});
|
||||
|
||||
// 发布日期列
|
||||
row += `<td class="px-4 py-3 text-gray-500 text-sm">${item.publish_date || (item.created_at ? item.created_at.split(' ')[0] : '-')}</td>`;
|
||||
|
||||
// 操作列
|
||||
row += `<td class="px-4 py-3 text-center">
|
||||
<button onclick="showDetail('${item.id}')" class="text-indigo-600 hover:text-indigo-800 text-sm">
|
||||
<i class="ri-eye-line mr-1"></i>详情
|
||||
</button>
|
||||
</td>`;
|
||||
|
||||
row += '</tr>';
|
||||
return row;
|
||||
}).join('');
|
||||
|
||||
document.getElementById('itemsTable').innerHTML = html;
|
||||
}
|
||||
|
||||
// 搜索过滤
|
||||
@@ -191,6 +248,56 @@
|
||||
renderItems(filtered);
|
||||
}
|
||||
|
||||
// 显示详情
|
||||
function showDetail(id) {
|
||||
const item = allItems.find(i => i.id === id);
|
||||
if (!item) return;
|
||||
|
||||
document.getElementById('modalTitle').textContent = item.name || '详情';
|
||||
|
||||
let html = '<div class="space-y-3">';
|
||||
|
||||
// 按字段顺序显示
|
||||
if (currentCategory && currentCategory.fields) {
|
||||
currentCategory.fields.forEach(f => {
|
||||
if (item[f.key]) {
|
||||
const value = item[f.key];
|
||||
html += `
|
||||
<div class="flex justify-between py-2 border-b">
|
||||
<span class="text-gray-500">${f.label}</span>
|
||||
<span class="text-gray-800 ${f.input_style === 'long' ? 'text-right max-w-xs' : ''}">${value}</span>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 添加统计信息
|
||||
if (item.views) {
|
||||
html += `
|
||||
<div class="flex justify-between py-2 border-b">
|
||||
<span class="text-gray-500">热度</span>
|
||||
<span class="text-gray-800"><i class="ri-eye-line mr-1"></i>${item.views}</span>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
|
||||
document.getElementById('modalContent').innerHTML = html;
|
||||
document.getElementById('detailModal').classList.remove('hidden');
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
function closeModal() {
|
||||
document.getElementById('detailModal').classList.add('hidden');
|
||||
}
|
||||
|
||||
// 点击弹窗外部关闭
|
||||
document.getElementById('detailModal').addEventListener('click', function(e) {
|
||||
if (e.target === this) closeModal();
|
||||
});
|
||||
|
||||
// 初始化
|
||||
loadNav();
|
||||
loadItems();
|
||||
|
||||
@@ -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