Please don't send [object object], that is not desired

This commit is contained in:
powermaker450 2024-06-22 19:41:49 -04:00
parent 08cb9f35e2
commit c678f7e584

View file

@ -136,9 +136,8 @@ client.connect().then(async () => {
await client.sendMessage({ await client.sendMessage({
converseId: message.converseId, converseId: message.converseId,
groupId: message.groupId, groupId: message.groupId,
// @ts-ignore
// Surround in [md] tags to support markdown formatting. // Surround in [md] tags to support markdown formatting.
content: `[md]${response.choices.at(0)}[/md]`, content: `[md]${response.choices.at(0)?.message.content}[/md]`,
}); });
fs.writeFileSync("./messages.json", JSON.stringify(session), "utf8"); fs.writeFileSync("./messages.json", JSON.stringify(session), "utf8");
@ -170,9 +169,8 @@ client.connect().then(async () => {
await client.sendMessage({ await client.sendMessage({
converseId: message.converseId, converseId: message.converseId,
groupId: message.groupId, groupId: message.groupId,
// @ts-ignore
// Same as above. Surround with [md] tags to support markdown formatting. // Same as above. Surround with [md] tags to support markdown formatting.
content: `[md]${response.choices.at(0)}[/md]`, content: `[md]${response.choices.at(0)?.message.content}[/md]`,
}); });
fs.writeFileSync("./messages.json", JSON.stringify(session), "utf8"); fs.writeFileSync("./messages.json", JSON.stringify(session), "utf8");
@ -213,8 +211,7 @@ client.connect().then(async () => {
await client.sendMessage({ await client.sendMessage({
converseId: message.converseId, converseId: message.converseId,
// @ts-ignore content: `[md]${response.choices.at(0)?.message.content}[/md]`,
content: `[md]${response.choices.at(0)}[/md]`,
}); });
fs.writeFileSync("./messages.json", JSON.stringify(session), "utf8"); fs.writeFileSync("./messages.json", JSON.stringify(session), "utf8");