@xuda.io/ai_module 1.1.4618 → 1.1.4620
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 +9 -3
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1805,6 +1805,12 @@ export const get_ai_chats = async function (req, job_id, headers) {
|
|
|
1805
1805
|
sort: [{ ts: reference_id ? 'asc' : 'desc' }],
|
|
1806
1806
|
};
|
|
1807
1807
|
|
|
1808
|
+
if (reference_id) {
|
|
1809
|
+
opt.sort = [{ date_created_ts: 'asc' }];
|
|
1810
|
+
} else {
|
|
1811
|
+
opt.sort = [{ ts: 'desc' }];
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1808
1814
|
if (!account_profile_info.is_main) {
|
|
1809
1815
|
opt.selector.account_profiles = { $in: [account_profile_info.account_profile_id] };
|
|
1810
1816
|
}
|
|
@@ -4117,13 +4123,13 @@ export const create_conversation = async function (req, job_id, headers) {
|
|
|
4117
4123
|
}
|
|
4118
4124
|
|
|
4119
4125
|
const conversation_obj = await client.conversations.create();
|
|
4120
|
-
const
|
|
4126
|
+
const d = Date.now();
|
|
4121
4127
|
let conversation_doc = {
|
|
4122
4128
|
_id: await _common.xuda_get_uuid('chat_conversation'),
|
|
4123
4129
|
docType: 'chat_conversation',
|
|
4124
4130
|
title: conversation_type !== 'email' ? getFirstNWords(prompt, 10) : prompt,
|
|
4125
|
-
date_created_ts: new Date(date_created).getTime(),
|
|
4126
|
-
ts:
|
|
4131
|
+
date_created_ts: date_created ? new Date(date_created).getTime() : d,
|
|
4132
|
+
ts: d,
|
|
4127
4133
|
stat: !conversation_type || conversation_type === 'ai' ? 1 : 3,
|
|
4128
4134
|
uid,
|
|
4129
4135
|
messages: [],
|