@xuda.io/ai_module 1.1.3843 → 1.1.3845

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
@@ -2062,7 +2062,7 @@ const create_image = async function (uid, prompt, model = 'gpt-image-1-mini', si
2062
2062
 
2063
2063
  const thumbnailBase64 = resized.toString('base64');
2064
2064
 
2065
- record_chat_usage(uid, response.usage.input_tokens, response.usage.output_tokens, 'create image', prompt);
2065
+ record_chat_usage(uid, response.usage.input_tokens, response.usage.output_tokens, 'create image', prompt, model);
2066
2066
 
2067
2067
  return thumbnailBase64;
2068
2068
  } catch (err) {
@@ -3996,7 +3996,7 @@ export const submit_chat_gpt_prompt = async function (req) {
3996
3996
  format: formattedParams,
3997
3997
  },
3998
3998
  });
3999
- record_chat_usage(uid, response.usage.input_tokens, response.usage.output_tokens, 'submit chat', prompt);
3999
+ record_chat_usage(uid, response.usage.input_tokens, response.usage.output_tokens, 'submit chat', prompt, model);
4000
4000
  return { code: 5, data: response.output_text };
4001
4001
  } catch (err) {
4002
4002
  return { code: -5, data: err.message };
@@ -5071,7 +5071,7 @@ const ai_chat_conversation = async function (req, job_id, headers) {
5071
5071
  conversation_doc.stat = 3;
5072
5072
  conversation_doc.messages.push(obj);
5073
5073
  await db_module.save_app_couch_doc_native(app_id, conversation_doc);
5074
- record_chat_usage(uid, output.state._context.usage.inputTokens, output.state._context.usage.outputTokens, 'conversation chat', prompt);
5074
+ record_chat_usage(uid, output.state._context.usage.inputTokens, output.state._context.usage.outputTokens, 'conversation chat', prompt, model);
5075
5075
  // if (!conversation_doc.chat_image && (!conversation_doc.thumbnail_request_ts || Date.now() - conversation_doc.thumbnail_request_ts > 120000)) {
5076
5076
  // update_thumbnail('conversation', conversation_doc, app_id, uid, job_id, headers);
5077
5077
  // }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.3843",
3
+ "version": "1.1.3845",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",