@xuda.io/ai_module 1.1.5481 → 1.1.5483
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 +15 -2
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1543,8 +1543,21 @@ export const delete_conversation_item = async function (req) {
|
|
|
1543
1543
|
conversation_item_doc.stat = 4;
|
|
1544
1544
|
conversation_item_doc.ts = Date.now();
|
|
1545
1545
|
save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, conversation_item_doc);
|
|
1546
|
-
|
|
1547
|
-
|
|
1546
|
+
const reference_conversation_id = conversation_doc?.reference_conversation_id || conversation_doc?.conversation_obj?.id;
|
|
1547
|
+
const reference_item_id = conversation_item_doc?.conversation_item_reference_id;
|
|
1548
|
+
const looksLikeConversationItemId = typeof reference_item_id === 'string' && /^(msg|item)_/.test(reference_item_id);
|
|
1549
|
+
|
|
1550
|
+
if (reference_conversation_id && looksLikeConversationItemId) {
|
|
1551
|
+
try {
|
|
1552
|
+
await client.conversations.items.delete(reference_conversation_id, reference_item_id);
|
|
1553
|
+
} catch (error) {
|
|
1554
|
+
console.error('delete_conversation_item: failed to delete provider conversation item', {
|
|
1555
|
+
conversation_item_id,
|
|
1556
|
+
reference_conversation_id,
|
|
1557
|
+
reference_item_id,
|
|
1558
|
+
error: error?.message || String(error),
|
|
1559
|
+
});
|
|
1560
|
+
}
|
|
1548
1561
|
}
|
|
1549
1562
|
|
|
1550
1563
|
return save_ret;
|