@xuda.io/ai_module 1.1.3953 → 1.1.3955

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 +6 -0
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -6370,6 +6370,11 @@ const record_chat_usage = async function (uid, input_tokens, output_tokens, sour
6370
6370
  try {
6371
6371
  const app_id = await account_module.get_account_default_project_id(uid);
6372
6372
 
6373
+ const cost = _conf?.ai_models?.[model] || {
6374
+ input: 1.0,
6375
+ output: 1.0,
6376
+ };
6377
+
6373
6378
  const t = Date.now();
6374
6379
  let usage_doc = {
6375
6380
  _id: await _common.xuda_get_uuid('chat_usage'),
@@ -6383,6 +6388,7 @@ const record_chat_usage = async function (uid, input_tokens, output_tokens, sour
6383
6388
  stat: 3,
6384
6389
  metadata,
6385
6390
  model,
6391
+ cost,
6386
6392
  };
6387
6393
  const save_ret = await db_module.save_app_couch_doc(app_id, usage_doc);
6388
6394
  // console.log(save_ret);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.3953",
3
+ "version": "1.1.3955",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",