fix(basic.gbapp): AS IMAGE testing.

This commit is contained in:
Rodrigo Rodriguez 2023-08-12 09:29:03 -03:00
parent d48cb03c32
commit 78837ac001

View file

@ -1224,13 +1224,14 @@ export class DialogKeywords {
const imageData = await (await fetch(url)).arrayBuffer();
const contentType = mime.lookup(url);
const ext = mime.extension(url);
reply['attachments'] = [];
// Prepare a cache to be referenced by Bot Framework.
let buf: any = Buffer.from(imageData);
const gbaiName = DialogKeywords.getGBAIPath(min.botId);
const localName = Path.join('work', gbaiName, 'cache', `tmp${GBAdminService.getRndReadableIdentifier()}.docx`);
const localName = Path.join('work', gbaiName, 'cache', `tmp${GBAdminService.getRndReadableIdentifier()}.${ext}`);
Fs.writeFileSync(localName, buf, { encoding: null });
url = urlJoin(GBServer.globals.publicAddress, min.botId, 'cache', Path.basename(localName));