@xuda.io/ai_module 1.1.3822 → 1.1.3823

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 +3 -3
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -3992,7 +3992,7 @@ export const submit_chat_gpt_prompt = async function (req) {
3992
3992
  format: formattedParams,
3993
3993
  },
3994
3994
  });
3995
-
3995
+ record_chat_usage(uid, response.usage.input_tokens, response.usage.output_tokens, 'submit chat', prompt);
3996
3996
  return { code: 5, data: response.output_text };
3997
3997
  } catch (err) {
3998
3998
  return { code: -5, data: err.message };
@@ -6242,7 +6242,7 @@ const create_ai_agent_image = async function (req, job_id, headers) {
6242
6242
  }
6243
6243
  };
6244
6244
 
6245
- const record_chat_usage = async function (uid, input_tokens, output_tokens, source, msg) {
6245
+ const record_chat_usage = async function (uid, input_tokens, output_tokens, source, prompt) {
6246
6246
  try {
6247
6247
  const app_id = await account_module.get_account_default_project_id(uid);
6248
6248
 
@@ -6250,7 +6250,7 @@ const record_chat_usage = async function (uid, input_tokens, output_tokens, sour
6250
6250
  let usage_doc = {
6251
6251
  _id: await _common.xuda_get_uuid('chat_usage'),
6252
6252
  docType: 'chat_usage',
6253
- msg: msg.substr(0, 40),
6253
+ prompt: prompt.substr(0, 40),
6254
6254
  date_created_ts: t,
6255
6255
  uid,
6256
6256
  source,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.3822",
3
+ "version": "1.1.3823",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",