@xuda.io/account_module 1.2.2169 → 1.2.2171
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 +2 -25
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -3403,31 +3403,8 @@ export const get_account_ai_usage = async function (req, job_id, headers) {
|
|
|
3403
3403
|
|
|
3404
3404
|
// console.log('ai_usage', ai_usage.rows);
|
|
3405
3405
|
debugger;
|
|
3406
|
-
let total_usage =
|
|
3407
|
-
let profile =
|
|
3408
|
-
|
|
3409
|
-
for (const row of ai_usage.data.rows) {
|
|
3410
|
-
const user = row.key[0];
|
|
3411
|
-
const year = row.key[1];
|
|
3412
|
-
const month = row.key[2];
|
|
3413
|
-
const day = row.key[3];
|
|
3414
|
-
const account_profile_id = row.key[4];
|
|
3415
|
-
const uid = row.key[5];
|
|
3416
|
-
const model = row.key[6];
|
|
3417
|
-
const input_tokens = row.value[0];
|
|
3418
|
-
const output_tokens = row.value[1];
|
|
3419
|
-
const input_credits = row.value[2];
|
|
3420
|
-
const output_credits = row.value[3];
|
|
3421
|
-
if (!profile[account_profile_id]) {
|
|
3422
|
-
profile[account_profile_id] = {};
|
|
3423
|
-
}
|
|
3424
|
-
if (!profile[account_profile_id][uid]) {
|
|
3425
|
-
profile[account_profile_id][uid] = 0;
|
|
3426
|
-
}
|
|
3427
|
-
|
|
3428
|
-
profile[account_profile_id][uid] += input_credits + output_credits;
|
|
3429
|
-
total_usage += input_credits + output_credits;
|
|
3430
|
-
}
|
|
3406
|
+
let total_usage = response.total_usage;
|
|
3407
|
+
let profile = response.profiles;
|
|
3431
3408
|
|
|
3432
3409
|
const ai_credits = await db_module.get_couch_view('xuda_billing', 'ai_credits', {
|
|
3433
3410
|
startkey: [uid, ''],
|