更新产品配置和技能定义
This commit is contained in:
64
.codebuddy/skills/image-tools/scripts/remove-background.py
Normal file
64
.codebuddy/skills/image-tools/scripts/remove-background.py
Normal file
@@ -0,0 +1,64 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
产品图片抠图工具
|
||||
使用rembg库自动去除图片背景
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
|
||||
try:
|
||||
from rembg import remove
|
||||
from PIL import Image
|
||||
except ImportError:
|
||||
print("Missing dependencies, installing...")
|
||||
os.system("pip install rembg pillow")
|
||||
from rembg import remove
|
||||
from PIL import Image
|
||||
|
||||
def remove_background(input_path, output_path):
|
||||
"""
|
||||
去除图片背景
|
||||
"""
|
||||
try:
|
||||
print(f"Processing: {input_path}")
|
||||
|
||||
# 打开原始图片
|
||||
with open(input_path, 'rb') as input_file:
|
||||
input_data = input_file.read()
|
||||
|
||||
# 去除背景
|
||||
output_data = remove(input_data)
|
||||
|
||||
# 保存结果
|
||||
with open(output_path, 'wb') as output_file:
|
||||
output_file.write(output_data)
|
||||
|
||||
print(f"Saved: {output_path}")
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
return False
|
||||
|
||||
if __name__ == "__main__":
|
||||
# 产品图片路径
|
||||
image_dir = r"g:\stonelan-workspace\membank\产品\飞牛 NAS\fyd-亚克力机箱 - 单\image"
|
||||
|
||||
# 要处理的图片
|
||||
input_image = os.path.join(image_dir, "正面.jpg")
|
||||
output_image = os.path.join(image_dir, "正面_抠图.png")
|
||||
|
||||
# 检查文件是否存在
|
||||
if not os.path.exists(input_image):
|
||||
print(f"File not found: {input_image}")
|
||||
sys.exit(1)
|
||||
|
||||
# 执行抠图
|
||||
success = remove_background(input_image, output_image)
|
||||
|
||||
if success:
|
||||
print(f"\nBackground removal completed!")
|
||||
print(f"Original: {input_image}")
|
||||
print(f"Result: {output_image}")
|
||||
else:
|
||||
print("\nBackground removal failed!")
|
||||
sys.exit(1)
|
||||
58
.codebuddy/skills/image-tools/scripts/render-main-image.js
Normal file
58
.codebuddy/skills/image-tools/scripts/render-main-image.js
Normal file
@@ -0,0 +1,58 @@
|
||||
const puppeteer = require('puppeteer');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
async function convertMainImageToPng() {
|
||||
console.log('🎨 启动主图渲染工具...\n');
|
||||
|
||||
const browser = await puppeteer.launch({
|
||||
headless: 'new',
|
||||
args: ['--no-sandbox', '--disable-setuid-sandbox']
|
||||
});
|
||||
|
||||
const page = await browser.newPage();
|
||||
|
||||
await page.setViewport({ width: 800, height: 800 });
|
||||
|
||||
const mainImageDir = 'G:\\stonelan-workspace\\membank\\产品\\飞牛 NAS\\fyd-亚克力机箱 - 单\\主图';
|
||||
|
||||
const htmlFiles = fs.readdirSync(mainImageDir)
|
||||
.filter(file => file.endsWith('.html'));
|
||||
|
||||
console.log(`📁 找到 ${htmlFiles.length} 个主图HTML文件需要渲染\n`);
|
||||
|
||||
for (const htmlFile of htmlFiles) {
|
||||
try {
|
||||
const htmlPath = path.join(mainImageDir, htmlFile);
|
||||
const pngFile = htmlFile.replace('.html', '.png');
|
||||
const pngPath = path.join(mainImageDir, pngFile);
|
||||
|
||||
console.log(`📄 正在渲染: ${htmlFile}`);
|
||||
|
||||
const fileUrl = `file:///${htmlPath.replace(/\\/g, '/')}`;
|
||||
await page.goto(fileUrl, {
|
||||
waitUntil: 'networkidle0',
|
||||
timeout: 10000
|
||||
});
|
||||
|
||||
await page.screenshot({
|
||||
path: pngPath,
|
||||
fullPage: true,
|
||||
type: 'png'
|
||||
});
|
||||
|
||||
console.log(`✅ 已生成: ${pngFile}\n`);
|
||||
} catch (error) {
|
||||
console.error(`❌ 渲染失败 ${htmlFile}: ${error.message}\n`);
|
||||
}
|
||||
}
|
||||
|
||||
await browser.close();
|
||||
|
||||
console.log('✨ 所有主图渲染完成!');
|
||||
}
|
||||
|
||||
convertMainImageToPng().catch(error => {
|
||||
console.error('💥 渲染过程出错:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -25,21 +25,44 @@ description: 设计电商产品的详情页。当用户需要为产品生成详
|
||||
### 步骤 2: 生成 HTML 文件
|
||||
|
||||
#### 详情页组成部分
|
||||
- 购买须知
|
||||
- 购买须知 (不需要二级标题)
|
||||
- 亚克力机箱需要自己组装,店铺会提供安装视频
|
||||
- 受成本限制,产品无法做到十全十美,完美主义者慎拍
|
||||
- 配置清单
|
||||
- 功能描述
|
||||
1. 以表格的形式展示
|
||||
2. cpu 内存 系统盘,网口,
|
||||
3. 内存体现容量和ddr3,内存插槽数量
|
||||
4. 支持硬盘数量,尺寸, 容量
|
||||
- 使用场景
|
||||
1. 手机扩容
|
||||
照片视频备份,自动同步,远程同步
|
||||
2. 小型办公/团队协作
|
||||
远程文件访问,多人协作,权限分级,文件共享,文件归档,在线编辑
|
||||
3. 监控视频存储
|
||||
小米摄像头存储,onvif协议支持
|
||||
4. 家庭影院打造
|
||||
流畅播放4k视频,硬解4k
|
||||
5. 微信聊天记录备份
|
||||
支持微信聊天记录备份
|
||||
6. 远程访问
|
||||
远程访问照片,视频,文件等内容
|
||||
- 产品特点
|
||||
1. 体积小,容量大,功能强
|
||||
2. 低耗静音
|
||||
3. 支持远程访问
|
||||
4. 支持wifi联网
|
||||
5. 来电自启
|
||||
6. 远程开关机
|
||||
- 产品实拍图
|
||||
- 飞牛系统截图
|
||||
- 配件清单
|
||||
- 包装展示
|
||||
- 常见问题
|
||||
1. 产品是否支持双CPU?
|
||||
2. 产品是否支持双内存条
|
||||
|
||||
|
||||
- 严格按照详情页组成生成详情页,多余的删除掉
|
||||
- 需要用的产品图片,都放在对应产品目录的image目录下
|
||||
- html 按照宽750的分辨率生成
|
||||
- html 按照宽1500的分辨率生成
|
||||
- 一个产品有多个sku,但一个产品只需要一个详情页,不需要为每个sku生成详情页
|
||||
- 详情页放到每个产品对应的`详情`目录下
|
||||
- 配色采用绿色清晰的风格
|
||||
|
||||
@@ -23,7 +23,7 @@ description: 设计电商产品的主图。当用户需要为产品生成主图
|
||||
|
||||
|
||||
### 步骤 2: 设计主图html
|
||||
- 主图尺寸:800*800
|
||||
- 主图尺寸:1000*1000
|
||||
- 一个主图一个html
|
||||
|
||||
|
||||
|
||||
@@ -25,9 +25,12 @@ description: 设计电商产品的 SKU 配置。当用户需要为产品生成 S
|
||||
|
||||
### 步骤2 计算与核对产品价格
|
||||
- 根据配件清单,计算产品价格
|
||||
- 更新产品价格到产品价格汇总表
|
||||
- 计算价格必须使用计算工具计算
|
||||
|
||||
### 步骤3 更新产品信息
|
||||
|
||||
- 更新产品信息到产品信息汇总表
|
||||
|
||||
|
||||
## 飞牛 NAS产设计原则
|
||||
### 3.5金属大配置原则
|
||||
@@ -42,6 +45,10 @@ description: 设计电商产品的 SKU 配置。当用户需要为产品生成 S
|
||||
- 可安装单SATA口主板
|
||||
- 可用CPU:N2840,N2930,AMD-A4,J1900,J3160
|
||||
- 可用内存:2G-16G,2G-32G,4G-64G,4G-128G
|
||||
####
|
||||
推荐价格:
|
||||
- 配2G内存的成本加20作为推荐售价
|
||||
- 配4G内存的成本加30作为推荐售价
|
||||
|
||||
### 亚克力机箱-双 配置原则
|
||||
- 可安装双SATA口主板
|
||||
|
||||
Reference in New Issue
Block a user