Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| db5b6bb6c7 | |||
| 35df07725e | |||
| 867a0a3eaf | |||
| a647179e72 | |||
| 438fba347a |
173
app.py
173
app.py
@@ -523,6 +523,168 @@ def api_parse_images():
|
||||
|
||||
# ============ 智能添加API ============
|
||||
|
||||
# ============ 智能补充参数API ============
|
||||
|
||||
@app.route('/api/models/<model_id>/smart-update', methods=['POST'])
|
||||
def api_smart_update_model(model_id):
|
||||
"""智能补充模型参数(只填充缺失字段)"""
|
||||
data = request.get_json()
|
||||
text = data.get('text', '')
|
||||
images = data.get('images', [])
|
||||
|
||||
if not text and not images:
|
||||
return jsonify({'error': '文本或图片不能都为空'}), 400
|
||||
|
||||
# 获取现有数据
|
||||
models = load_data(MODELS_FILE)
|
||||
model = next((m for m in models if m['id'] == model_id), None)
|
||||
if not model:
|
||||
return jsonify({'error': 'Model not found'}), 404
|
||||
|
||||
# 解析新参数
|
||||
parsed_list = parse_with_llm(text, 'model', images)
|
||||
if not parsed_list:
|
||||
return jsonify({'error': '解析失败'}), 500
|
||||
|
||||
parsed = parsed_list[0] # 补充只取第一个
|
||||
|
||||
# 只填充缺失或为空的字段
|
||||
updated_fields = []
|
||||
for key, value in parsed.items():
|
||||
if value is not None and value != '' and value != 0:
|
||||
existing = model.get(key)
|
||||
if existing is None or existing == '' or existing == 0:
|
||||
model[key] = value
|
||||
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
|
||||
|
||||
save_data(MODELS_FILE, models)
|
||||
|
||||
return jsonify({'success': True, 'updated_fields': updated_fields, 'model': model})
|
||||
|
||||
@app.route('/api/gpus/<gpu_id>/smart-update', methods=['POST'])
|
||||
def api_smart_update_gpu(gpu_id):
|
||||
"""智能补充GPU参数(只填充缺失字段)"""
|
||||
data = request.get_json()
|
||||
text = data.get('text', '')
|
||||
images = data.get('images', [])
|
||||
|
||||
if not text and not images:
|
||||
return jsonify({'error': '文本或图片不能都为空'}), 400
|
||||
|
||||
gpus = load_data(GPUS_FILE)
|
||||
gpu = next((g for g in gpus if g['id'] == gpu_id), None)
|
||||
if not gpu:
|
||||
return jsonify({'error': 'GPU not found'}), 404
|
||||
|
||||
parsed_list = parse_with_llm(text, 'gpu', images)
|
||||
if not parsed_list:
|
||||
return jsonify({'error': '解析失败'}), 500
|
||||
|
||||
parsed = parsed_list[0]
|
||||
|
||||
updated_fields = []
|
||||
for key, value in parsed.items():
|
||||
if value is not None and value != '' and value != 0:
|
||||
existing = gpu.get(key)
|
||||
if existing is None or existing == '' or existing == 0:
|
||||
gpu[key] = value
|
||||
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
|
||||
|
||||
save_data(GPUS_FILE, gpus)
|
||||
|
||||
return jsonify({'success': True, 'updated_fields': updated_fields, 'gpu': gpu})
|
||||
|
||||
@app.route('/api/cpus/<cpu_id>/smart-update', methods=['POST'])
|
||||
def api_smart_update_cpu(cpu_id):
|
||||
"""智能补充CPU参数(只填充缺失字段)"""
|
||||
data = request.get_json()
|
||||
text = data.get('text', '')
|
||||
images = data.get('images', [])
|
||||
|
||||
if not text and not images:
|
||||
return jsonify({'error': '文本或图片不能都为空'}), 400
|
||||
|
||||
cpus = load_data(CPUS_FILE)
|
||||
cpu = next((c for c in cpus if c['id'] == cpu_id), None)
|
||||
if not cpu:
|
||||
return jsonify({'error': 'CPU not found'}), 404
|
||||
|
||||
parsed_list = parse_with_llm(text, 'cpu', images)
|
||||
if not parsed_list:
|
||||
return jsonify({'error': '解析失败'}), 500
|
||||
|
||||
parsed = parsed_list[0]
|
||||
|
||||
updated_fields = []
|
||||
for key, value in parsed.items():
|
||||
if value is not None and value != '' and value != 0:
|
||||
existing = cpu.get(key)
|
||||
if existing is None or existing == '' or existing == 0:
|
||||
cpu[key] = value
|
||||
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
|
||||
|
||||
save_data(CPUS_FILE, cpus)
|
||||
|
||||
return jsonify({'success': True, 'updated_fields': updated_fields, 'cpu': cpu})
|
||||
|
||||
@app.route('/api/items/<category_id>/<item_id>/smart-update', methods=['POST'])
|
||||
def api_smart_update_item(category_id, item_id):
|
||||
"""智能补充动态分类数据参数(只填充缺失字段)"""
|
||||
data = request.get_json()
|
||||
text = data.get('text', '')
|
||||
images = data.get('images', [])
|
||||
|
||||
if not text and not images:
|
||||
return jsonify({'error': '文本或图片不能都为空'}), 400
|
||||
|
||||
items_file = DATA_DIR / f'items_{category_id}.json'
|
||||
items = load_data(items_file)
|
||||
item = next((i for i in items if i['id'] == item_id), None)
|
||||
if not item:
|
||||
return jsonify({'error': 'Item not found'}), 404
|
||||
|
||||
parsed_list = parse_with_llm(text, 'dynamic', images)
|
||||
if not parsed_list:
|
||||
return jsonify({'error': '解析失败'}), 500
|
||||
|
||||
parsed = parsed_list[0]
|
||||
|
||||
updated_fields = []
|
||||
for key, value in parsed.items():
|
||||
if value is not None and value != '' and value != 0:
|
||||
existing = item.get(key)
|
||||
if existing is None or existing == '' or existing == 0:
|
||||
item[key] = value
|
||||
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
|
||||
|
||||
save_data(items_file, items)
|
||||
|
||||
return jsonify({'success': True, 'updated_fields': updated_fields, 'item': item})
|
||||
|
||||
@app.route('/api/models/smart-add', methods=['POST'])
|
||||
def api_smart_add_model():
|
||||
"""智能添加模型(支持文本和多图解析,可能添加多个产品)"""
|
||||
@@ -951,6 +1113,17 @@ def api_categories():
|
||||
|
||||
return jsonify(sorted(categories, key=lambda x: x.get('order', 0)))
|
||||
|
||||
@app.route('/api/categories/<category_id>')
|
||||
def api_category_detail(category_id):
|
||||
"""获取单个分类详情"""
|
||||
categories = load_data(CATEGORIES_FILE)
|
||||
category = next((c for c in categories if c['id'] == category_id), None)
|
||||
|
||||
if not category:
|
||||
return jsonify({'error': 'Category not found'}), 404
|
||||
|
||||
return jsonify(category)
|
||||
|
||||
@app.route('/api/categories', methods=['POST'])
|
||||
def api_create_category():
|
||||
"""创建新分类"""
|
||||
|
||||
@@ -11,7 +11,12 @@
|
||||
"id": "chat",
|
||||
"name": "对话模型",
|
||||
"icon": "ri-chat-3-line",
|
||||
"key_features": ["context_length", "mmlu", "input_price", "output_price"],
|
||||
"key_features": [
|
||||
"context_length",
|
||||
"mmlu",
|
||||
"input_price",
|
||||
"output_price"
|
||||
],
|
||||
"feature_labels": {
|
||||
"context_length": "上下文",
|
||||
"mmlu": "MMLU",
|
||||
@@ -23,7 +28,11 @@
|
||||
"id": "code",
|
||||
"name": "代码模型",
|
||||
"icon": "ri-code-line",
|
||||
"key_features": ["humaneval", "context_length", "input_price"],
|
||||
"key_features": [
|
||||
"humaneval",
|
||||
"context_length",
|
||||
"input_price"
|
||||
],
|
||||
"feature_labels": {
|
||||
"humaneval": "HumanEval",
|
||||
"context_length": "上下文",
|
||||
@@ -34,7 +43,11 @@
|
||||
"id": "reasoning",
|
||||
"name": "推理模型",
|
||||
"icon": "ri-lightbulb-line",
|
||||
"key_features": ["reasoning_capability", "mmlu", "context_length"],
|
||||
"key_features": [
|
||||
"reasoning_capability",
|
||||
"mmlu",
|
||||
"context_length"
|
||||
],
|
||||
"feature_labels": {
|
||||
"reasoning_capability": "推理能力",
|
||||
"mmlu": "MMLU",
|
||||
@@ -45,7 +58,11 @@
|
||||
"id": "vision",
|
||||
"name": "视觉模型",
|
||||
"icon": "ri-image-line",
|
||||
"key_features": ["vision_capability", "multimodal", "context_length"],
|
||||
"key_features": [
|
||||
"vision_capability",
|
||||
"multimodal",
|
||||
"context_length"
|
||||
],
|
||||
"feature_labels": {
|
||||
"vision_capability": "视觉能力",
|
||||
"multimodal": "多模态",
|
||||
@@ -66,7 +83,12 @@
|
||||
"id": "gaming",
|
||||
"name": "游戏显卡",
|
||||
"icon": "ri-gamepad-line",
|
||||
"key_features": ["memory_gb", "cuda_cores", "price_usd", "fp16_tflops"],
|
||||
"key_features": [
|
||||
"memory_gb",
|
||||
"cuda_cores",
|
||||
"price_usd",
|
||||
"fp16_tflops"
|
||||
],
|
||||
"feature_labels": {
|
||||
"memory_gb": "显存",
|
||||
"cuda_cores": "CUDA核心",
|
||||
@@ -78,7 +100,12 @@
|
||||
"id": "professional",
|
||||
"name": "专业显卡",
|
||||
"icon": "ri-building-line",
|
||||
"key_features": ["memory_gb", "tensor_cores", "memory_bandwidth_gbs", "price_usd"],
|
||||
"key_features": [
|
||||
"memory_gb",
|
||||
"tensor_cores",
|
||||
"memory_bandwidth_gbs",
|
||||
"price_usd"
|
||||
],
|
||||
"feature_labels": {
|
||||
"memory_gb": "显存",
|
||||
"tensor_cores": "Tensor核心",
|
||||
@@ -90,7 +117,12 @@
|
||||
"id": "datacenter",
|
||||
"name": "数据中心",
|
||||
"icon": "ri-server-line",
|
||||
"key_features": ["memory_gb", "tensor_cores", "memory_bandwidth_gbs", "fp16_tflops"],
|
||||
"key_features": [
|
||||
"memory_gb",
|
||||
"tensor_cores",
|
||||
"memory_bandwidth_gbs",
|
||||
"fp16_tflops"
|
||||
],
|
||||
"feature_labels": {
|
||||
"memory_gb": "显存",
|
||||
"tensor_cores": "Tensor核心",
|
||||
@@ -112,7 +144,12 @@
|
||||
"id": "desktop",
|
||||
"name": "桌面CPU",
|
||||
"icon": "ri-computer-line",
|
||||
"key_features": ["cores", "threads", "boost_clock_ghz", "price_usd"],
|
||||
"key_features": [
|
||||
"cores",
|
||||
"threads",
|
||||
"boost_clock_ghz",
|
||||
"price_usd"
|
||||
],
|
||||
"feature_labels": {
|
||||
"cores": "核心",
|
||||
"threads": "线程",
|
||||
@@ -124,7 +161,12 @@
|
||||
"id": "server",
|
||||
"name": "服务器CPU",
|
||||
"icon": "ri-server-line",
|
||||
"key_features": ["cores", "threads", "l3_cache_mb", "tdp_watts"],
|
||||
"key_features": [
|
||||
"cores",
|
||||
"threads",
|
||||
"l3_cache_mb",
|
||||
"tdp_watts"
|
||||
],
|
||||
"feature_labels": {
|
||||
"cores": "核心",
|
||||
"threads": "线程",
|
||||
@@ -136,7 +178,12 @@
|
||||
"id": "mobile",
|
||||
"name": "移动CPU",
|
||||
"icon": "ri-smartphone-line",
|
||||
"key_features": ["cores", "threads", "base_clock_ghz", "tdp_watts"],
|
||||
"key_features": [
|
||||
"cores",
|
||||
"threads",
|
||||
"base_clock_ghz",
|
||||
"tdp_watts"
|
||||
],
|
||||
"feature_labels": {
|
||||
"cores": "核心",
|
||||
"threads": "线程",
|
||||
@@ -159,7 +206,12 @@
|
||||
"id": "flagship",
|
||||
"name": "旗舰手机",
|
||||
"icon": "ri-star-line",
|
||||
"key_features": ["processor", "ram_gb", "storage_gb", "price"],
|
||||
"key_features": [
|
||||
"processor",
|
||||
"ram_gb",
|
||||
"storage_gb",
|
||||
"price"
|
||||
],
|
||||
"feature_labels": {
|
||||
"processor": "处理器",
|
||||
"ram_gb": "内存",
|
||||
@@ -171,7 +223,12 @@
|
||||
"id": "midrange",
|
||||
"name": "中端手机",
|
||||
"icon": "ri-price-tag-3-line",
|
||||
"key_features": ["processor", "ram_gb", "battery_mah", "price"],
|
||||
"key_features": [
|
||||
"processor",
|
||||
"ram_gb",
|
||||
"battery_mah",
|
||||
"price"
|
||||
],
|
||||
"feature_labels": {
|
||||
"processor": "处理器",
|
||||
"ram_gb": "内存",
|
||||
@@ -193,7 +250,12 @@
|
||||
"id": "gaming-laptop",
|
||||
"name": "游戏笔记本",
|
||||
"icon": "ri-gamepad-line",
|
||||
"key_features": ["processor", "gpu", "ram_gb", "price"],
|
||||
"key_features": [
|
||||
"processor",
|
||||
"gpu",
|
||||
"ram_gb",
|
||||
"price"
|
||||
],
|
||||
"feature_labels": {
|
||||
"processor": "处理器",
|
||||
"gpu": "显卡",
|
||||
@@ -205,7 +267,12 @@
|
||||
"id": "business-laptop",
|
||||
"name": "商务笔记本",
|
||||
"icon": "ri-briefcase-line",
|
||||
"key_features": ["processor", "ram_gb", "weight_kg", "price"],
|
||||
"key_features": [
|
||||
"processor",
|
||||
"ram_gb",
|
||||
"weight_kg",
|
||||
"price"
|
||||
],
|
||||
"feature_labels": {
|
||||
"processor": "处理器",
|
||||
"ram_gb": "内存",
|
||||
@@ -228,7 +295,11 @@
|
||||
"id": "sedan",
|
||||
"name": "轿车",
|
||||
"icon": "ri-car-line",
|
||||
"key_features": ["engine", "power_kw", "price"],
|
||||
"key_features": [
|
||||
"engine",
|
||||
"power_kw",
|
||||
"price"
|
||||
],
|
||||
"feature_labels": {
|
||||
"engine": "发动机",
|
||||
"power_kw": "功率",
|
||||
@@ -239,7 +310,11 @@
|
||||
"id": "suv",
|
||||
"name": "SUV",
|
||||
"icon": "ri-truck-line",
|
||||
"key_features": ["engine", "seats", "price"],
|
||||
"key_features": [
|
||||
"engine",
|
||||
"seats",
|
||||
"price"
|
||||
],
|
||||
"feature_labels": {
|
||||
"engine": "发动机",
|
||||
"seats": "座位数",
|
||||
@@ -253,35 +328,53 @@
|
||||
"name": "摄像",
|
||||
"icon": "ri-camera-line",
|
||||
"color": "blue",
|
||||
"order": 0,
|
||||
"order": 9,
|
||||
"visible": true,
|
||||
"description": "相机、摄像机等",
|
||||
"created_at": "2026-04-25 16:38:47",
|
||||
"subcategories": [
|
||||
{
|
||||
"id": "mirrorless",
|
||||
"name": "无反相机",
|
||||
"icon": "ri-camera-line",
|
||||
"key_features": ["sensor", "megapixels", "video_resolution", "price"],
|
||||
"feature_labels": {
|
||||
"sensor": "传感器",
|
||||
"megapixels": "像素",
|
||||
"video_resolution": "视频",
|
||||
"price": "价格"
|
||||
}
|
||||
"price": "价格",
|
||||
"sensor": "传感器",
|
||||
"video_resolution": "视频"
|
||||
},
|
||||
"icon": "ri-camera-line",
|
||||
"id": "mirrorless",
|
||||
"key_features": [
|
||||
"sensor",
|
||||
"megapixels",
|
||||
"video_resolution",
|
||||
"price"
|
||||
],
|
||||
"name": "无反相机"
|
||||
},
|
||||
{
|
||||
"id": "dslr",
|
||||
"name": "单反相机",
|
||||
"icon": "ri-camera-2-line",
|
||||
"key_features": ["sensor", "megapixels", "lens_mount", "price"],
|
||||
"feature_labels": {
|
||||
"sensor": "传感器",
|
||||
"megapixels": "像素",
|
||||
"lens_mount": "卡口",
|
||||
"price": "价格"
|
||||
}
|
||||
"megapixels": "像素",
|
||||
"price": "价格",
|
||||
"sensor": "传感器"
|
||||
},
|
||||
"icon": "ri-camera-2-line",
|
||||
"id": "dslr",
|
||||
"key_features": [
|
||||
"sensor",
|
||||
"megapixels",
|
||||
"lens_mount",
|
||||
"price"
|
||||
],
|
||||
"name": "单反相机"
|
||||
},
|
||||
{
|
||||
"id": "90ce312b560d",
|
||||
"name": "口袋云台相机",
|
||||
"icon": "ri-folder-line",
|
||||
"key_features": [],
|
||||
"feature_labels": {}
|
||||
}
|
||||
]
|
||||
],
|
||||
"updated_at": "2026-04-28 10:55:02"
|
||||
}
|
||||
]
|
||||
@@ -6,9 +6,9 @@
|
||||
"copyright_year": "2026",
|
||||
"contact_email": "wlq@tphai.com",
|
||||
"github_url": "",
|
||||
"updated_at": "2026-04-27 19:57:00",
|
||||
"llm_base_url": "http://192.168.2.17:19007/v1",
|
||||
"llm_api_key": "",
|
||||
"llm_model": "auto",
|
||||
"llm_vision_model": "gpt-4-vision-preview"
|
||||
"llm_base_url": "https://open.bigmodel.cn/api/paas/v4",
|
||||
"llm_api_key": "2259e33a1357460abe17919aaf81e73d.K44a8LPQTmFM5PKm",
|
||||
"llm_model": "glm-4.5-air",
|
||||
"llm_vision_model": "glm-4.6v",
|
||||
"updated_at": "2026-04-27 23:58:26"
|
||||
}
|
||||
147
data/cpus.json
147
data/cpus.json
@@ -1,10 +1,141 @@
|
||||
[
|
||||
{"id": "epyc9654", "name": "AMD EPYC 9654", "manufacturer": "AMD", "architecture": "Zen 4", "cores": 96, "threads": 192, "base_clock_ghz": 2.4, "boost_clock_ghz": 3.7, "l3_cache_mb": 384, "tdp_watts": 360, "price_usd": 11000, "release_year": 2022, "description": "AMD顶级服务器CPU,96核心"},
|
||||
{"id": "epyc9554", "name": "AMD EPYC 9554", "manufacturer": "AMD", "architecture": "Zen 4", "cores": 64, "threads": 128, "base_clock_ghz": 3.1, "boost_clock_ghz": 3.8, "l3_cache_mb": 256, "tdp_watts": 360, "price_usd": 6800, "release_year": 2022, "description": "64核心高性能服务器CPU"},
|
||||
{"id": "epyc9454", "name": "AMD EPYC 9454", "manufacturer": "AMD", "architecture": "Zen 4", "cores": 48, "threads": 96, "base_clock_ghz": 2.75, "boost_clock_ghz": 3.8, "l3_cache_mb": 192, "tdp_watts": 290, "price_usd": 4100, "release_year": 2022, "description": "48核心服务器CPU"},
|
||||
{"id": "xeonw9359x", "name": "Intel Xeon w9-3595X", "manufacturer": "Intel", "architecture": "Sapphire Rapids", "cores": 56, "threads": 112, "base_clock_ghz": 1.9, "boost_clock_ghz": 4.8, "l3_cache_mb": 105, "tdp_watts": 350, "price_usd": 6200, "release_year": 2023, "description": "Intel顶级工作站CPU"},
|
||||
{"id": "xeonw5345", "name": "Intel Xeon w5-3435", "manufacturer": "Intel", "architecture": "Sapphire Rapids", "cores": 24, "threads": 48, "base_clock_ghz": 3.1, "boost_clock_ghz": 4.7, "l3_cache_mb": 45, "tdp_watts": 230, "price_usd": 950, "release_year": 2023, "description": "中端工作站CPU"},
|
||||
{"id": "ryzen97950x", "name": "AMD Ryzen 9 7950X", "manufacturer": "AMD", "architecture": "Zen 4", "cores": 16, "threads": 32, "base_clock_ghz": 4.5, "boost_clock_ghz": 5.7, "l3_cache_mb": 64, "tdp_watts": 170, "price_usd": 550, "release_year": 2022, "description": "顶级消费级CPU,适合AI开发"},
|
||||
{"id": "ryzen97950x3d", "name": "AMD Ryzen 9 7950X3D", "manufacturer": "AMD", "architecture": "Zen 4", "cores": 16, "threads": 32, "base_clock_ghz": 4.2, "boost_clock_ghz": 5.7, "l3_cache_mb": 144, "tdp_watts": 120, "price_usd": 700, "release_year": 2023, "description": "带3D V-Cache,游戏性能更强"},
|
||||
{"id": "intel14900k", "name": "Intel Core i9-14900K", "manufacturer": "Intel", "architecture": "Raptor Lake Refresh", "cores": 24, "threads": 32, "base_clock_ghz": 3.2, "boost_clock_ghz": 6.0, "l3_cache_mb": 36, "tdp_watts": 125, "price_usd": 580, "release_year": 2023, "description": "Intel顶级消费级CPU"}
|
||||
{
|
||||
"id": "epyc9654",
|
||||
"name": "AMD EPYC 9654",
|
||||
"manufacturer": "AMD",
|
||||
"architecture": "Zen 4",
|
||||
"cores": 96,
|
||||
"threads": 192,
|
||||
"base_clock_ghz": 2.4,
|
||||
"boost_clock_ghz": 3.7,
|
||||
"l3_cache_mb": 384,
|
||||
"tdp_watts": 360,
|
||||
"price_usd": 11000,
|
||||
"release_year": 2022,
|
||||
"description": "AMD顶级服务器CPU,96核心"
|
||||
},
|
||||
{
|
||||
"id": "epyc9554",
|
||||
"name": "AMD EPYC 9554",
|
||||
"manufacturer": "AMD",
|
||||
"architecture": "Zen 4",
|
||||
"cores": 64,
|
||||
"threads": 128,
|
||||
"base_clock_ghz": 3.1,
|
||||
"boost_clock_ghz": 3.8,
|
||||
"l3_cache_mb": 256,
|
||||
"tdp_watts": 360,
|
||||
"price_usd": 6800,
|
||||
"release_year": 2022,
|
||||
"description": "64核心高性能服务器CPU"
|
||||
},
|
||||
{
|
||||
"id": "epyc9454",
|
||||
"name": "AMD EPYC 9454",
|
||||
"manufacturer": "AMD",
|
||||
"architecture": "Zen 4",
|
||||
"cores": 48,
|
||||
"threads": 96,
|
||||
"base_clock_ghz": 2.75,
|
||||
"boost_clock_ghz": 3.8,
|
||||
"l3_cache_mb": 192,
|
||||
"tdp_watts": 290,
|
||||
"price_usd": 4100,
|
||||
"release_year": 2022,
|
||||
"description": "48核心服务器CPU"
|
||||
},
|
||||
{
|
||||
"id": "xeonw9359x",
|
||||
"name": "Intel Xeon w9-3595X",
|
||||
"manufacturer": "Intel",
|
||||
"architecture": "Sapphire Rapids",
|
||||
"cores": 56,
|
||||
"threads": 112,
|
||||
"base_clock_ghz": 1.9,
|
||||
"boost_clock_ghz": 4.8,
|
||||
"l3_cache_mb": 105,
|
||||
"tdp_watts": 350,
|
||||
"price_usd": 6200,
|
||||
"release_year": 2023,
|
||||
"description": "Intel顶级工作站CPU"
|
||||
},
|
||||
{
|
||||
"id": "xeonw5345",
|
||||
"name": "Intel Xeon w5-3435",
|
||||
"manufacturer": "Intel",
|
||||
"architecture": "Sapphire Rapids",
|
||||
"cores": 24,
|
||||
"threads": 48,
|
||||
"base_clock_ghz": 3.1,
|
||||
"boost_clock_ghz": 4.7,
|
||||
"l3_cache_mb": 45,
|
||||
"tdp_watts": 230,
|
||||
"price_usd": 950,
|
||||
"release_year": 2023,
|
||||
"description": "中端工作站CPU"
|
||||
},
|
||||
{
|
||||
"id": "ryzen97950x",
|
||||
"name": "AMD Ryzen 9 7950X",
|
||||
"manufacturer": "AMD",
|
||||
"architecture": "Zen 4",
|
||||
"cores": 16,
|
||||
"threads": 32,
|
||||
"base_clock_ghz": 4.5,
|
||||
"boost_clock_ghz": 5.7,
|
||||
"l3_cache_mb": 64,
|
||||
"tdp_watts": 170,
|
||||
"price_usd": 550,
|
||||
"release_year": 2022,
|
||||
"description": "顶级消费级CPU,适合AI开发"
|
||||
},
|
||||
{
|
||||
"id": "ryzen97950x3d",
|
||||
"name": "AMD Ryzen 9 7950X3D",
|
||||
"manufacturer": "AMD",
|
||||
"architecture": "Zen 4",
|
||||
"cores": 16,
|
||||
"threads": 32,
|
||||
"base_clock_ghz": 4.2,
|
||||
"boost_clock_ghz": 5.7,
|
||||
"l3_cache_mb": 144,
|
||||
"tdp_watts": 120,
|
||||
"price_usd": 700,
|
||||
"release_year": 2023,
|
||||
"description": "带3D V-Cache,游戏性能更强"
|
||||
},
|
||||
{
|
||||
"id": "intel14900k",
|
||||
"name": "Intel Core i9-14900K",
|
||||
"manufacturer": "Intel",
|
||||
"architecture": "Raptor Lake Refresh",
|
||||
"cores": 24,
|
||||
"threads": 32,
|
||||
"base_clock_ghz": 3.2,
|
||||
"boost_clock_ghz": 6.0,
|
||||
"l3_cache_mb": 36,
|
||||
"tdp_watts": 125,
|
||||
"price_usd": 580,
|
||||
"release_year": 2023,
|
||||
"description": "Intel顶级消费级CPU"
|
||||
},
|
||||
{
|
||||
"name": "AMD 锐龙 AI 9 H 365",
|
||||
"manufacturer": "AMD",
|
||||
"architecture": "Zen 5, Zen 5c",
|
||||
"cores": 10,
|
||||
"threads": 20,
|
||||
"base_clock_ghz": 2.0,
|
||||
"boost_clock_ghz": 5.0,
|
||||
"l3_cache_mb": 24,
|
||||
"tdp_watts": 28,
|
||||
"description": "AMD 锐龙 AI 处理器助力打造卓越 AI PC",
|
||||
"id": "52af6cf2dc28",
|
||||
"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": "",
|
||||
"views": 0,
|
||||
"is_pinned": false
|
||||
}
|
||||
]
|
||||
205
data/gpus.json
205
data/gpus.json
@@ -1,12 +1,197 @@
|
||||
[
|
||||
{"id": "h100", "name": "NVIDIA H100", "manufacturer": "NVIDIA", "architecture": "Hopper", "cuda_cores": 16896, "tensor_cores": 528, "memory_gb": 80, "memory_bandwidth_gbs": 3352, "fp32_tflops": 67, "fp16_tflops": 1979, "int8_perf_tops": 3958, "price_usd": 30000, "release_year": 2022, "description": "数据中心顶级GPU,专为AI训练设计"},
|
||||
{"id": "a100", "name": "NVIDIA A100", "manufacturer": "NVIDIA", "architecture": "Ampere", "cuda_cores": 6912, "tensor_cores": 432, "memory_gb": 80, "memory_bandwidth_gbs": 2039, "fp32_tflops": 19.5, "fp16_tflops": 312, "int8_perf_tops": 624, "price_usd": 10000, "release_year": 2020, "description": "数据中心主力GPU,AI训练推理通用"},
|
||||
{"id": "a10040g", "name": "NVIDIA A100 40GB", "manufacturer": "NVIDIA", "architecture": "Ampere", "cuda_cores": 6912, "tensor_cores": 432, "memory_gb": 40, "memory_bandwidth_gbs": 1555, "fp32_tflops": 19.5, "fp16_tflops": 312, "int8_perf_tops": 624, "price_usd": 6000, "release_year": 2020, "description": "A100 40GB版本,性价比更高"},
|
||||
{"id": "l40s", "name": "NVIDIA L40S", "manufacturer": "NVIDIA", "architecture": "Ada Lovelace", "cuda_cores": 18176, "tensor_cores": 568, "memory_gb": 48, "memory_bandwidth_gbs": 864, "fp32_tflops": 91.6, "fp16_tflops": 362, "int8_perf_tops": 724, "price_usd": 7000, "release_year": 2023, "description": "新一代数据中心GPU,推理优化"},
|
||||
{"id": "rtx4090", "name": "NVIDIA RTX 4090", "manufacturer": "NVIDIA", "architecture": "Ada Lovelace", "cuda_cores": 16384, "tensor_cores": 512, "memory_gb": 24, "memory_bandwidth_gbs": 1008, "fp32_tflops": 82.6, "fp16_tflops": 330, "int8_perf_tops": 660, "price_usd": 1600, "release_year": 2022, "description": "消费级最强GPU,适合个人AI开发"},
|
||||
{"id": "rtx4090d", "name": "NVIDIA RTX 4090D", "manufacturer": "NVIDIA", "architecture": "Ada Lovelace", "cuda_cores": 14592, "tensor_cores": 456, "memory_gb": 24, "memory_bandwidth_gbs": 1008, "fp32_tflops": 73.5, "fp16_tflops": 294, "int8_perf_tops": 588, "price_usd": 1400, "release_year": 2024, "description": "4090中国特供版,性能略降"},
|
||||
{"id": "rtx3090", "name": "NVIDIA RTX 3090", "manufacturer": "NVIDIA", "architecture": "Ampere", "cuda_cores": 10496, "tensor_cores": 328, "memory_gb": 24, "memory_bandwidth_gbs": 936, "fp32_tflops": 35.6, "fp16_tflops": 142, "int8_perf_tops": 284, "price_usd": 1200, "release_year": 2020, "description": "上一代旗舰,性价比高"},
|
||||
{"id": "rtx3080", "name": "NVIDIA RTX 3080", "manufacturer": "NVIDIA", "architecture": "Ampere", "cuda_cores": 8704, "tensor_cores": 272, "memory_gb": 10, "memory_bandwidth_gbs": 760, "fp32_tflops": 29.8, "fp16_tflops": 119, "int8_perf_tops": 238, "price_usd": 700, "release_year": 2020, "description": "中高端消费级GPU"},
|
||||
{"id": "v100", "name": "NVIDIA V100", "manufacturer": "NVIDIA", "architecture": "Volta", "cuda_cores": 5120, "tensor_cores": 640, "memory_gb": 32, "memory_bandwidth_gbs": 900, "fp32_tflops": 14.8, "fp16_tflops": 118, "int8_perf_tops": 236, "price_usd": 4000, "release_year": 2017, "description": "上一代数据中心GPU,仍有价值"},
|
||||
{"id": "mi300x", "name": "AMD MI300X", "manufacturer": "AMD", "architecture": "CDNA 3", "cuda_cores": 0, "tensor_cores": 304, "memory_gb": 192, "memory_bandwidth_gbs": 5300, "fp32_tflops": 81.7, "fp16_tflops": 1307, "int8_perf_tops": 2614, "price_usd": 15000, "release_year": 2023, "description": "AMD最强AI GPU,192GB显存"}
|
||||
{
|
||||
"id": "h100",
|
||||
"name": "NVIDIA H100",
|
||||
"manufacturer": "NVIDIA",
|
||||
"architecture": "Hopper",
|
||||
"cuda_cores": 16896,
|
||||
"tensor_cores": 528,
|
||||
"memory_gb": 80,
|
||||
"memory_bandwidth_gbs": 3352,
|
||||
"fp32_tflops": 67,
|
||||
"fp16_tflops": 1979,
|
||||
"int8_perf_tops": 3958,
|
||||
"price_usd": 30000,
|
||||
"release_year": 2022,
|
||||
"description": "数据中心顶级GPU,专为AI训练设计"
|
||||
},
|
||||
{
|
||||
"id": "a100",
|
||||
"name": "NVIDIA A100",
|
||||
"manufacturer": "NVIDIA",
|
||||
"architecture": "Ampere",
|
||||
"cuda_cores": 6912,
|
||||
"tensor_cores": 432,
|
||||
"memory_gb": 80,
|
||||
"memory_bandwidth_gbs": 2039,
|
||||
"fp32_tflops": 19.5,
|
||||
"fp16_tflops": 312,
|
||||
"int8_perf_tops": 624,
|
||||
"price_usd": 10000,
|
||||
"release_year": 2020,
|
||||
"description": "数据中心主力GPU,AI训练推理通用"
|
||||
},
|
||||
{
|
||||
"id": "a10040g",
|
||||
"name": "NVIDIA A100 40GB",
|
||||
"manufacturer": "NVIDIA",
|
||||
"architecture": "Ampere",
|
||||
"cuda_cores": 6912,
|
||||
"tensor_cores": 432,
|
||||
"memory_gb": 40,
|
||||
"memory_bandwidth_gbs": 1555,
|
||||
"fp32_tflops": 19.5,
|
||||
"fp16_tflops": 312,
|
||||
"int8_perf_tops": 624,
|
||||
"price_usd": 6000,
|
||||
"release_year": 2020,
|
||||
"description": "A100 40GB版本,性价比更高"
|
||||
},
|
||||
{
|
||||
"id": "l40s",
|
||||
"name": "NVIDIA L40S",
|
||||
"manufacturer": "NVIDIA",
|
||||
"architecture": "Ada Lovelace",
|
||||
"cuda_cores": 18176,
|
||||
"tensor_cores": 568,
|
||||
"memory_gb": 48,
|
||||
"memory_bandwidth_gbs": 864,
|
||||
"fp32_tflops": 91.6,
|
||||
"fp16_tflops": 362,
|
||||
"int8_perf_tops": 724,
|
||||
"price_usd": 7000,
|
||||
"release_year": 2023,
|
||||
"description": "新一代数据中心GPU,推理优化"
|
||||
},
|
||||
{
|
||||
"id": "rtx4090",
|
||||
"name": "NVIDIA RTX 4090",
|
||||
"manufacturer": "NVIDIA",
|
||||
"architecture": "Ada Lovelace",
|
||||
"cuda_cores": 16384,
|
||||
"tensor_cores": 512,
|
||||
"memory_gb": 24,
|
||||
"memory_bandwidth_gbs": 1008,
|
||||
"fp32_tflops": 82.6,
|
||||
"fp16_tflops": 330,
|
||||
"int8_perf_tops": 660,
|
||||
"price_usd": 1600,
|
||||
"release_year": 2022,
|
||||
"description": "消费级最强GPU,适合个人AI开发"
|
||||
},
|
||||
{
|
||||
"id": "rtx4090d",
|
||||
"name": "NVIDIA RTX 4090D",
|
||||
"manufacturer": "NVIDIA",
|
||||
"architecture": "Ada Lovelace",
|
||||
"cuda_cores": 14592,
|
||||
"tensor_cores": 456,
|
||||
"memory_gb": 24,
|
||||
"memory_bandwidth_gbs": 1008,
|
||||
"fp32_tflops": 73.5,
|
||||
"fp16_tflops": 294,
|
||||
"int8_perf_tops": 588,
|
||||
"price_usd": 1400,
|
||||
"release_year": 2024,
|
||||
"description": "4090中国特供版,性能略降"
|
||||
},
|
||||
{
|
||||
"id": "rtx3090",
|
||||
"name": "NVIDIA RTX 3090",
|
||||
"manufacturer": "NVIDIA",
|
||||
"architecture": "Ampere",
|
||||
"cuda_cores": 10496,
|
||||
"tensor_cores": 328,
|
||||
"memory_gb": 24,
|
||||
"memory_bandwidth_gbs": 936,
|
||||
"fp32_tflops": 35.6,
|
||||
"fp16_tflops": 142,
|
||||
"int8_perf_tops": 284,
|
||||
"price_usd": 1200,
|
||||
"release_year": 2020,
|
||||
"description": "上一代旗舰,性价比高"
|
||||
},
|
||||
{
|
||||
"id": "rtx3080",
|
||||
"name": "NVIDIA RTX 3080",
|
||||
"manufacturer": "NVIDIA",
|
||||
"architecture": "Ampere",
|
||||
"cuda_cores": 8704,
|
||||
"tensor_cores": 272,
|
||||
"memory_gb": 10,
|
||||
"memory_bandwidth_gbs": 760,
|
||||
"fp32_tflops": 29.8,
|
||||
"fp16_tflops": 119,
|
||||
"int8_perf_tops": 238,
|
||||
"price_usd": 700,
|
||||
"release_year": 2020,
|
||||
"description": "中高端消费级GPU"
|
||||
},
|
||||
{
|
||||
"id": "v100",
|
||||
"name": "NVIDIA V100",
|
||||
"manufacturer": "NVIDIA",
|
||||
"architecture": "Volta",
|
||||
"cuda_cores": 5120,
|
||||
"tensor_cores": 640,
|
||||
"memory_gb": 32,
|
||||
"memory_bandwidth_gbs": 900,
|
||||
"fp32_tflops": 14.8,
|
||||
"fp16_tflops": 118,
|
||||
"int8_perf_tops": 236,
|
||||
"price_usd": 4000,
|
||||
"release_year": 2017,
|
||||
"description": "上一代数据中心GPU,仍有价值"
|
||||
},
|
||||
{
|
||||
"id": "mi300x",
|
||||
"name": "AMD MI300X",
|
||||
"manufacturer": "AMD",
|
||||
"architecture": "CDNA 3",
|
||||
"cuda_cores": 0,
|
||||
"tensor_cores": 304,
|
||||
"memory_gb": 192,
|
||||
"memory_bandwidth_gbs": 5300,
|
||||
"fp32_tflops": 81.7,
|
||||
"fp16_tflops": 1307,
|
||||
"int8_perf_tops": 2614,
|
||||
"price_usd": 15000,
|
||||
"release_year": 2023,
|
||||
"description": "AMD最强AI GPU,192GB显存"
|
||||
},
|
||||
{
|
||||
"name": "RTX 6000D",
|
||||
"manufacturer": "NVIDIA",
|
||||
"memory_gb": 84,
|
||||
"cuda_cores": 19968,
|
||||
"description": "NVIDIA为中国市场定制的全新工作站显卡,搭载84GB GDDR7显存、19968个CUDA核心,采用被动散热设计,专为服务器机箱风道优化。显存总线为448位,核心频率为2430MHz,在Geekbench 6 OpenCL测试中获得390,656分。",
|
||||
"id": "f56b2de6fac4",
|
||||
"created_at": "2026-04-20 18:19:14",
|
||||
"visible": true,
|
||||
"raw_text": "据tweaktown报道,NVIDIA为中国市场定制的全新工作站显卡RTX 6000D近日迎来首度拆解。该卡搭载84GB GDDR7显存、19968个CUDA核心,采用被动散热设计,专为服务器机箱风道优化。\n\n\n相较于满血RTX PRO 6000(96GB GDDR7/512-bit),中国特供版RTX 6000D在规格上进行了多处调整。国内团队“技数犬”发布了拆解视频。\n\n据了解,RTX 6000D为无风扇被动散热设计,完全依靠机箱气流降温。\n\nRTX 6000D搭载28颗VRAM模块,总计84GB GDDR7显存,显存总线为448位(相比RTX PRO 6000的96GB/512位有所减少)。\n\nRTX 6000D GPU 核心为156 SM单元,19,968个CUDA核心,比RTX PRO 6000少约17%。\n\nRTX 6000D核心频率为2430MHz(RTX PRO 6000为2600MHz),TDP暂未公布。性能方面,RTX 6000D在Geekbench 6 OpenCL测试中获得390,656分,低于RTX PRO 6000的45–50万分。",
|
||||
"currency": "CNY",
|
||||
"price_usd": 45000,
|
||||
"updated_at": "2026-04-28 11:56:48",
|
||||
"subcategory_id": "professional",
|
||||
"views": 0,
|
||||
"images": []
|
||||
},
|
||||
{
|
||||
"name": "RTX PRO 6000",
|
||||
"description": "这款专业显卡基于 GB202 GPU,拥有 24064 个 CUDA 核心(188 个 SM),运行频率达 2,617 MHz,并配备 96 GB 支持 ECC 校验的 GDDR7 显存。\n\n相比之下,面向游戏市场的旗舰显卡 RTX 5090 虽同样基于 GB202 ,但其 CUDA 核心数量缩减至 21,760 个,频率为 2,410 MHz,显存容量为 32 GB。\n\n96G超大显存RTX PRO 6000Blackwell初次跑分,略逊于RTX 5090\n其测试平台采用了华硕 Pro WS WRX80E-SAGE SE WIFI 主板、AMD 锐龙 Threadripper PRO 3975WX 处理器、512 GB 内存。\n\n在 Geekbench 6.4.0 上,其测试平台 OpenCL 得分仅 368219 分,略低于 RTX 5090 的 376,858 分,差距约 2.3%,外媒认为这主要是由于 RTX PRO 6000 缺乏正式版驱动导致,且显卡功耗可能受限。\n\nRTX PRO 6000 系列将提供两种版本,分别为适用于紧凑型机箱,规格相同的Max-Q 工作站版,但TDP 功耗限制在 300W;以及支持最高600W TDP的标准版,可满足高强度计算需求。",
|
||||
"id": "d246301f2032",
|
||||
"created_at": "2026-04-20 18:21:00",
|
||||
"visible": true,
|
||||
"raw_text": "这款专业显卡基于 GB202 GPU,拥有 24064 个 CUDA 核心(188 个 SM),运行频率达 2,617 MHz,并配备 96 GB 支持 ECC 校验的 GDDR7 显存。\n\n相比之下,面向游戏市场的旗舰显卡 RTX 5090 虽同样基于 GB202 ,但其 CUDA 核心数量缩减至 21,760 个,频率为 2,410 MHz,显存容量为 32 GB。\n\n96G超大显存RTX PRO 6000Blackwell初次跑分,略逊于RTX 5090\n其测试平台采用了华硕 Pro WS WRX80E-SAGE SE WIFI 主板、AMD 锐龙 Threadripper PRO 3975WX 处理器、512 GB 内存。\n\n在 Geekbench 6.4.0 上,其测试平台 OpenCL 得分仅 368219 分,略低于 RTX 5090 的 376,858 分,差距约 2.3%,外媒认为这主要是由于 RTX PRO 6000 缺乏正式版驱动导致,且显卡功耗可能受限。\n\nRTX PRO 6000 系列将提供两种版本,分别为适用于紧凑型机箱,规格相同的Max-Q 工作站版,但TDP 功耗限制在 300W;以及支持最高600W TDP的标准版,可满足高强度计算需求。",
|
||||
"architecture": "GB202",
|
||||
"memory_gb": 96,
|
||||
"cuda_cores": 24064,
|
||||
"currency": "CNY",
|
||||
"price_usd": 65000,
|
||||
"updated_at": "2026-04-28 11:56:38",
|
||||
"manufacturer": "NVIDIA",
|
||||
"subcategory_id": "professional",
|
||||
"views": 0,
|
||||
"images": []
|
||||
}
|
||||
]
|
||||
77
data/items_71fa2b4d818f.json
Normal file
77
data/items_71fa2b4d818f.json
Normal file
@@ -0,0 +1,77 @@
|
||||
[
|
||||
{
|
||||
"name": "Osmo Pocket 4",
|
||||
"brand": "DJI",
|
||||
"price": 2999,
|
||||
"specs": {
|
||||
"传感器类型": "1英寸CMOS",
|
||||
"镜头": "20mm, f/2.0",
|
||||
"ISO范围": "50-12800",
|
||||
"视频分辨率": "4K 60fps",
|
||||
"照片最大分辨率": "5472×3648",
|
||||
"电池容量": "1545mAh",
|
||||
"工作温度": "0°C至40°C"
|
||||
},
|
||||
"id": "597e29af5937",
|
||||
"category_id": "71fa2b4d818f",
|
||||
"created_at": "2026-04-28 00:07:01",
|
||||
"visible": true,
|
||||
"raw_text": "",
|
||||
"images": [
|
||||
"/static/uploads/1ad784e0b3c6_1777305525.png"
|
||||
],
|
||||
"publish_date": "",
|
||||
"views": 0,
|
||||
"is_pinned": false
|
||||
},
|
||||
{
|
||||
"name": "Osmo Pocket 3",
|
||||
"brand": "DJI",
|
||||
"price": 2799,
|
||||
"specs": {
|
||||
"传感器类型": "1英寸CMOS",
|
||||
"镜头": "20mm, f/2.0",
|
||||
"ISO范围": "50-6400",
|
||||
"视频分辨率": "4K 60fps",
|
||||
"照片最大分辨率": "5472×3648",
|
||||
"电池容量": "1300mAh",
|
||||
"工作温度": "0°C至40°C"
|
||||
},
|
||||
"id": "ad10ac80827b",
|
||||
"category_id": "71fa2b4d818f",
|
||||
"created_at": "2026-04-28 00:07:01",
|
||||
"visible": true,
|
||||
"raw_text": "",
|
||||
"images": [
|
||||
"/static/uploads/1ad784e0b3c6_1777305525.png"
|
||||
],
|
||||
"publish_date": "",
|
||||
"views": 0,
|
||||
"is_pinned": false
|
||||
},
|
||||
{
|
||||
"name": "DJI Pocket 2",
|
||||
"brand": "DJI",
|
||||
"price": 1999,
|
||||
"specs": {
|
||||
"传感器类型": "1/1.7英寸CMOS",
|
||||
"镜头": "20mm, f/1.8",
|
||||
"ISO范围": "100-3200",
|
||||
"视频分辨率": "4K 60fps",
|
||||
"照片最大分辨率": "6272×4680",
|
||||
"电池容量": "875mAh",
|
||||
"工作温度": "0°C至40°C"
|
||||
},
|
||||
"id": "0fde0f10ad96",
|
||||
"category_id": "71fa2b4d818f",
|
||||
"created_at": "2026-04-28 00:07:01",
|
||||
"visible": true,
|
||||
"raw_text": "",
|
||||
"images": [
|
||||
"/static/uploads/1ad784e0b3c6_1777305525.png"
|
||||
],
|
||||
"publish_date": "",
|
||||
"views": 0,
|
||||
"is_pinned": false
|
||||
}
|
||||
]
|
||||
@@ -1,9 +1,66 @@
|
||||
[
|
||||
{"id": "k001", "title": "什么是参数量?", "category": "ai-models", "icon": "ri-calculator-line", "content": "参数量(Parameters)是衡量大模型规模的指标,表示模型中权重参数的数量。例如 GPT-3 有 175B 参数,即约1750亿个参数。", "detail": "参数量决定了模型的容量和表达能力。一般来说,参数量越大,模型能力越强,但也需要更多计算资源。\n\n常见规模分类:\n- 小模型:<1B (适合边缘设备)\n- 中模型:1B-10B (消费级GPU可运行)\n- 大模型:10B-100B (需要多GPU)\n- 超大模型:>100B (需要数据中心)", "order": 1},
|
||||
{"id": "k002", "title": "什么是上下文长度?", "category": "ai-models", "icon": "ri-text-wrap", "content": "上下文长度(Context Length)是模型能处理的输入文本最大长度。更长的上下文意味着模型可以理解更长的文档或对话历史。", "detail": "常见长度:\n- 4K:传统长度,适合简单对话\n- 32K:中等长度,适合长文档\n- 128K:超长上下文,如GPT-4 Turbo\n- 200K:Claude 3的极限长度", "order": 2},
|
||||
{"id": "k003", "title": "什么是量化?", "category": "ai-models", "icon": "ri-scales-3-line", "content": "量化(Quantization)是将模型参数从高精度转换为低精度,减少显存占用和计算量。如FP16→INT8→INT4,精度损失可控,资源节省显著。", "detail": "量化效果:\n- FP32→FP16: 显存减半,精度基本不变\n- FP16→INT8: 显存再减半,精度略降\n- INT8→INT4: 显存再减半,需特殊技术\n\n推荐工具:llama.cpp、GPTQ、AWQ等", "order": 3},
|
||||
{"id": "k004", "title": "什么是MMLU?", "category": "ai-models", "icon": "ri-bar-chart-box-line", "content": "MMLU(Massive Multitask Language Understanding)是评估大模型综合能力的标准测试集,覆盖57个学科领域。", "detail": "分数参考:\n- 60-70%:入门级,如GPT-3\n- 70-80%:中等水平,如Llama 2 70B\n- 80-90%:优秀水平,如GPT-4、Claude 3", "order": 4},
|
||||
{"id": "k005", "title": "如何计算显存需求?", "category": "gpus", "icon": "ri-memory-line", "content": "模型显存需求 ≈ 参数量 × 每参数字节数 × 1.3(含KV Cache开销)", "detail": "计算公式:\n- FP32: 参数量 × 4字节 × 1.3\n- FP16: 参数量 × 2字节 × 1.3\n- INT8: 参数量 × 1字节 × 1.3\n- INT4: 参数量 × 0.5字节 × 1.3\n\n例如:7B模型FP16加载需要约 7 × 2 × 1.3 ≈ 18GB显存", "order": 1},
|
||||
{"id": "k006", "title": "GPU架构演进", "category": "gpus", "icon": "ri-history-line", "content": "NVIDIA GPU架构从Fermi到Hopper,每一代都有显著提升。了解架构有助于选择合适的GPU。", "detail": "主要架构:\n- Volta (2017): V100, 引入Tensor Core\n- Turing (2018): RTX 20系列, RT Core\n- Ampere (2020): A100, RTX 30系列\n- Hopper (2022): H100, FP8支持\n- Ada Lovelace (2022): RTX 40系列, L40S", "order": 2},
|
||||
{"id": "k007", "title": "CPU核心数选择", "category": "cpus", "icon": "ri-database-2-line", "content": "CPU核心数的选择取决于应用场景。更多核心适合并行任务,但单核性能也很重要。", "detail": "场景推荐:\n- 办公/日常:4-6核足够\n- 开发/编译:8-16核\n- 服务器/虚拟化:16-64核\n- 高性能计算:64核以上\n\n注意:AI训练主要依赖GPU,CPU主要用于数据预处理", "order": 1}
|
||||
{
|
||||
"id": "k001",
|
||||
"title": "什么是参数量?",
|
||||
"category": "ai-models",
|
||||
"icon": "ri-calculator-line",
|
||||
"content": "参数量(Parameters)是衡量大模型规模的指标,表示模型中权重参数的数量。例如 GPT-3 有 175B 参数,即约1750亿个参数。",
|
||||
"detail": "参数量决定了模型的容量和表达能力。一般来说,参数量越大,模型能力越强,但也需要更多计算资源。\n\n常见规模分类:\n- 小模型:<1B (适合边缘设备)\n- 中模型:1B-10B (消费级GPU可运行)\n- 大模型:10B-100B (需要多GPU)\n- 超大模型:>100B (需要数据中心)",
|
||||
"order": 1
|
||||
},
|
||||
{
|
||||
"id": "k002",
|
||||
"title": "什么是上下文长度?",
|
||||
"category": "ai-models",
|
||||
"icon": "ri-text-wrap",
|
||||
"content": "上下文长度(Context Length)是模型能处理的输入文本最大长度。更长的上下文意味着模型可以理解更长的文档或对话历史。",
|
||||
"detail": "常见长度:\n- 4K:传统长度,适合简单对话\n- 32K:中等长度,适合长文档\n- 128K:超长上下文,如GPT-4 Turbo\n- 200K:Claude 3的极限长度",
|
||||
"order": 2
|
||||
},
|
||||
{
|
||||
"id": "k003",
|
||||
"title": "什么是量化?",
|
||||
"category": "ai-models",
|
||||
"icon": "ri-scales-3-line",
|
||||
"content": "量化(Quantization)是将模型参数从高精度转换为低精度,减少显存占用和计算量。如FP16→INT8→INT4,精度损失可控,资源节省显著。",
|
||||
"detail": "量化效果:\n- FP32→FP16: 显存减半,精度基本不变\n- FP16→INT8: 显存再减半,精度略降\n- INT8→INT4: 显存再减半,需特殊技术\n\n推荐工具:llama.cpp、GPTQ、AWQ等",
|
||||
"order": 3
|
||||
},
|
||||
{
|
||||
"id": "k004",
|
||||
"title": "什么是MMLU?",
|
||||
"category": "ai-models",
|
||||
"icon": "ri-bar-chart-box-line",
|
||||
"content": "MMLU(Massive Multitask Language Understanding)是评估大模型综合能力的标准测试集,覆盖57个学科领域。",
|
||||
"detail": "分数参考:\n- 60-70%:入门级,如GPT-3\n- 70-80%:中等水平,如Llama 2 70B\n- 80-90%:优秀水平,如GPT-4、Claude 3",
|
||||
"order": 4,
|
||||
"visible": false
|
||||
},
|
||||
{
|
||||
"id": "k005",
|
||||
"title": "如何计算显存需求?",
|
||||
"category": "gpus",
|
||||
"icon": "ri-memory-line",
|
||||
"content": "模型显存需求 ≈ 参数量 × 每参数字节数 × 1.3(含KV Cache开销)",
|
||||
"detail": "计算公式:\n- FP32: 参数量 × 4字节 × 1.3\n- FP16: 参数量 × 2字节 × 1.3\n- INT8: 参数量 × 1字节 × 1.3\n- INT4: 参数量 × 0.5字节 × 1.3\n\n例如:7B模型FP16加载需要约 7 × 2 × 1.3 ≈ 18GB显存",
|
||||
"order": 1
|
||||
},
|
||||
{
|
||||
"id": "k006",
|
||||
"title": "GPU架构演进",
|
||||
"category": "gpus",
|
||||
"icon": "ri-history-line",
|
||||
"content": "NVIDIA GPU架构从Fermi到Hopper,每一代都有显著提升。了解架构有助于选择合适的GPU。",
|
||||
"detail": "主要架构:\n- Volta (2017): V100, 引入Tensor Core\n- Turing (2018): RTX 20系列, RT Core\n- Ampere (2020): A100, RTX 30系列\n- Hopper (2022): H100, FP8支持\n- Ada Lovelace (2022): RTX 40系列, L40S",
|
||||
"order": 2
|
||||
},
|
||||
{
|
||||
"id": "k007",
|
||||
"title": "CPU核心数选择",
|
||||
"category": "cpus",
|
||||
"icon": "ri-database-2-line",
|
||||
"content": "CPU核心数的选择取决于应用场景。更多核心适合并行任务,但单核性能也很重要。",
|
||||
"detail": "场景推荐:\n- 办公/日常:4-6核足够\n- 开发/编译:8-16核\n- 服务器/虚拟化:16-64核\n- 高性能计算:64核以上\n\n注意:AI训练主要依赖GPU,CPU主要用于数据预处理",
|
||||
"order": 1
|
||||
}
|
||||
]
|
||||
@@ -9,11 +9,16 @@
|
||||
"input_price": 0.03,
|
||||
"output_price": 0.06,
|
||||
"mmlu": 86.4,
|
||||
"humaneval": 67.0,
|
||||
"humaneval": 67,
|
||||
"is_open_source": false,
|
||||
"license": "Proprietary",
|
||||
"description": "OpenAI最强大的多模态大模型",
|
||||
"created_at": "2024-01-01"
|
||||
"created_at": "2024-01-01",
|
||||
"updated_at": "2026-04-28 11:57:02",
|
||||
"raw_text": "\nGPT-4 Turbo version with 128K context length, price is $10 per 1M input tokens",
|
||||
"subcategory_id": "chat",
|
||||
"views": 0,
|
||||
"images": []
|
||||
},
|
||||
{
|
||||
"id": "gpt4turbo",
|
||||
@@ -190,6 +195,6 @@
|
||||
"license": "Proprietary",
|
||||
"description": "智谱AI大模型,中文能力强",
|
||||
"created_at": "2024-01-01",
|
||||
"visible": true
|
||||
"visible": false
|
||||
}
|
||||
]
|
||||
28303
logs/app.log
Normal file
28303
logs/app.log
Normal file
File diff suppressed because it is too large
Load Diff
BIN
static/uploads/1ad784e0b3c6_1777305525.png
Normal file
BIN
static/uploads/1ad784e0b3c6_1777305525.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
BIN
static/uploads/76f233ccdb91_1777287579.png
Normal file
BIN
static/uploads/76f233ccdb91_1777287579.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
BIN
static/uploads/8db761aed139_1777286554.png
Normal file
BIN
static/uploads/8db761aed139_1777286554.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
BIN
static/uploads/c6d7bedba2b0_1777286375.png
Normal file
BIN
static/uploads/c6d7bedba2b0_1777286375.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 289 B |
BIN
static/uploads/d2149794b5d3_1777286192.png
Normal file
BIN
static/uploads/d2149794b5d3_1777286192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 289 B |
@@ -130,6 +130,9 @@
|
||||
<h1 class="text-2xl font-bold text-gray-800">分类管理</h1>
|
||||
<button onclick="openAddModal('category')" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700"><i class="ri-add-line mr-2"></i>添加分类</button>
|
||||
</div>
|
||||
<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模型、GPU、CPU)的子类别配置可在此编辑,其数据管理入口在左侧导航栏的独立页面。</p>
|
||||
</div>
|
||||
<div class="bg-white rounded-xl shadow-sm overflow-hidden">
|
||||
<table class="w-full">
|
||||
<thead class="bg-gray-50 border-b">
|
||||
@@ -137,8 +140,8 @@
|
||||
<th class="px-4 py-3 text-left text-sm font-medium text-gray-600">图标</th>
|
||||
<th class="px-4 py-3 text-left text-sm font-medium text-gray-600">ID</th>
|
||||
<th class="px-4 py-3 text-left text-sm font-medium text-gray-600">名称</th>
|
||||
<th class="px-4 py-3 text-left text-sm font-medium text-gray-600">描述</th>
|
||||
<th class="px-4 py-3 text-center text-sm font-medium text-gray-600">显示</th>
|
||||
<th class="px-4 py-3 text-left text-sm font-medium text-gray-600">类型</th>
|
||||
<th class="px-4 py-3 text-left text-sm font-medium text-gray-600">子类别</th>
|
||||
<th class="px-4 py-3 text-center text-sm font-medium text-gray-600">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -156,6 +159,11 @@
|
||||
<button onclick="openAddModal('dynamic')" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700"><i class="ri-add-line mr-2"></i>手动添加</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-gray-50 rounded-lg p-3 mb-4 flex items-center gap-4" id="dynamic-filter-area">
|
||||
<span class="text-sm text-gray-600">子类别筛选:</span>
|
||||
<button onclick="filterDynamicBySubcategory('')" class="px-3 py-1 rounded text-sm bg-white border text-gray-600 hover:bg-gray-100">全部</button>
|
||||
<div id="dynamic-subcategory-filters" class="flex gap-2"></div>
|
||||
</div>
|
||||
<div class="bg-white rounded-xl shadow-sm overflow-hidden">
|
||||
<table class="w-full"><tbody id="admin-dynamic-table"><tr><td class="text-center text-gray-400 py-8">加载中...</td></tr></tbody></table>
|
||||
</div>
|
||||
@@ -170,6 +178,11 @@
|
||||
<button onclick="openAddModal('model')" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700"><i class="ri-add-line mr-2"></i>手动添加</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-gray-50 rounded-lg p-3 mb-4 flex items-center gap-4">
|
||||
<span class="text-sm text-gray-600">子类别筛选:</span>
|
||||
<button onclick="filterModelsBySubcategory('')" class="px-3 py-1 rounded text-sm bg-white border text-gray-600 hover:bg-gray-100">全部</button>
|
||||
<div id="model-subcategory-filters" class="flex gap-2"></div>
|
||||
</div>
|
||||
<div class="bg-white rounded-xl shadow-sm overflow-x-auto">
|
||||
<table class="w-full min-w-[1200px]">
|
||||
<thead class="bg-gray-50 border-b">
|
||||
@@ -177,18 +190,17 @@
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">置顶</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">名称</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">厂商</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">子类别</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">参数量</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">上下文</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">类型</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">发布日期</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">热度</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">创建时间</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">更新时间</th>
|
||||
<th class="px-3 py-3 text-center text-sm font-medium text-gray-600">显示</th>
|
||||
<th class="px-3 py-3 text-center text-sm font-medium text-gray-600">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="admin-models-table"><tr><td colspan="12" class="text-center text-gray-400 py-8">加载中...</td></tr></tbody>
|
||||
<tbody id="admin-models-table"><tr><td colspan="11" class="text-center text-gray-400 py-8">加载中...</td></tr></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
@@ -202,6 +214,11 @@
|
||||
<button onclick="openAddModal('gpu')" class="px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700"><i class="ri-add-line mr-2"></i>手动添加</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-gray-50 rounded-lg p-3 mb-4 flex items-center gap-4">
|
||||
<span class="text-sm text-gray-600">子类别筛选:</span>
|
||||
<button onclick="filterGpusBySubcategory('')" class="px-3 py-1 rounded text-sm bg-white border text-gray-600 hover:bg-gray-100">全部</button>
|
||||
<div id="gpu-subcategory-filters" class="flex gap-2"></div>
|
||||
</div>
|
||||
<div class="bg-white rounded-xl shadow-sm overflow-x-auto">
|
||||
<table class="w-full min-w-[1200px]">
|
||||
<thead class="bg-gray-50 border-b">
|
||||
@@ -209,18 +226,17 @@
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">置顶</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">名称</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">厂商</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">子类别</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">显存</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">架构</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">价格</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">发布日期</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">热度</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">创建时间</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">更新时间</th>
|
||||
<th class="px-3 py-3 text-center text-sm font-medium text-gray-600">显示</th>
|
||||
<th class="px-3 py-3 text-center text-sm font-medium text-gray-600">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="admin-gpus-table"><tr><td colspan="12" class="text-center text-gray-400 py-8">加载中...</td></tr></tbody>
|
||||
<tbody id="admin-gpus-table"><tr><td colspan="11" class="text-center text-gray-400 py-8">加载中...</td></tr></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
@@ -234,6 +250,11 @@
|
||||
<button onclick="openAddModal('cpu')" class="px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700"><i class="ri-add-line mr-2"></i>手动添加</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-gray-50 rounded-lg p-3 mb-4 flex items-center gap-4">
|
||||
<span class="text-sm text-gray-600">子类别筛选:</span>
|
||||
<button onclick="filterCpusBySubcategory('')" class="px-3 py-1 rounded text-sm bg-white border text-gray-600 hover:bg-gray-100">全部</button>
|
||||
<div id="cpu-subcategory-filters" class="flex gap-2"></div>
|
||||
</div>
|
||||
<div class="bg-white rounded-xl shadow-sm overflow-x-auto">
|
||||
<table class="w-full min-w-[1200px]">
|
||||
<thead class="bg-gray-50 border-b">
|
||||
@@ -241,18 +262,17 @@
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">置顶</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">名称</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">厂商</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">子类别</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">核心/线程</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">主频</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">价格</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">发布日期</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">热度</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">创建时间</th>
|
||||
<th class="px-3 py-3 text-left text-sm font-medium text-gray-600">更新时间</th>
|
||||
<th class="px-3 py-3 text-center text-sm font-medium text-gray-600">显示</th>
|
||||
<th class="px-3 py-3 text-center text-sm font-medium text-gray-600">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="admin-cpus-table"><tr><td colspan="12" class="text-center text-gray-400 py-8">加载中...</td></tr></tbody>
|
||||
<tbody id="admin-cpus-table"><tr><td colspan="11" class="text-center text-gray-400 py-8">加载中...</td></tr></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
@@ -299,6 +319,7 @@
|
||||
<div id="modalContent" class="p-6"></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="saveItem()" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -386,6 +407,57 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 智能补充弹窗 -->
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
<div class="mb-6">
|
||||
<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>选择图片(支持多选)
|
||||
</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>粘贴图片
|
||||
</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>清空图片
|
||||
</button>
|
||||
</div>
|
||||
<div class="mt-3 text-xs text-gray-400">
|
||||
<i class="ri-information-line mr-1"></i>
|
||||
已选择 <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>
|
||||
</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>
|
||||
<div class="bg-gray-50 rounded-lg p-4 text-sm text-gray-600" id="smartUpdateResult">
|
||||
<!-- 解析结果显示 -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-6 border-t flex justify-end gap-4 sticky bottom-0 bg-white">
|
||||
<button onclick="closeSmartUpdateModal()" class="px-4 py-2 bg-gray-200 text-gray-600 rounded-lg hover:bg-gray-300">取消</button>
|
||||
<button onclick="smartUpdateSubmit()" id="smartUpdateSubmitBtn" class="px-4 py-2 bg-orange-600 text-white rounded-lg hover:bg-orange-700"><i class="ri-magic-line mr-1"></i>解析并补充</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let currentType = '';
|
||||
let currentId = '';
|
||||
@@ -393,6 +465,46 @@
|
||||
let categories = [];
|
||||
let currentFilter = '';
|
||||
let dynamicCategoryId = '';
|
||||
let modelSubcategoryFilter = '';
|
||||
let gpuSubcategoryFilter = '';
|
||||
let cpuSubcategoryFilter = '';
|
||||
let dynamicSubcategoryFilter = '';
|
||||
|
||||
// 生成随机ID(12位十六进制)
|
||||
function generateId() {
|
||||
return Math.random().toString(16).slice(2, 8) + Math.random().toString(16).slice(2, 8);
|
||||
}
|
||||
|
||||
// 获取子类别名称
|
||||
function getSubcategoryName(categoryId, subcategoryId) {
|
||||
const cat = categories.find(c => c.id === categoryId);
|
||||
if (!cat || !cat.subcategories) return '-';
|
||||
const sub = cat.subcategories.find(s => s.id === subcategoryId);
|
||||
return sub ? sub.name : '-';
|
||||
}
|
||||
|
||||
// 获取子类别图标
|
||||
function getSubcategoryIcon(categoryId, subcategoryId) {
|
||||
const cat = categories.find(c => c.id === categoryId);
|
||||
if (!cat || !cat.subcategories) return '';
|
||||
const sub = cat.subcategories.find(s => s.id === subcategoryId);
|
||||
return sub ? sub.icon : '';
|
||||
}
|
||||
|
||||
// 渲染子类别筛选按钮
|
||||
function renderSubcategoryFilters(categoryId, containerId, filterFunction) {
|
||||
const cat = categories.find(c => c.id === categoryId);
|
||||
const container = document.getElementById(containerId);
|
||||
if (!cat || !cat.subcategories || cat.subcategories.length === 0) {
|
||||
container.innerHTML = '';
|
||||
return;
|
||||
}
|
||||
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>
|
||||
`).join('');
|
||||
}
|
||||
|
||||
const colorMap = {
|
||||
blue: 'bg-blue-100 text-blue-600',
|
||||
@@ -522,6 +634,7 @@
|
||||
// 显示动态分类数据
|
||||
async function showDynamicCategory(categoryId) {
|
||||
dynamicCategoryId = categoryId;
|
||||
dynamicSubcategoryFilter = ''; // 重置筛选
|
||||
const cat = categories.find(c => c.id === categoryId);
|
||||
|
||||
document.querySelectorAll('section').forEach(s => s.classList.add('hidden'));
|
||||
@@ -539,21 +652,44 @@
|
||||
|
||||
document.getElementById('dynamic-title').textContent = cat.name + '管理';
|
||||
|
||||
// 渲染子类别筛选按钮
|
||||
if (cat.subcategories && cat.subcategories.length > 0) {
|
||||
document.getElementById('dynamic-filter-area').classList.remove('hidden');
|
||||
renderSubcategoryFilters(categoryId, 'dynamic-subcategory-filters', 'filterDynamicBySubcategory');
|
||||
} else {
|
||||
document.getElementById('dynamic-filter-area').classList.add('hidden');
|
||||
}
|
||||
|
||||
// 加载该分类的数据(后台显示全部,包括隐藏的)
|
||||
const res = await fetch(`/api/items/${categoryId}?all=1`);
|
||||
const items = await res.json();
|
||||
let items = await res.json();
|
||||
|
||||
// 子类别筛选
|
||||
if (dynamicSubcategoryFilter) {
|
||||
items = items.filter(i => i.subcategory_id === dynamicSubcategoryFilter);
|
||||
}
|
||||
|
||||
if (items.length === 0) {
|
||||
document.getElementById('admin-dynamic-table').innerHTML = '<tr><td class="text-center text-gray-400 py-8">暂无数据,点击上方"添加数据"按钮添加</td></tr>';
|
||||
} else {
|
||||
const keys = Object.keys(items[0]).filter(k => !['id', 'created_at', 'updated_at', 'visible', 'raw_text'].includes(k));
|
||||
const keys = Object.keys(items[0]).filter(k => !['id', 'created_at', 'updated_at', 'visible', 'raw_text', 'subcategory_id'].includes(k));
|
||||
let html = `<thead class="bg-gray-50 border-b"><tr>`;
|
||||
// 添加子类别列
|
||||
if (cat.subcategories && cat.subcategories.length > 0) {
|
||||
html += `<th class="px-4 py-3 text-left text-sm font-medium text-gray-600">子类别</th>`;
|
||||
}
|
||||
keys.forEach(k => { html += `<th class="px-4 py-3 text-left text-sm font-medium text-gray-600">${k}</th>`; });
|
||||
html += `<th class="px-4 py-3 text-center 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></tr></thead><tbody>`;
|
||||
|
||||
items.forEach(item => {
|
||||
html += `<tr class="border-b hover:bg-gray-50 ${item.visible === false ? 'bg-gray-100 opacity-60' : ''}">`;
|
||||
// 子类别显示
|
||||
if (cat.subcategories && cat.subcategories.length > 0) {
|
||||
const subName = getSubcategoryName(categoryId, item.subcategory_id);
|
||||
const subIcon = getSubcategoryIcon(categoryId, item.subcategory_id);
|
||||
html += `<td class="px-4 py-3">${item.subcategory_id ? `<span class="px-2 py-1 bg-indigo-100 text-indigo-600 rounded text-xs"><i class="${subIcon} mr-1"></i>${subName}</span>` : '<span class="text-gray-400">-</span>'}</td>`;
|
||||
}
|
||||
keys.forEach(k => { html += `<td class="px-4 py-3 text-gray-600">${item[k] || '-'}</td>`; });
|
||||
html += `<td class="px-4 py-3 text-center">
|
||||
<button onclick="toggleVisible('dynamic', '${item.id}')" class="${item.visible === false ? 'text-gray-400' : 'text-green-600'} hover:opacity-80" title="${item.visible === false ? '点击显示' : '点击隐藏'}">
|
||||
@@ -570,6 +706,11 @@
|
||||
document.getElementById('admin-dynamic-table').innerHTML = html;
|
||||
}
|
||||
}
|
||||
|
||||
function filterDynamicBySubcategory(subId) {
|
||||
dynamicSubcategoryFilter = subId;
|
||||
showDynamicCategory(dynamicCategoryId);
|
||||
}
|
||||
|
||||
// 切换显示区域
|
||||
function showSection(section) {
|
||||
@@ -702,6 +843,9 @@
|
||||
: '<div class="text-gray-400">暂无数据</div>';
|
||||
}
|
||||
|
||||
// 内置分类列表
|
||||
const builtinCategories = ['ai-models', 'gpus', 'cpus'];
|
||||
|
||||
// 加载分类列表
|
||||
async function loadAdminCategories() {
|
||||
const res = await fetch('/api/categories?all=1');
|
||||
@@ -712,30 +856,41 @@
|
||||
return;
|
||||
}
|
||||
|
||||
document.getElementById('admin-categories-table').innerHTML = categories.map(c => `
|
||||
<tr class="border-b hover:bg-gray-50 ${c.visible === false ? 'bg-gray-100 opacity-60' : ''}">
|
||||
document.getElementById('admin-categories-table').innerHTML = categories.map(c => {
|
||||
const isBuiltin = builtinCategories.includes(c.id);
|
||||
const subcatCount = (c.subcategories || []).length;
|
||||
return `
|
||||
<tr class="border-b hover:bg-gray-50 ${c.visible === false ? 'bg-gray-100 opacity-60' : ''} ${isBuiltin ? 'bg-indigo-50' : ''}">
|
||||
<td class="px-4 py-3"><div class="w-10 h-10 rounded-lg ${colorMap[c.color] || 'bg-gray-100 text-gray-600'} flex items-center justify-center"><i class="${c.icon} text-xl"></i></div></td>
|
||||
<td class="px-4 py-3 text-gray-500 text-sm font-mono">${c.id}</td>
|
||||
<td class="px-4 py-3 font-medium text-gray-800">${c.name}</td>
|
||||
<td class="px-4 py-3 text-gray-600 text-sm">${c.description || '-'}</td>
|
||||
<td class="px-4 py-3 text-center">
|
||||
<button onclick="toggleVisible('category', '${c.id}')" class="${c.visible === false ? 'text-gray-400' : 'text-green-600'} hover:opacity-80" title="${c.visible === false ? '点击显示' : '点击隐藏'}">
|
||||
<i class="${c.visible === false ? 'ri-eye-off-line' : 'ri-eye-line'}"></i>
|
||||
</button>
|
||||
<td class="px-4 py-3 text-sm">
|
||||
${isBuiltin ? '<span class="px-2 py-1 bg-indigo-100 text-indigo-600 rounded text-xs">内置</span>' : '<span class="text-gray-500">自定义</span>'}
|
||||
</td>
|
||||
<td class="px-4 py-3 text-sm">
|
||||
${subcatCount > 0 ? `<span class="px-2 py-1 bg-green-100 text-green-600 rounded text-xs">${subcatCount} 个</span>` : '<span class="text-gray-400">无</span>'}
|
||||
</td>
|
||||
<td class="px-4 py-3 text-center">
|
||||
<button onclick="editItem('category', '${c.id}')" class="text-blue-600 hover:text-blue-800 mr-2"><i class="ri-edit-line"></i></button>
|
||||
<button onclick="deleteItem('category', '${c.id}')" class="text-red-600 hover:text-red-800"><i class="ri-delete-bin-line"></i></button>
|
||||
<button onclick="editItem('category', '${c.id}')" class="text-blue-600 hover:text-blue-800 mr-2" title="编辑子类别"><i class="ri-edit-line"></i></button>
|
||||
${!isBuiltin ? `<button onclick="deleteItem('category', '${c.id}')" class="text-red-600 hover:text-red-800" title="删除"><i class="ri-delete-bin-line"></i></button>` : '<span class="text-gray-300 cursor-not-allowed"><i class="ri-delete-bin-line"></i></span>'}
|
||||
</td>
|
||||
</tr>
|
||||
`).join('');
|
||||
`;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
// 加载模型列表
|
||||
async function loadAdminModels() {
|
||||
renderSubcategoryFilters('ai-models', 'model-subcategory-filters', 'filterModelsBySubcategory');
|
||||
const res = await fetch('/api/models?all=1');
|
||||
const models = await res.json();
|
||||
if (models.length === 0) { document.getElementById('admin-models-table').innerHTML = '<tr><td colspan="12" class="text-center text-gray-400 py-8">暂无数据</td></tr>'; return; }
|
||||
let models = await res.json();
|
||||
|
||||
// 子类别筛选
|
||||
if (modelSubcategoryFilter) {
|
||||
models = models.filter(m => m.subcategory_id === modelSubcategoryFilter);
|
||||
}
|
||||
|
||||
if (models.length === 0) { document.getElementById('admin-models-table').innerHTML = '<tr><td colspan="11" class="text-center text-gray-400 py-8">暂无数据</td></tr>'; return; }
|
||||
document.getElementById('admin-models-table').innerHTML = models.map(m => `
|
||||
<tr class="border-b hover:bg-gray-50 ${m.visible === false ? 'bg-gray-100 opacity-60' : ''} ${m.is_pinned ? 'bg-yellow-50' : ''}">
|
||||
<td class="px-3 py-3 text-center">
|
||||
@@ -745,13 +900,14 @@
|
||||
</td>
|
||||
<td class="px-3 py-3 font-medium text-gray-800">${m.name}</td>
|
||||
<td class="px-3 py-3 text-gray-600">${m.organization}</td>
|
||||
<td class="px-3 py-3">
|
||||
${m.subcategory_id ? `<span class="px-2 py-1 bg-blue-100 text-blue-600 rounded text-xs"><i class="${getSubcategoryIcon('ai-models', m.subcategory_id)} mr-1"></i>${getSubcategoryName('ai-models', m.subcategory_id)}</span>` : '<span class="text-gray-400">-</span>'}
|
||||
</td>
|
||||
<td class="px-3 py-3">${m.parameters}B</td>
|
||||
<td class="px-3 py-3 text-gray-600">${m.context_length || '-'}</td>
|
||||
<td class="px-3 py-3">${m.is_open_source ? '<span class="text-green-600">开源</span>' : '<span class="text-gray-600">商业</span>'}</td>
|
||||
<td class="px-3 py-3 text-gray-500 text-sm">${m.publish_date || '-'}</td>
|
||||
<td class="px-3 py-3 text-gray-500 text-sm">${m.views || 0}</td>
|
||||
<td class="px-3 py-3 text-gray-500 text-sm">${formatDateShort(m.created_at)}</td>
|
||||
<td class="px-3 py-3 text-gray-500 text-sm">${formatDateShort(m.updated_at)}</td>
|
||||
<td class="px-3 py-3 text-center">
|
||||
<button onclick="toggleVisible('model', '${m.id}')" class="${m.visible === false ? 'text-gray-400' : 'text-green-600'} hover:opacity-80" title="${m.visible === false ? '点击显示' : '点击隐藏'}">
|
||||
<i class="${m.visible === false ? 'ri-eye-off-line' : 'ri-eye-line'}"></i>
|
||||
@@ -765,12 +921,24 @@
|
||||
</tr>
|
||||
`).join('');
|
||||
}
|
||||
|
||||
function filterModelsBySubcategory(subId) {
|
||||
modelSubcategoryFilter = subId;
|
||||
loadAdminModels();
|
||||
}
|
||||
|
||||
// 加载GPU列表
|
||||
async function loadAdminGpus() {
|
||||
renderSubcategoryFilters('gpus', 'gpu-subcategory-filters', 'filterGpusBySubcategory');
|
||||
const res = await fetch('/api/gpus?all=1');
|
||||
const gpus = await res.json();
|
||||
if (gpus.length === 0) { document.getElementById('admin-gpus-table').innerHTML = '<tr><td colspan="12" class="text-center text-gray-400 py-8">暂无数据</td></tr>'; return; }
|
||||
let gpus = await res.json();
|
||||
|
||||
// 子类别筛选
|
||||
if (gpuSubcategoryFilter) {
|
||||
gpus = gpus.filter(g => g.subcategory_id === gpuSubcategoryFilter);
|
||||
}
|
||||
|
||||
if (gpus.length === 0) { document.getElementById('admin-gpus-table').innerHTML = '<tr><td colspan="11" class="text-center text-gray-400 py-8">暂无数据</td></tr>'; return; }
|
||||
document.getElementById('admin-gpus-table').innerHTML = gpus.map(g => `
|
||||
<tr class="border-b hover:bg-gray-50 ${g.visible === false ? 'bg-gray-100 opacity-60' : ''} ${g.is_pinned ? 'bg-yellow-50' : ''}">
|
||||
<td class="px-3 py-3 text-center">
|
||||
@@ -780,13 +948,14 @@
|
||||
</td>
|
||||
<td class="px-3 py-3 font-medium text-gray-800">${g.name}</td>
|
||||
<td class="px-3 py-3 text-gray-600">${g.manufacturer}</td>
|
||||
<td class="px-3 py-3">
|
||||
${g.subcategory_id ? `<span class="px-2 py-1 bg-green-100 text-green-600 rounded text-xs"><i class="${getSubcategoryIcon('gpus', g.subcategory_id)} mr-1"></i>${getSubcategoryName('gpus', g.subcategory_id)}</span>` : '<span class="text-gray-400">-</span>'}
|
||||
</td>
|
||||
<td class="px-3 py-3">${g.memory_gb}GB</td>
|
||||
<td class="px-3 py-3 text-gray-600">${g.architecture || '-'}</td>
|
||||
<td class="px-3 py-3 text-gray-600">${formatPrice(g)}</td>
|
||||
<td class="px-3 py-3 text-gray-500 text-sm">${g.publish_date || '-'}</td>
|
||||
<td class="px-3 py-3 text-gray-500 text-sm">${g.views || 0}</td>
|
||||
<td class="px-3 py-3 text-gray-500 text-sm">${formatDateShort(g.created_at)}</td>
|
||||
<td class="px-3 py-3 text-gray-500 text-sm">${formatDateShort(g.updated_at)}</td>
|
||||
<td class="px-3 py-3 text-center">
|
||||
<button onclick="toggleVisible('gpu', '${g.id}')" class="${g.visible === false ? 'text-gray-400' : 'text-green-600'} hover:opacity-80" title="${g.visible === false ? '点击显示' : '点击隐藏'}">
|
||||
<i class="${g.visible === false ? 'ri-eye-off-line' : 'ri-eye-line'}"></i>
|
||||
@@ -800,12 +969,24 @@
|
||||
</tr>
|
||||
`).join('');
|
||||
}
|
||||
|
||||
function filterGpusBySubcategory(subId) {
|
||||
gpuSubcategoryFilter = subId;
|
||||
loadAdminGpus();
|
||||
}
|
||||
|
||||
// 加载CPU列表
|
||||
async function loadAdminCpus() {
|
||||
renderSubcategoryFilters('cpus', 'cpu-subcategory-filters', 'filterCpusBySubcategory');
|
||||
const res = await fetch('/api/cpus?all=1');
|
||||
const cpus = await res.json();
|
||||
if (cpus.length === 0) { document.getElementById('admin-cpus-table').innerHTML = '<tr><td colspan="12" class="text-center text-gray-400 py-8">暂无数据</td></tr>'; return; }
|
||||
let cpus = await res.json();
|
||||
|
||||
// 子类别筛选
|
||||
if (cpuSubcategoryFilter) {
|
||||
cpus = cpus.filter(c => c.subcategory_id === cpuSubcategoryFilter);
|
||||
}
|
||||
|
||||
if (cpus.length === 0) { document.getElementById('admin-cpus-table').innerHTML = '<tr><td colspan="11" class="text-center text-gray-400 py-8">暂无数据</td></tr>'; return; }
|
||||
document.getElementById('admin-cpus-table').innerHTML = cpus.map(c => `
|
||||
<tr class="border-b hover:bg-gray-50 ${c.visible === false ? 'bg-gray-100 opacity-60' : ''} ${c.is_pinned ? 'bg-yellow-50' : ''}">
|
||||
<td class="px-3 py-3 text-center">
|
||||
@@ -815,13 +996,14 @@
|
||||
</td>
|
||||
<td class="px-3 py-3 font-medium text-gray-800">${c.name}</td>
|
||||
<td class="px-3 py-3 text-gray-600">${c.manufacturer}</td>
|
||||
<td class="px-3 py-3">
|
||||
${c.subcategory_id ? `<span class="px-2 py-1 bg-purple-100 text-purple-600 rounded text-xs"><i class="${getSubcategoryIcon('cpus', c.subcategory_id)} mr-1"></i>${getSubcategoryName('cpus', c.subcategory_id)}</span>` : '<span class="text-gray-400">-</span>'}
|
||||
</td>
|
||||
<td class="px-3 py-3">${c.cores}/${c.threads}</td>
|
||||
<td class="px-3 py-3 text-gray-600">${c.base_clock_ghz || '-'}-${c.boost_clock_ghz || '-'}GHz</td>
|
||||
<td class="px-3 py-3 text-gray-600">${formatPrice(c)}</td>
|
||||
<td class="px-3 py-3 text-gray-500 text-sm">${c.publish_date || '-'}</td>
|
||||
<td class="px-3 py-3 text-gray-500 text-sm">${c.views || 0}</td>
|
||||
<td class="px-3 py-3 text-gray-500 text-sm">${formatDateShort(c.created_at)}</td>
|
||||
<td class="px-3 py-3 text-gray-500 text-sm">${formatDateShort(c.updated_at)}</td>
|
||||
<td class="px-3 py-3 text-center">
|
||||
<button onclick="toggleVisible('cpu', '${c.id}')" class="${c.visible === false ? 'text-gray-400' : 'text-green-600'} hover:opacity-80" title="${c.visible === false ? '点击显示' : '点击隐藏'}">
|
||||
<i class="${c.visible === false ? 'ri-eye-off-line' : 'ri-eye-line'}"></i>
|
||||
@@ -835,6 +1017,11 @@
|
||||
</tr>
|
||||
`).join('');
|
||||
}
|
||||
|
||||
function filterCpusBySubcategory(subId) {
|
||||
cpuSubcategoryFilter = subId;
|
||||
loadAdminCpus();
|
||||
}
|
||||
|
||||
// 加载知识列表
|
||||
async function loadAdminKnowledge() {
|
||||
@@ -880,6 +1067,7 @@
|
||||
document.getElementById('modalTitle').textContent = '添加' + titles[type];
|
||||
const forms = {category: getCategoryForm, model: getModelForm, gpu: getGpuForm, cpu: getCpuForm, knowledge: getKnowledgeForm, dynamic: getDynamicForm};
|
||||
document.getElementById('modalContent').innerHTML = forms[type]();
|
||||
showSmartUpdateButton(); // 添加时隐藏智能补充按钮
|
||||
document.getElementById('editModal').classList.remove('hidden');
|
||||
}
|
||||
|
||||
@@ -894,6 +1082,7 @@
|
||||
document.getElementById('modalTitle').textContent = '编辑' + titles[type];
|
||||
const forms = {category: getCategoryForm, model: getModelForm, gpu: getGpuForm, cpu: getCpuForm, knowledge: getKnowledgeForm};
|
||||
document.getElementById('modalContent').innerHTML = forms[type](currentData);
|
||||
showSmartUpdateButton(); // 显示智能补充按钮
|
||||
document.getElementById('editModal').classList.remove('hidden');
|
||||
}
|
||||
|
||||
@@ -905,6 +1094,7 @@
|
||||
currentData = await res.json();
|
||||
document.getElementById('modalTitle').textContent = '编辑数据';
|
||||
document.getElementById('modalContent').innerHTML = getDynamicForm(currentData);
|
||||
showSmartUpdateButton(); // 显示智能补充按钮
|
||||
document.getElementById('editModal').classList.remove('hidden');
|
||||
}
|
||||
|
||||
@@ -1121,14 +1311,53 @@
|
||||
// 表单模板
|
||||
function getCategoryForm(data = {}) {
|
||||
const subcategories = data.subcategories || [];
|
||||
const isBuiltin = builtinCategories.includes(data.id);
|
||||
// 存储到全局变量,便于管理
|
||||
window.currentEditingSubcategories = JSON.parse(JSON.stringify(subcategories));
|
||||
|
||||
// 内置类别只显示子类别管理
|
||||
if (isBuiltin) {
|
||||
return `<form id="itemForm" class="space-y-4">
|
||||
<div class="bg-indigo-50 rounded-lg p-4 mb-4">
|
||||
<p class="text-sm text-indigo-700"><i class="ri-information-line mr-1"></i>内置分类的基础信息不可修改,只可编辑子类别配置。</p>
|
||||
</div>
|
||||
<div class="grid grid-cols-2 gap-4 bg-gray-50 p-4 rounded-lg">
|
||||
<div><label class="text-sm text-gray-500 mb-1 block">ID</label><div class="text-gray-700 font-mono">${data.id}</div></div>
|
||||
<div><label class="text-sm text-gray-500 mb-1 block">名称</label><div class="text-gray-700">${data.name}</div></div>
|
||||
<div><label class="text-sm text-gray-500 mb-1 block">图标</label><div class="text-gray-700"><i class="${data.icon} mr-1"></i>${data.icon}</div></div>
|
||||
<div><label class="text-sm text-gray-500 mb-1 block">颜色</label><div class="text-gray-700">${data.color}</div></div>
|
||||
</div>
|
||||
<input type="hidden" name="id" value="${data.id}">
|
||||
<input type="hidden" name="name" value="${data.name}">
|
||||
<input type="hidden" name="icon" value="${data.icon}">
|
||||
<input type="hidden" name="color" value="${data.color}">
|
||||
<input type="hidden" name="order" value="${data.order || 0}">
|
||||
<input type="hidden" name="visible" value="${data.visible !== false ? 'true' : 'false'}">
|
||||
<input type="hidden" name="description" value="${data.description || ''}">
|
||||
|
||||
<!-- 子类别管理 -->
|
||||
<div class="border-t pt-4">
|
||||
<div class="flex justify-between items-center mb-3">
|
||||
<label class="text-sm font-medium text-gray-700"><i class="ri-folder-line mr-1"></i>子类别管理</label>
|
||||
<button onclick="openSubcategoryAddModal()" class="px-3 py-1.5 bg-green-600 text-white rounded-lg text-sm hover:bg-green-700">
|
||||
<i class="ri-add-line mr-1"></i>添加子类别
|
||||
</button>
|
||||
</div>
|
||||
<div id="subcategoriesList" class="space-y-2">
|
||||
${renderSubcategoriesList(subcategories)}
|
||||
</div>
|
||||
<input type="hidden" name="subcategories" id="subcategoriesHidden" value='${JSON.stringify(subcategories)}'>
|
||||
</div>
|
||||
</form>`;
|
||||
}
|
||||
|
||||
// 自定义类别完整编辑表单
|
||||
const autoId = data.id || generateId();
|
||||
return `<form id="itemForm" class="space-y-4">
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">ID *</label><input type="text" name="id" value="${data.id || ''}" ${data.id ? 'readonly' : ''} required class="w-full px-3 py-2 border rounded-lg ${data.id ? 'bg-gray-100' : ''}"></div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">名称 *</label><input type="text" name="name" value="${data.name || ''}" required class="w-full px-3 py-2 border rounded-lg"></div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">图标</label><input type="text" name="icon" value="${data.icon || 'ri-folder-line'}" class="w-full px-3 py-2 border rounded-lg"></div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">ID</label><input type="text" name="id" value="${autoId}" readonly class="w-full px-3 py-2 border rounded-lg bg-gray-100 text-gray-500 font-mono text-xs"><p class="text-xs text-gray-400 mt-1">自动生成,无需填写</p></div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">名称 *</label><input type="text" name="name" value="${data.name || ''}" required class="w-full px-3 py-2 border rounded-lg" placeholder="如:手机、电脑"></div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">图标</label><input type="text" name="icon" value="${data.icon || 'ri-folder-line'}" class="w-full px-3 py-2 border rounded-lg" placeholder="ri-folder-line"></div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">颜色</label><select name="color" class="w-full px-3 py-2 border rounded-lg">
|
||||
<option value="blue" ${data.color === 'blue' ? 'selected' : ''}>蓝色</option>
|
||||
<option value="green" ${data.color === 'green' ? 'selected' : ''}>绿色</option>
|
||||
@@ -1143,7 +1372,7 @@
|
||||
<option value="false" ${data.visible === false ? 'selected' : ''}>隐藏</option>
|
||||
</select></div>
|
||||
</div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">描述</label><textarea name="description" rows="2" class="w-full px-3 py-2 border rounded-lg">${data.description || ''}</textarea></div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">描述</label><textarea name="description" rows="2" class="w-full px-3 py-2 border rounded-lg" placeholder="分类描述">${data.description || ''}</textarea></div>
|
||||
|
||||
<!-- 子类别管理 -->
|
||||
<div class="border-t pt-4">
|
||||
@@ -1220,11 +1449,12 @@
|
||||
const keyFeatures = (data.key_features || []).join(', ');
|
||||
const featureLabels = data.feature_labels || {};
|
||||
const featureLabelsStr = Object.entries(featureLabels).map(([k, v]) => `${k}:${v}`).join(', ');
|
||||
const autoSubId = data.id || generateId();
|
||||
|
||||
return `<div class="space-y-4">
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">ID *</label><input type="text" id="sub_id" value="${data.id || ''}" required class="w-full px-3 py-2 border rounded-lg"></div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">名称 *</label><input type="text" id="sub_name" value="${data.name || ''}" required class="w-full px-3 py-2 border rounded-lg"></div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">ID</label><input type="text" id="sub_id" value="${autoSubId}" readonly class="w-full px-3 py-2 border rounded-lg bg-gray-100 text-gray-500 font-mono text-xs"><p class="text-xs text-gray-400 mt-1">自动生成</p></div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">名称 *</label><input type="text" id="sub_name" value="${data.name || ''}" required class="w-full px-3 py-2 border rounded-lg" placeholder="如:旗舰手机"></div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">图标</label><input type="text" id="sub_icon" value="${data.icon || 'ri-folder-line'}" class="w-full px-3 py-2 border rounded-lg" placeholder="ri-folder-line"></div>
|
||||
</div>
|
||||
<div>
|
||||
@@ -1248,11 +1478,13 @@
|
||||
const keyFeaturesStr = document.getElementById('sub_key_features').value.trim();
|
||||
const featureLabelsStr = document.getElementById('sub_feature_labels').value.trim();
|
||||
|
||||
if (!id || !name) {
|
||||
alert('ID和名称不能为空');
|
||||
if (!name) {
|
||||
alert('名称不能为空');
|
||||
return;
|
||||
}
|
||||
|
||||
// ID自动生成,无需校验
|
||||
|
||||
// 解析 key_features
|
||||
const key_features = keyFeaturesStr ? keyFeaturesStr.split(',').map(s => s.trim()).filter(s => s) : [];
|
||||
|
||||
@@ -1309,11 +1541,28 @@
|
||||
</form>`;
|
||||
}
|
||||
|
||||
// 生成子类别选择器
|
||||
function getSubcategorySelect(categoryId, currentValue = '') {
|
||||
const cat = categories.find(c => c.id === categoryId);
|
||||
if (!cat || !cat.subcategories || cat.subcategories.length === 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const options = cat.subcategories.map(sub =>
|
||||
`<option value="${sub.id}" ${currentValue === sub.id ? 'selected' : ''}><i class="${sub.icon} mr-1"></i>${sub.name}</option>`
|
||||
).join('');
|
||||
|
||||
return `<div><label class="text-sm text-gray-600 mb-1 block">子类别</label><select name="subcategory_id" class="w-full px-3 py-2 border rounded-lg"><option value="">请选择</option>${options}</select></div>`;
|
||||
}
|
||||
|
||||
function getDynamicForm(data = {}) {
|
||||
const cat = categories.find(c => c.id === dynamicCategoryId);
|
||||
currentImages = data.images || [];
|
||||
const subcategorySelect = getSubcategorySelect(dynamicCategoryId, data.subcategory_id);
|
||||
|
||||
return `<form id="itemForm" class="space-y-4">
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
${subcategorySelect}
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">名称 *</label><input type="text" name="name" value="${data.name || ''}" required class="w-full px-3 py-2 border rounded-lg"></div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">品牌</label><input type="text" name="brand" value="${data.brand || ''}" class="w-full px-3 py-2 border rounded-lg"></div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">价格</label><input type="number" name="price" value="${data.price || ''}" step="0.01" class="w-full px-3 py-2 border rounded-lg"></div>
|
||||
@@ -1329,8 +1578,11 @@
|
||||
|
||||
function getModelForm(data = {}) {
|
||||
currentImages = data.images || [];
|
||||
const subcategorySelect = getSubcategorySelect('ai-models', data.subcategory_id);
|
||||
|
||||
return `<form id="itemForm" class="space-y-4">
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
${subcategorySelect}
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">名称 *</label><input type="text" name="name" value="${data.name || ''}" required class="w-full px-3 py-2 border rounded-lg"></div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">厂商 *</label><input type="text" name="organization" value="${data.organization || ''}" required class="w-full px-3 py-2 border rounded-lg"></div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">参数量(B) *</label><input type="number" name="parameters" value="${data.parameters || ''}" required class="w-full px-3 py-2 border rounded-lg"></div>
|
||||
@@ -1352,8 +1604,11 @@
|
||||
|
||||
function getGpuForm(data = {}) {
|
||||
currentImages = data.images || [];
|
||||
const subcategorySelect = getSubcategorySelect('gpus', data.subcategory_id);
|
||||
|
||||
return `<form id="itemForm" class="space-y-4">
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
${subcategorySelect}
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">名称 *</label><input type="text" name="name" value="${data.name || ''}" required class="w-full px-3 py-2 border rounded-lg"></div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">厂商 *</label><input type="text" name="manufacturer" value="${data.manufacturer || ''}" required class="w-full px-3 py-2 border rounded-lg"></div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">架构</label><input type="text" name="architecture" value="${data.architecture || ''}" class="w-full px-3 py-2 border rounded-lg"></div>
|
||||
@@ -1381,8 +1636,11 @@
|
||||
|
||||
function getCpuForm(data = {}) {
|
||||
currentImages = data.images || [];
|
||||
const subcategorySelect = getSubcategorySelect('cpus', data.subcategory_id);
|
||||
|
||||
return `<form id="itemForm" class="space-y-4">
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
${subcategorySelect}
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">名称 *</label><input type="text" name="name" value="${data.name || ''}" required class="w-full px-3 py-2 border rounded-lg"></div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">厂商 *</label><input type="text" name="manufacturer" value="${data.manufacturer || ''}" required class="w-full px-3 py-2 border rounded-lg"></div>
|
||||
<div><label class="text-sm text-gray-600 mb-1 block">架构</label><input type="text" name="architecture" value="${data.architecture || ''}" class="w-full px-3 py-2 border rounded-lg"></div>
|
||||
@@ -1413,6 +1671,7 @@
|
||||
document.getElementById('smartAddModal').addEventListener('click', function(e) { if (e.target === this) closeSmartAddModal(); });
|
||||
document.getElementById('rawDataModal').addEventListener('click', function(e) { if (e.target === this) closeRawDataModal(); });
|
||||
document.getElementById('subcategoryModal').addEventListener('click', function(e) { if (e.target === this) closeSubcategoryModal(); });
|
||||
document.getElementById('smartUpdateModal').addEventListener('click', function(e) { if (e.target === this) closeSmartUpdateModal(); });
|
||||
|
||||
// ============ 智能添加功能 ============
|
||||
|
||||
@@ -1741,6 +2000,209 @@
|
||||
document.getElementById('rawDataModal').classList.add('hidden');
|
||||
}
|
||||
|
||||
// ============ 智能补充功能 ============
|
||||
|
||||
let smartUpdateImages = [];
|
||||
|
||||
// 打开智能补充弹框(编辑时显示按钮)
|
||||
function showSmartUpdateButton() {
|
||||
const btn = document.getElementById('smartUpdateBtn');
|
||||
// 只有编辑已有数据时才显示智能补充按钮(排除category和knowledge)
|
||||
if (currentId && currentType && currentType !== 'category' && currentType !== 'knowledge') {
|
||||
btn.classList.remove('hidden');
|
||||
} else {
|
||||
btn.classList.add('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
// 打开智能补充弹框
|
||||
function openSmartUpdateModal() {
|
||||
smartUpdateImages = [];
|
||||
document.getElementById('smartUpdateText').value = '';
|
||||
document.getElementById('smartUpdatePreview').classList.add('hidden');
|
||||
document.getElementById('smartUpdateImagePreviewArea').innerHTML = '';
|
||||
document.getElementById('smartUpdateImageCount').textContent = '0';
|
||||
document.getElementById('smartUpdateModal').classList.remove('hidden');
|
||||
}
|
||||
|
||||
function closeSmartUpdateModal() {
|
||||
document.getElementById('smartUpdateModal').classList.add('hidden');
|
||||
}
|
||||
|
||||
// 处理图片上传
|
||||
async function handleSmartUpdateImageUpload(event) {
|
||||
const files = event.target.files;
|
||||
for (let file of files) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/upload/image', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
});
|
||||
const data = await res.json();
|
||||
if (data.success) {
|
||||
smartUpdateImages.push(data.url);
|
||||
updateSmartUpdateImagePreview();
|
||||
}
|
||||
} catch (e) {
|
||||
alert('上传失败: ' + e.message);
|
||||
}
|
||||
}
|
||||
event.target.value = '';
|
||||
}
|
||||
|
||||
// 粘贴图片
|
||||
async function pasteSmartUpdateImageFromClipboard() {
|
||||
try {
|
||||
if (!navigator.clipboard || !navigator.clipboard.read) {
|
||||
alert('剪贴板API需要HTTPS或localhost环境。\n当前访问地址不支持,请使用文件选择上传。\n\n可改用 localhost:19010 访问来支持粘贴功能。');
|
||||
return;
|
||||
}
|
||||
|
||||
const clipboardItems = await navigator.clipboard.read();
|
||||
let found = false;
|
||||
for (const item of clipboardItems) {
|
||||
for (const type of item.types) {
|
||||
if (type.startsWith('image/')) {
|
||||
found = true;
|
||||
const blob = await item.getType(type);
|
||||
const reader = new FileReader();
|
||||
reader.onload = async (e) => {
|
||||
const base64 = e.target.result;
|
||||
try {
|
||||
const res = await fetch('/api/upload/image/base64', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ image: base64 })
|
||||
});
|
||||
const data = await res.json();
|
||||
if (data.success) {
|
||||
smartUpdateImages.push(data.url);
|
||||
updateSmartUpdateImagePreview();
|
||||
}
|
||||
} catch (err) {
|
||||
alert('上传失败: ' + err.message);
|
||||
}
|
||||
};
|
||||
reader.readAsDataURL(blob);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
alert('剪贴板中没有图片,请先复制一张图片');
|
||||
}
|
||||
} catch (e) {
|
||||
if (e.name === 'NotAllowedError') {
|
||||
alert('浏览器拒绝访问剪贴板。\n请使用文件选择上传,或改用 localhost:19010 访问。');
|
||||
} else {
|
||||
alert('无法从剪贴板获取图片: ' + e.message + '\n请使用文件选择上传');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 清空图片
|
||||
function clearSmartUpdateImages() {
|
||||
smartUpdateImages = [];
|
||||
updateSmartUpdateImagePreview();
|
||||
}
|
||||
|
||||
// 移除单张图片
|
||||
function removeSmartUpdateImage(index) {
|
||||
smartUpdateImages.splice(index, 1);
|
||||
updateSmartUpdateImagePreview();
|
||||
}
|
||||
|
||||
// 更新图片预览
|
||||
function updateSmartUpdateImagePreview() {
|
||||
const area = document.getElementById('smartUpdateImagePreviewArea');
|
||||
const count = document.getElementById('smartUpdateImageCount');
|
||||
|
||||
area.innerHTML = smartUpdateImages.map((url, idx) => `
|
||||
<div class="relative w-24 h-24 border rounded-lg overflow-hidden group">
|
||||
<img src="${url}" class="w-full h-full object-cover">
|
||||
<button onclick="removeSmartUpdateImage(${idx})" class="absolute top-1 right-1 w-6 h-6 bg-red-500 text-white rounded-full opacity-0 group-hover:opacity-100 transition flex items-center justify-center">
|
||||
<i class="ri-close-line"></i>
|
||||
</button>
|
||||
</div>
|
||||
`).join('');
|
||||
|
||||
count.textContent = smartUpdateImages.length;
|
||||
}
|
||||
|
||||
// 执行智能补充
|
||||
async function smartUpdateSubmit() {
|
||||
const text = document.getElementById('smartUpdateText').value.trim();
|
||||
|
||||
if (!text && smartUpdateImages.length === 0) {
|
||||
alert('请上传图片或输入文本');
|
||||
return;
|
||||
}
|
||||
|
||||
const btn = document.getElementById('smartUpdateSubmitBtn');
|
||||
btn.disabled = true;
|
||||
btn.innerHTML = '<i class="ri-loader-4-line animate-spin mr-1"></i>解析中...';
|
||||
|
||||
try {
|
||||
let endpoint;
|
||||
if (currentType === 'model') endpoint = `/api/models/${currentId}/smart-update`;
|
||||
else if (currentType === 'gpu') endpoint = `/api/gpus/${currentId}/smart-update`;
|
||||
else if (currentType === 'cpu') endpoint = `/api/cpus/${currentId}/smart-update`;
|
||||
else if (currentType === 'dynamic') endpoint = `/api/items/${dynamicCategoryId}/${currentId}/smart-update`;
|
||||
|
||||
const res = await fetch(endpoint, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
text: text,
|
||||
images: smartUpdateImages
|
||||
})
|
||||
});
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
if (data.error) {
|
||||
alert('解析失败: ' + data.error);
|
||||
} else {
|
||||
// 显示更新结果
|
||||
document.getElementById('smartUpdatePreview').classList.remove('hidden');
|
||||
|
||||
let html = `<div class="mb-2 text-green-600"><i class="ri-checkbox-circle-fill mr-1"></i>成功补充 ${data.updated_fields.length} 个字段</div>`;
|
||||
|
||||
if (data.updated_fields.length > 0) {
|
||||
html += '<div class="mt-2">';
|
||||
data.updated_fields.forEach(field => {
|
||||
html += `<span class="inline-block px-2 py-1 bg-green-100 text-green-700 rounded text-xs mr-1 mb-1">${field}</span>`;
|
||||
});
|
||||
html += '</div>';
|
||||
} else {
|
||||
html += '<div class="text-gray-500 mt-2">所有字段都已存在,无需补充</div>';
|
||||
}
|
||||
|
||||
document.getElementById('smartUpdateResult').innerHTML = html;
|
||||
|
||||
// 更新编辑表单数据
|
||||
currentData = data[currentType] || data.item || data.model || data.gpu || data.cpu;
|
||||
const forms = {model: getModelForm, gpu: getGpuForm, cpu: getCpuForm, dynamic: getDynamicForm};
|
||||
document.getElementById('modalContent').innerHTML = forms[currentType](currentData);
|
||||
|
||||
// 关闭智能补充弹框
|
||||
setTimeout(() => {
|
||||
closeSmartUpdateModal();
|
||||
}, 1500);
|
||||
}
|
||||
} catch (e) {
|
||||
alert('请求失败: ' + e.message);
|
||||
}
|
||||
|
||||
btn.disabled = false;
|
||||
btn.innerHTML = '<i class="ri-magic-line mr-1"></i>解析并补充';
|
||||
}
|
||||
|
||||
// 监听编辑弹框打开,显示智能补充按钮
|
||||
document.getElementById('editModal').addEventListener('showSmartUpdate', showSmartUpdateButton);
|
||||
|
||||
init();
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user