@xuda.io/ai_module 1.1.5477 → 1.1.5479
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +4 -11
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1536,23 +1536,16 @@ export const delete_conversation_item = async function (req) {
|
|
|
1536
1536
|
|
|
1537
1537
|
let save_ret;
|
|
1538
1538
|
try {
|
|
1539
|
+
if (conversation_item_doc.uid !== uid) {
|
|
1540
|
+
throw new Error('Operation not allowed');
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1539
1543
|
conversation_item_doc.stat = 4;
|
|
1540
1544
|
conversation_item_doc.ts = Date.now();
|
|
1541
1545
|
save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, conversation_item_doc);
|
|
1542
1546
|
if (conversation_item_doc?.conversation_item_reference_id) {
|
|
1543
1547
|
await client.conversations.items.delete(conversation_doc.reference_conversation_id, conversation_item_doc.conversation_item_reference_id);
|
|
1544
1548
|
}
|
|
1545
|
-
for (const msg of conversation_doc?.messages || []) {
|
|
1546
|
-
for (const attachment of msg?.attachments || []) {
|
|
1547
|
-
try {
|
|
1548
|
-
if (attachment.id) client.files.delete(attachment.id);
|
|
1549
|
-
} catch (error) {}
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
|
|
1553
|
-
if (conversation_doc?.chat_image?.[0]) {
|
|
1554
|
-
drive_msa.delete_drive_files({ uid, drive_type: 'user', files_arr: [{ type: 'file', file_path: path.join(conversation_doc.chat_image[0].file_path, conversation_doc.chat_image[0].filename) }] });
|
|
1555
|
-
}
|
|
1556
1549
|
|
|
1557
1550
|
return save_ret;
|
|
1558
1551
|
} catch (err) {
|