@xuda.io/ai_module 1.1.3689 → 1.1.3691
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 +19 -19
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1920,30 +1920,30 @@ export const delete_ai_chat = async function (req) {
|
|
|
1920
1920
|
let { conversation_id, uid } = req;
|
|
1921
1921
|
|
|
1922
1922
|
const app_id = await account_module.get_account_default_project_id(uid);
|
|
1923
|
+
let conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_id);
|
|
1923
1924
|
try {
|
|
1924
|
-
let conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_id);
|
|
1925
|
-
conversation_doc.stat = 4;
|
|
1926
|
-
conversation_doc.ts = Date.now();
|
|
1927
|
-
const save_ret = await db_module.save_app_couch_doc(app_id, conversation_doc);
|
|
1928
|
-
|
|
1929
|
-
client.conversations.delete(conversation_id);
|
|
1930
|
-
|
|
1931
|
-
for (const msg of conversation_doc?.messages || []) {
|
|
1932
|
-
for (const attachment of msg?.attachments || []) {
|
|
1933
|
-
try {
|
|
1934
|
-
if (attachment.id) client.files.delete(attachment.id);
|
|
1935
|
-
} catch (error) {}
|
|
1936
|
-
}
|
|
1937
|
-
}
|
|
1938
|
-
|
|
1939
|
-
if (conversation_doc?.chat_image?.[0]) {
|
|
1940
|
-
drive_module.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) }] });
|
|
1941
|
-
}
|
|
1942
|
-
|
|
1943
1925
|
if (conversation_doc.shared_from_uid) {
|
|
1944
1926
|
// const team_req = await db_module.get_couch_doc_native('xuda_team', conversation_doc.team_req_id);
|
|
1945
1927
|
const team_module = await import(`${module_path}/team_module/index.mjs`);
|
|
1946
1928
|
team_module.remove_team_member({ team_req_id: conversation_doc.team_req_id });
|
|
1929
|
+
} else {
|
|
1930
|
+
conversation_doc.stat = 4;
|
|
1931
|
+
conversation_doc.ts = Date.now();
|
|
1932
|
+
const save_ret = await db_module.save_app_couch_doc(app_id, conversation_doc);
|
|
1933
|
+
|
|
1934
|
+
client.conversations.delete(conversation_id);
|
|
1935
|
+
|
|
1936
|
+
for (const msg of conversation_doc?.messages || []) {
|
|
1937
|
+
for (const attachment of msg?.attachments || []) {
|
|
1938
|
+
try {
|
|
1939
|
+
if (attachment.id) client.files.delete(attachment.id);
|
|
1940
|
+
} catch (error) {}
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
if (conversation_doc?.chat_image?.[0]) {
|
|
1945
|
+
drive_module.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) }] });
|
|
1946
|
+
}
|
|
1947
1947
|
}
|
|
1948
1948
|
|
|
1949
1949
|
return save_ret;
|