- 删除重复的测试消息通信模块 - 添加 openclaw-log 事件将详细日志发送到界面 - 界面监听并显示 OpenClaw 详细日志 - 日志包含:连接状态、发送请求、接收消息、响应状态、错误诊断 现在连接 OpenClaw 时会看到详细日志: [OpenClaw] ========== 开始连接 ========== [OpenClaw] ✅ WebSocket 连接已建立 | 就绪状态:1 [OpenClaw] 📤 发送 connect 请求... [OpenClaw] 📥 收到消息 (长度:123 字节) [OpenClaw] 响应:✅ 成功 / ❌ 失败
46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
const sharp = require('sharp');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const resourcesDir = path.join(__dirname, '../resources');
|
|
|
|
// 创建一个简单的蓝色渐变图标
|
|
async function createIcon() {
|
|
const size = 512;
|
|
|
|
// 创建渐变背景
|
|
const svg = `
|
|
<svg width="${size}" height="${size}" xmlns="http://www.w3.org/2000/svg">
|
|
<defs>
|
|
<linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
<stop offset="0%" style="stop-color:#00d8ff;stop-opacity:1" />
|
|
<stop offset="100%" style="stop-color:#006699;stop-opacity:1" />
|
|
</linearGradient>
|
|
</defs>
|
|
<rect width="${size}" height="${size}" fill="url(#grad)"/>
|
|
<text x="50%" y="55%" font-family="Arial, sans-serif" font-size="280" font-weight="bold" fill="white" text-anchor="middle" dominant-baseline="middle">W</text>
|
|
</svg>
|
|
`;
|
|
|
|
// 生成 PNG
|
|
await sharp(Buffer.from(svg))
|
|
.resize(512, 512)
|
|
.png()
|
|
.toFile(path.join(resourcesDir, 'icon.png'));
|
|
|
|
console.log('✓ Generated icon.png (512x512)');
|
|
|
|
// 生成小尺寸图标
|
|
for (const s of [256, 128, 64, 32, 16]) {
|
|
await sharp(path.join(resourcesDir, 'icon.png'))
|
|
.resize(s, s)
|
|
.png()
|
|
.toFile(path.join(resourcesDir, `icon-${s}.png`));
|
|
console.log(`✓ Generated icon-${s}.png`);
|
|
}
|
|
|
|
console.log('\nIcons generated successfully!');
|
|
}
|
|
|
|
createIcon().catch(console.error);
|