@xuda.io/account_module 1.2.2225 → 1.2.2231
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 +45 -38
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -189,12 +189,12 @@ export const update_account_info = async function (req, job_id, headers) {
|
|
|
189
189
|
return save_ret;
|
|
190
190
|
};
|
|
191
191
|
export const update_account_preferences = async function (req) {
|
|
192
|
-
const { uid, hide_create_button, default_dashboard, sidebar_style } = req;
|
|
192
|
+
const { uid, hide_create_button, default_dashboard, sidebar_style, enable_thumbnail_avatar_generation } = req;
|
|
193
193
|
try {
|
|
194
194
|
let account_doc = await db_module.get_couch_doc_native('xuda_accounts', uid);
|
|
195
195
|
account_doc.ts = Date.now();
|
|
196
196
|
|
|
197
|
-
account_doc.preferences = { hide_create_button, default_dashboard, sidebar_style };
|
|
197
|
+
account_doc.preferences = { hide_create_button, default_dashboard, sidebar_style, enable_thumbnail_avatar_generation };
|
|
198
198
|
|
|
199
199
|
const save_ret = await db_module.save_couch_doc('xuda_accounts', account_doc);
|
|
200
200
|
if (save_ret.code < 0) {
|
|
@@ -1730,7 +1730,7 @@ export const get_account_default_project_id = async function (uid) {
|
|
|
1730
1730
|
|
|
1731
1731
|
export const get_user_name = async function (uid) {
|
|
1732
1732
|
try {
|
|
1733
|
-
const account_info = await get_account_name({ uid });
|
|
1733
|
+
const { data: account_info } = await get_account_name({ uid });
|
|
1734
1734
|
let username = 'unknown';
|
|
1735
1735
|
if (account_info) {
|
|
1736
1736
|
username = account_info.first_name + ' ' + account_info.last_name;
|
|
@@ -2060,6 +2060,8 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2060
2060
|
profile_avatar_stat: 0,
|
|
2061
2061
|
};
|
|
2062
2062
|
|
|
2063
|
+
|
|
2064
|
+
|
|
2063
2065
|
if (!is_spam) {
|
|
2064
2066
|
if (account_type === 'personal' || contact_obj?.business_has_person) {
|
|
2065
2067
|
contact_obj.person_info = await ai_ms.get_person_info(uid, contact_obj.name, contact_obj.email, account_profile_info, metadata?.summarized_body, { light: true });
|
|
@@ -2067,6 +2069,11 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2067
2069
|
contact_obj.name = await ai_ms.get_name_from_email_addr(uid, contact_obj.email, account_profile_info);
|
|
2068
2070
|
}
|
|
2069
2071
|
}
|
|
2072
|
+
|
|
2073
|
+
const conversation_obj = await ai_ms.create_openai_conversation();
|
|
2074
|
+
contact_obj.contact_reference_conversation_id= conversation_obj.id,
|
|
2075
|
+
|
|
2076
|
+
|
|
2070
2077
|
} else {
|
|
2071
2078
|
if (!contact_obj.name) {
|
|
2072
2079
|
contact_obj.name = '';
|
|
@@ -2366,50 +2373,50 @@ export const get_contacts = async function (req, job_id, headers) {
|
|
|
2366
2373
|
|
|
2367
2374
|
let contact_docs = { docs: [], total_docs: contacts.total_docs };
|
|
2368
2375
|
|
|
2369
|
-
const chat_conversation_count = async function () {
|
|
2370
|
-
|
|
2376
|
+
// const chat_conversation_count = async function () {
|
|
2377
|
+
// // const account_profile_info = await get_active_account_profile_info(uid);
|
|
2371
2378
|
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2379
|
+
// const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'conversations_item_counts', {
|
|
2380
|
+
// reduce: true,
|
|
2381
|
+
// group_level: 999,
|
|
2375
2382
|
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2383
|
+
// startkey: ['contacts', '', ''],
|
|
2384
|
+
// endkey: ['contacts', 'zzzzzz', 'zzzzzz'],
|
|
2385
|
+
// });
|
|
2379
2386
|
|
|
2380
|
-
|
|
2387
|
+
// // return counts_ret?.rows?.[0]?.value || 0;
|
|
2381
2388
|
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2389
|
+
// let counts = {};
|
|
2390
|
+
// for (const val of counts_ret?.rows) {
|
|
2391
|
+
// if (!counts[val.key[1]]) {
|
|
2392
|
+
// counts[val.key[1]] = 0;
|
|
2393
|
+
// }
|
|
2387
2394
|
|
|
2388
|
-
|
|
2389
|
-
|
|
2395
|
+
// counts[val.key[1]] += val.value;
|
|
2396
|
+
// }
|
|
2390
2397
|
|
|
2391
|
-
|
|
2392
|
-
};
|
|
2393
|
-
const chat_conversation_read = async function () {
|
|
2394
|
-
|
|
2398
|
+
// return counts;
|
|
2399
|
+
// };
|
|
2400
|
+
// const chat_conversation_read = async function () {
|
|
2401
|
+
// // const account_profile_info = await get_active_account_profile_info(uid);
|
|
2395
2402
|
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2403
|
+
// const counts_ret = await db_module.get_app_couch_view(account_profile_info.app_id, 'chat_conversation_item_read', {
|
|
2404
|
+
// reduce: true,
|
|
2405
|
+
// group_level: 999,
|
|
2399
2406
|
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2407
|
+
// startkey: [uid, '', ''],
|
|
2408
|
+
// endkey: [uid, 'zzzzzz', 'zzzzzz'],
|
|
2409
|
+
// });
|
|
2403
2410
|
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
};
|
|
2411
|
+
// let counts = {};
|
|
2412
|
+
// for (const val of counts_ret?.rows) {
|
|
2413
|
+
// if (!counts[val.key[1]]) {
|
|
2414
|
+
// counts[val.key[1]] = 0;
|
|
2415
|
+
// }
|
|
2416
|
+
// counts[val.key[1]] += val.value;
|
|
2417
|
+
// }
|
|
2418
|
+
// return counts;
|
|
2419
|
+
// };
|
|
2413
2420
|
|
|
2414
2421
|
// const contact_chat_conversation_count_ret = await chat_conversation_count();
|
|
2415
2422
|
// const contact_chat_conversation_read_ret = await chat_conversation_read();
|