Open CGangel opened 1 week ago
似乎是 puppeteer 的截图数据没有成功转换为 base64 导致的。 把 chatgpt-plugin/utils/common.js 里第 361 行和第 362 行改成下面这样就能发图片了:
let buff = await page.screenshot({ fullPage: true });
let buffer = Buffer.from(buff).toString('base64');
base64 = segment.image(`base64://${buffer}`);
如果能解决 可以发个pr?
文本比较短的话,可以直接发出来,但是如果文本较长,bot会先后尝试使用图片、匿名合并消息发送,然后报错,发不出来。 下面是报错代码。
[18:53:32.520][ERRO][3597844978] 发送消息错误 [ { type: 'reply', id: 'FMq+Ngq9D2QAAeRGa2iZW2c0hSAB', text: undefined, qq: undefined, time: undefined, seq: undefined }, { type: 'image', file: Uint8Array(267312) [ 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 5, 0, 0, 0, 7, 60, 8, 2, 0, 0, 0, 115, 161, 190, 95, 0, 0, 0, 1, 115, 82, 71, 66, 0, 174, 206, 28, 233, 0, 0, 32, 0, 73, 68, 65, 84, 120, 156, 236, 221, 119, 156, 85, 213, 185, 63, 254, 231, 89, 107, 237, 189, 207, 57, 211, 152, 97, 104, 2, 67, 239, 82, 68, 16, 65, 108, 216, 80, 81, 49, 246, 104, 138, 233, 38, 55, 185, 247, 151, 155, 111, 98, ... 267212 more items, [BYTES_PER_ELEMENT]: 1, length: 267312, [byteLength]: 267312,
},
] ApiRejection { code: -60, message: 'bad file param: 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,5,0,0,0,7,60,8,2,0,0,0,115,161,190,95,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,32,0,73,68,65,84,120,156,236,221,119,156,85,213,185,63,254,231,89,107,237,189,207,57,211,152,97,104,2,67,239,82,68,16,65,108,216,80,81,49,246,104,138,233,38,55,185,247,151,155,111,98,110,238,141,73,110,146,27,111,73,49,77,163,73,212,24,91,176,130,162,216,5,4,4,11,189,72,111,67,153,94,206,217,123,175,242,252,254,216,227,97,152,25,16,16,27,60,239,151,201,107,206,62,107,175,93,38,121,189,252,204,179,10,86,12,59,13,24,99,140,49,198,24,99,140,177,99,157,248,168,111,128,49,198,24,99,140,49,198,24,251,48,112,0,102,140,49,198,24,99,140,49,118,92,224,0,204,24,99,140,49,198,24,99,236,184,192,1,152,49,198,24,99,140,49,198,216,113,129,3,48,99,140,49,198,24,99,140,177,227,2,7,96,198,24,99,140,49,198,24,99,199,5,14,192,140,49,198,24,99,140,49,198,142,11,28,128,25,99,140,49,198,24,99,140,29,23,56,0,51,198,24,99,140,49,198,24,59,46,112,0,102,140,49,198,24,99'... 945947 more characters } [18:53:32.547][ERRO][3597844978] 发送消息错误 [ { user_id: 80000000, nickname: '匿名消息', message: [ { type: 'reply', id: 'FMq+Ngq9D2QAAeRGa2iZW2c0hSAB', text: undefined, qq: undefined, time: undefined, seq: undefined }, { type: 'image', file: Uint8Array(267312) [ 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 5, 0, 0, 0, 7, 60, 8, 2, 0, 0, 0, 115, 161, 190, 95, 0, 0, 0, 1, 115, 82, 71, 66, 0, 174, 206, 28, 233, 0, 0, 32, 0, 73, 68, 65, 84, 120, 156, 236, 221, 119, 156, 85, 213, 185, 63, 254, 231, 89, 107, 237, 189, 207, 57, 211, 152, 97, 104, 2, 67, 239, 82, 68, 16, 65, 108, 216, 80, 81, 49, 246, 104, 138, 233, 38, 55, 185, 247, 151, 155, 111, 98, ... 267212 more items, [BYTES_PER_ELEMENT]: 1,
},
] ApiRejection { code: -60, message: 'bad file param: 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,5,0,0,0,7,60,8,2,0,0,0,115,161,190,95,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,32,0,73,68,65,84,120,156,236,221,119,156,85,213,185,63,254,231,89,107,237,189,207,57,211,152,97,104,2,67,239,82,68,16,65,108,216,80,81,49,246,104,138,233,38,55,185,247,151,155,111,98,110,238,141,73,110,146,27,111,73,49,77,163,73,212,24,91,176,130,162,216,5,4,4,11,189,72,111,67,153,94,206,217,123,175,242,252,254,216,227,97,152,25,16,16,27,60,239,151,201,107,206,62,107,175,93,38,121,189,252,204,179,10,86,12,59,13,24,99,140,49,198,24,99,140,177,99,157,248,168,111,128,49,198,24,99,140,49,198,24,251,48,112,0,102,140,49,198,24,99,140,49,118,92,224,0,204,24,99,140,49,198,24,99,236,184,192,1,152,49,198,24,99,140,49,198,216,113,129,3,48,99,140,49,198,24,99,140,177,227,2,7,96,198,24,99,140,49,198,24,99,199,5,14,192,140,49,198,24,99,140,49,198,142,11,28,128,25,99,140,49,198,24,99,140,29,23,56,0,51,198,24,99,140,49,198,24,59,46,112,0,102,140,49,198,24,99'... 945947 more characters }