@xuda.io/account_module 1.2.1549 → 1.2.1550

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 -4
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1866,10 +1866,17 @@ export const get_account_ai_usage = async function (req, job_id, headers) {
1866
1866
  total_usage += input_credits + output_credits;
1867
1867
  }
1868
1868
 
1869
- let membership_plan = _conf.PLAN_OBJ?.[acc_obj?.ai_workspace_plan]?.features?.ai_credits || 0;
1870
- let ai_workspace_plan = _conf.PLAN_OBJ?.[acc_obj?.membership_plan]?.features?.ai_credits || 0;
1871
- let contact_connection = 0;
1872
- let total_credits = membership_plan + ai_workspace_plan + contact_connection;
1869
+ // let membership_plan = _conf.PLAN_OBJ?.[acc_obj?.ai_workspace_plan]?.features?.ai_credits || 0;
1870
+ // let ai_workspace_plan = _conf.PLAN_OBJ?.[acc_obj?.membership_plan]?.features?.ai_credits || 0;
1871
+ // let contact_connection = 0;
1872
+ // let total_credits = membership_plan + ai_workspace_plan + contact_connection;
1873
+
1874
+ const ai_credits = await db_module.get_couch_view('xuda_billing', 'ai_credits', {
1875
+ startkey: [uid, ''],
1876
+ endkey: [uid, 'zzz'],
1877
+ reduce: true,
1878
+ group_level: 999,
1879
+ });
1873
1880
 
1874
1881
  let data = { credits: { membership_plan, ai_workspace_plan, contact_connection, total: total_credits }, usage: { profile, projects: [], total: total_usage } };
1875
1882
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1549",
3
+ "version": "1.2.1550",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {