/** * 在guanghulab.com首页添加图片工作室入口卡片 */ const GZ = { ip: '43.139.217.141', port: 3910, key: 'zy_gtw_4a155446b7acc09fe46a2a29972c0ca5d9954da19c35dc23' } async function callGK(srv, method, path, body = null) { const url = `http://${srv.ip}:${srv.port}${path}` const opts = { method, headers: { 'Authorization': `Bearer ${srv.key}`, 'Content-Type': 'application/json' } } if (body) opts.body = JSON.stringify(body) const res = await fetch(url, opts) const text = await res.text() try { return { status: res.status, data: JSON.parse(text) } } catch { return { status: res.status, data: { raw: text } } } } async function readFile(srv, path) { const r = await callGK(srv, 'POST', '/file/read', { path }) if (r.status === 200) return r.data.content return null } async function writeFile(srv, path, content) { return (await callGK(srv, 'POST', '/file/write', { path, content })).status === 200 } async function main() { // 读取首页HTML const html = await readFile(GZ, '/opt/guanghulab-repo/homepage/index.html') if (!html) { console.log('❌ 读取失败') return } console.log('当前首页大小:', html.length, '字符') // 在语料采集系统卡片和架构进度卡片之间插入图片工作室卡片 // 找到语料采集卡片关闭后的位置 // 插入标记:在 语料采集系统card 的 之后、架构进度的grid之前插入 const marker = '' const insertIdx = html.indexOf(marker) if (insertIdx === -1) { console.log('❌ 找不到插入位置') return } const imageStudioCard = `
铸渊图片工作室 神笔马良
🎨
神笔马良 · 你说我画
告诉铸渊内容和场景,自动生成小红书/即刻配图、海报、通知卡片
小红书 · 即刻 · 海报
自动配色 · 内容自适应
新加坡渲染 · 广州分发
` const newHtml = html.slice(0, insertIdx) + imageStudioCard + html.slice(insertIdx) if (await writeFile(GZ, '/opt/guanghulab-repo/homepage/index.html', newHtml)) { console.log('✅ 首页更新成功') console.log('更新后大小:', newHtml.length, '字符') // 验证 const verify = await readFile(GZ, '/opt/guanghulab-repo/homepage/index.html') if (verify && verify.includes('图片工作室')) { console.log('✅ 图片工作室入口已添加到首页') } } else { console.log('❌ 写入失败') } } main().catch(err => console.error('❌', err))