@xuda.io/account_module 1.2.1208 → 1.2.1210

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.
Files changed (2) hide show
  1. package/index.mjs +11 -1
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2468,11 +2468,21 @@ export const get_account_ai_usage = async function (req, job_id, headers) {
2468
2468
  profile['prf_123'] = 0;
2469
2469
  debugger;
2470
2470
  for (const row of ai_usage.rows) {
2471
+ const year = row.key[0];
2472
+ const month = row.key[1];
2473
+ const day = row.key[3];
2474
+ const account_profile_id = row.key[4];
2475
+ const uid = row.key[5];
2476
+ const model = row.key[6];
2471
2477
  const input_tokens = row.value[0];
2472
2478
  const output_tokens = row.value[1];
2473
2479
  const input_credits = row.value[2];
2474
2480
  const output_credits = row.value[3];
2475
- profile['prf_123'] += input_credits + output_credits;
2481
+ if (!profile[account_profile_id]) {
2482
+ profile[account_profile_id] = {};
2483
+ }
2484
+
2485
+ profile[account_profile_id][uid] += input_credits + output_credits;
2476
2486
  }
2477
2487
 
2478
2488
  let membership_plan = _conf.PLAN_OBJ?.[acc_obj?.ai_workspace_plan]?.features?.ai_credits || 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1208",
3
+ "version": "1.2.1210",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {