@xuda.io/account_module 1.2.1532 → 1.2.1534
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 +5 -5
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -3046,12 +3046,12 @@ export const record_ai_usage = async function (uid, input_tokens, output_tokens,
|
|
|
3046
3046
|
}
|
|
3047
3047
|
};
|
|
3048
3048
|
|
|
3049
|
-
export const record_ai_credit = async function (uid, credits = 0, source,
|
|
3049
|
+
export const record_ai_credit = async function (uid, credits = 0, source, credited_uid) {
|
|
3050
3050
|
try {
|
|
3051
|
-
if (!account_profile_info) throw new Error('missing account_profile_info');
|
|
3051
|
+
// if (!account_profile_info) throw new Error('missing account_profile_info');
|
|
3052
3052
|
|
|
3053
3053
|
const t = Date.now();
|
|
3054
|
-
let
|
|
3054
|
+
let credit_doc = {
|
|
3055
3055
|
_id: await _common.xuda_get_uuid('ai_credit'),
|
|
3056
3056
|
docType: 'ai_credit',
|
|
3057
3057
|
credits,
|
|
@@ -3059,9 +3059,9 @@ export const record_ai_credit = async function (uid, credits = 0, source, accoun
|
|
|
3059
3059
|
uid,
|
|
3060
3060
|
source,
|
|
3061
3061
|
stat: 3,
|
|
3062
|
-
|
|
3062
|
+
credited_uid,
|
|
3063
3063
|
};
|
|
3064
|
-
const save_ret = await db_module.save_couch_doc('xuda_billing',
|
|
3064
|
+
const save_ret = await db_module.save_couch_doc('xuda_billing', credit_doc);
|
|
3065
3065
|
// console.log(save_ret);
|
|
3066
3066
|
} catch (err) {
|
|
3067
3067
|
console.error(err);
|