@xuda.io/ai_module 1.1.4512 → 1.1.4513

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 +7 -9
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4090,7 +4090,6 @@ export const submit_chat_gpt_prompt = async function (req) {
4090
4090
  }
4091
4091
  };
4092
4092
  export const create_conversation = async function (req, job_id, headers) {
4093
- debugger;
4094
4093
  const { uid, prompt, perform_ai_execution = true, email_id, email_direction = 'out' } = req;
4095
4094
  let { reference_type, reference_id = '', conversation_type } = req;
4096
4095
 
@@ -4102,17 +4101,16 @@ export const create_conversation = async function (req, job_id, headers) {
4102
4101
 
4103
4102
  const account_profile_info = await account_module.get_active_account_profile_info(uid);
4104
4103
  const { account_profile_obj } = account_profile_info;
4105
-
4106
- if (conversation_type === 'email') {
4107
- ///&& email_direction === 'out'
4108
- if (!account_profile_obj?.email_account_id) {
4109
- throw new Error('The user profile must include a defined email_account_id');
4104
+ try {
4105
+ if (conversation_type === 'email') {
4106
+ ///&& email_direction === 'out'
4107
+ if (!account_profile_obj?.email_account_id) {
4108
+ throw new Error('The user profile must include a defined email_account_id');
4109
+ }
4110
4110
  }
4111
- }
4112
4111
 
4113
- let { data: ai_credits } = await account_module.get_account_ai_usage(account_profile_info.uid);
4112
+ let { data: ai_credits } = await account_module.get_account_ai_usage(account_profile_info.uid);
4114
4113
 
4115
- try {
4116
4114
  if (ai_credits.credits.total - ai_credits.usage.total < -0.5) {
4117
4115
  throw new Error('ai credits reach to hard limit');
4118
4116
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4512",
3
+ "version": "1.1.4513",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",