@xuda.io/account_module 1.2.2092 → 1.2.2094
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 +7 -5
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -51,14 +51,12 @@ const team_ms = await import(`${module_path}/team_module/index_ms.mjs`);
|
|
|
51
51
|
const email_ms = await import(`${module_path}/email_module/index_ms.mjs`);
|
|
52
52
|
const marketplace_ms = await import(`${module_path}/marketplace_module/index_ms.mjs`);
|
|
53
53
|
const stripe_ms = await import(`${module_path}/stripe_module/index_ms.mjs`);
|
|
54
|
-
const logs_ms = await import(`${module_path}/logs_module/index_ms.mjs`);
|
|
55
54
|
|
|
56
55
|
const ws_dashboard_msa = await import(`${module_path}/ws_dashboard_module/index_msa.mjs`);
|
|
57
56
|
const drive_msa = await import(`${module_path}/drive_module/index_msa.mjs`);
|
|
58
57
|
const email_msa = await import(`${module_path}/email_module/index_msa.mjs`);
|
|
59
58
|
const logs_msa = await import(`${module_path}/logs_module/index_msa.mjs`);
|
|
60
59
|
const ai_msa = await import(`${module_path}/ai_module/index_msa.mjs`);
|
|
61
|
-
// const {get_active_account_profile_info} = await import(`${module_path}/ws_dashboard_module/get_active_account_profile_info.mjs`);
|
|
62
60
|
|
|
63
61
|
export const update_account_info = async function (req, job_id, headers) {
|
|
64
62
|
const { uid } = req;
|
|
@@ -1782,15 +1780,15 @@ export const ts_contact = async function (uid, contact_id) {
|
|
|
1782
1780
|
};
|
|
1783
1781
|
|
|
1784
1782
|
export const get_account_ai_usage = async function (req, job_id, headers) {
|
|
1785
|
-
const { uid,
|
|
1783
|
+
const { uid, year_from, month_from, day_from, year_to, month_to, day_to } = req;
|
|
1786
1784
|
try {
|
|
1787
1785
|
const d = new Date();
|
|
1788
1786
|
const curr_month = Number(String(d.getMonth() + 1).padStart(2, '0')); // months are 0-based
|
|
1789
1787
|
const curr_year = d.getFullYear();
|
|
1790
1788
|
|
|
1791
1789
|
const ai_usage = await db_module.get_couch_view('xuda_usage', 'ai_usage', {
|
|
1792
|
-
startkey: [uid,
|
|
1793
|
-
endkey: [uid,
|
|
1790
|
+
startkey: [uid, year_from || curr_year, month_from || curr_month, day_from || 0],
|
|
1791
|
+
endkey: [uid, year_to || curr_year, month_to || curr_month, day_to || 99],
|
|
1794
1792
|
reduce: true,
|
|
1795
1793
|
group_level: 999,
|
|
1796
1794
|
});
|
|
@@ -3305,6 +3303,8 @@ export const find_contact_query = async function (uid, opt) {
|
|
|
3305
3303
|
return ret;
|
|
3306
3304
|
};
|
|
3307
3305
|
|
|
3306
|
+
//////////////////////////////
|
|
3307
|
+
|
|
3308
3308
|
export const delete_xuda_cache = async function (contact_obj) {
|
|
3309
3309
|
const ret = await db_module.find_couch_query('xuda_cache', {
|
|
3310
3310
|
selector: {
|
|
@@ -3375,6 +3375,8 @@ export const save_cache_hit = async function (_id) {
|
|
|
3375
3375
|
}
|
|
3376
3376
|
};
|
|
3377
3377
|
|
|
3378
|
+
///////////////////////////////
|
|
3379
|
+
|
|
3378
3380
|
export const record_ai_usage = async function (uid, input_tokens, output_tokens, source, prompt, model, metadata = {}, account_profile_info, tools) {
|
|
3379
3381
|
try {
|
|
3380
3382
|
if (!account_profile_info) throw new Error('missing account_profile_info');
|