@xuda.io/account_module 1.2.1363 → 1.2.1365
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 +8 -7
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1287,6 +1287,7 @@ export const get_contact_info = async function (uid, contact_doc, _id) {
|
|
|
1287
1287
|
doc.connection_stat = req_doc.team_req_stat;
|
|
1288
1288
|
doc.connection_type = req_doc.access_type;
|
|
1289
1289
|
doc.connection_uid = req_doc.team_req_from_uid === uid ? req_doc.team_req_to_uid : req_doc.team_req_from_uid;
|
|
1290
|
+
doc.connection_contact_id = req_doc.team_req_from_contact_id === doc._id ? req_doc.team_req_to_contact_id : req_doc.team_req_from_contact_id;
|
|
1290
1291
|
if (doc.connection_type === 'contact_connection') {
|
|
1291
1292
|
doc.friend_since = req_doc.team_req_date;
|
|
1292
1293
|
}
|
|
@@ -1843,13 +1844,13 @@ export const onboarding_completed = async function (req, job_id, headers) {
|
|
|
1843
1844
|
|
|
1844
1845
|
/// create view
|
|
1845
1846
|
|
|
1846
|
-
let _design = await db_module.get_app_couch_doc_native(account_doc.account_project_id, '_design/xuda');
|
|
1847
|
-
if (!_design.views.ai_chat_usage) {
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
}
|
|
1847
|
+
// let _design = await db_module.get_app_couch_doc_native(account_doc.account_project_id, '_design/xuda');
|
|
1848
|
+
// if (!_design.views.ai_chat_usage) {
|
|
1849
|
+
// _design.views['ai_chat_usage'] = {
|
|
1850
|
+
// map: "function formatTimestampToDDMMYYYY(timestampMs) {\n const date = new Date(timestampMs); // directly use milliseconds\n\n const day = Number(String(date.getDate()).padStart(2, '0'));\n const month =Number( String(date.getMonth() + 1).padStart(2, '0')); // months are 0-based\n const year = date.getFullYear();\n\n // return `${day}/${month}/${year}`;\n return {day,month,year}\n}\n\nfunction (doc) {\n \n if(doc.docType===\"chat_usage\"){\n if(doc.cost && doc.account_profile_info){\n const cost_input=(doc.cost.input/1000000)*doc.input_tokens*100 ;\n const cost_output=(doc.cost.output/1000000)*doc.output_tokens*100 \n \n const d=formatTimestampToDDMMYYYY(doc.date_created_ts)\n emit([d.year,d.month,d.day,doc.account_profile_info.account_profile_id,doc.account_profile_info.account_profile_obj.uid,doc.model], [doc.input_tokens,doc.output_tokens ,cost_input,cost_output]);\n // emit([d.year,d.month,d.day,doc.model], [doc.input_tokens,doc.output_tokens]);\n}\n }\n }",
|
|
1851
|
+
// reduce: '_sum',
|
|
1852
|
+
// };
|
|
1853
|
+
// }
|
|
1853
1854
|
await db_module.save_app_couch_doc_native(account_doc.account_project_id, _design);
|
|
1854
1855
|
///////
|
|
1855
1856
|
|