@xuda.io/account_module 1.2.1209 → 1.2.1211

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 +9 -2
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2471,14 +2471,21 @@ export const get_account_ai_usage = async function (req, job_id, headers) {
2471
2471
  const year = row.key[0];
2472
2472
  const month = row.key[1];
2473
2473
  const day = row.key[3];
2474
- const profile = row.key[4];
2474
+ const account_profile_id = row.key[4];
2475
2475
  const uid = row.key[5];
2476
2476
  const model = row.key[6];
2477
2477
  const input_tokens = row.value[0];
2478
2478
  const output_tokens = row.value[1];
2479
2479
  const input_credits = row.value[2];
2480
2480
  const output_credits = row.value[3];
2481
- profile['prf_123'] += input_credits + output_credits;
2481
+ if (!profile[account_profile_id]) {
2482
+ profile[account_profile_id] = {};
2483
+ }
2484
+ if (!profile[account_profile_id][uid]) {
2485
+ profile[account_profile_id][uid] = 0;
2486
+ }
2487
+
2488
+ profile[account_profile_id][uid] += input_credits + output_credits;
2482
2489
  }
2483
2490
 
2484
2491
  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.1209",
3
+ "version": "1.2.1211",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {