/** * 在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 = `