@xuda.io/ai_module 1.1.5475 → 1.1.5477
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 +16 -26
- package/index_ms.mjs +4 -0
- package/index_msa.mjs +4 -0
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1531,37 +1531,27 @@ export const delete_conversation_item = async function (req) {
|
|
|
1531
1531
|
|
|
1532
1532
|
const account_profile_info = await get_active_account_profile_info(uid);
|
|
1533
1533
|
|
|
1534
|
-
|
|
1535
|
-
let conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_id);
|
|
1534
|
+
let conversation_item_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_item_id);
|
|
1535
|
+
let conversation_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, conversation_item_doc.conversation_id);
|
|
1536
1536
|
|
|
1537
1537
|
let save_ret;
|
|
1538
1538
|
try {
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, conversation_doc);
|
|
1551
|
-
|
|
1552
|
-
client.conversations.delete(conversation_id);
|
|
1553
|
-
|
|
1554
|
-
for (const msg of conversation_doc?.messages || []) {
|
|
1555
|
-
for (const attachment of msg?.attachments || []) {
|
|
1556
|
-
try {
|
|
1557
|
-
if (attachment.id) client.files.delete(attachment.id);
|
|
1558
|
-
} catch (error) {}
|
|
1559
|
-
}
|
|
1539
|
+
conversation_item_doc.stat = 4;
|
|
1540
|
+
conversation_item_doc.ts = Date.now();
|
|
1541
|
+
save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, conversation_item_doc);
|
|
1542
|
+
if (conversation_item_doc?.conversation_item_reference_id) {
|
|
1543
|
+
await client.conversations.items.delete(conversation_doc.reference_conversation_id, conversation_item_doc.conversation_item_reference_id);
|
|
1544
|
+
}
|
|
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) {}
|
|
1560
1550
|
}
|
|
1551
|
+
}
|
|
1561
1552
|
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
}
|
|
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) }] });
|
|
1565
1555
|
}
|
|
1566
1556
|
|
|
1567
1557
|
return save_ret;
|
package/index_ms.mjs
CHANGED
|
@@ -33,6 +33,10 @@ export const archive_ai_chat = async function (...args) {
|
|
|
33
33
|
return await broker.send_to_queue("archive_ai_chat", ...args);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
export const delete_conversation_item = async function (...args) {
|
|
37
|
+
return await broker.send_to_queue("delete_conversation_item", ...args);
|
|
38
|
+
};
|
|
39
|
+
|
|
36
40
|
export const unarchive_ai_chat = async function (...args) {
|
|
37
41
|
return await broker.send_to_queue("unarchive_ai_chat", ...args);
|
|
38
42
|
};
|
package/index_msa.mjs
CHANGED
|
@@ -33,6 +33,10 @@ export const archive_ai_chat = function (...args) {
|
|
|
33
33
|
broker.send_to_queue_async("archive_ai_chat", ...args);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
export const delete_conversation_item = function (...args) {
|
|
37
|
+
broker.send_to_queue_async("delete_conversation_item", ...args);
|
|
38
|
+
};
|
|
39
|
+
|
|
36
40
|
export const unarchive_ai_chat = function (...args) {
|
|
37
41
|
broker.send_to_queue_async("unarchive_ai_chat", ...args);
|
|
38
42
|
};
|