@xuda.io/ai_module 1.1.4476 → 1.1.4478

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 +9 -1
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -4053,7 +4053,7 @@ export const submit_chat_gpt_prompt = async function (req) {
4053
4053
  }
4054
4054
  };
4055
4055
  export const create_conversation = async function (req, job_id, headers) {
4056
- const { uid, prompt, perform_ai_execution = true, email_direction = 'out' } = req;
4056
+ const { uid, prompt, perform_ai_execution = true, email_id, email_direction = 'out' } = req;
4057
4057
  let { reference_type, reference_id = '', conversation_type } = req;
4058
4058
 
4059
4059
  function getFirstTenWords(text) {
@@ -4065,6 +4065,12 @@ export const create_conversation = async function (req, job_id, headers) {
4065
4065
  const account_profile_info = await account_module.get_active_account_profile_info(uid);
4066
4066
  const { account_profile_obj } = account_profile_info;
4067
4067
 
4068
+ if (conversation_type === 'email' && email_direction === 'out') {
4069
+ if (!account_profile_obj?.email_account_id) {
4070
+ throw new Error('email_account_id must be defined');
4071
+ }
4072
+ }
4073
+
4068
4074
  let { data: ai_credits } = await account_module.get_account_ai_usage(account_profile_info.uid);
4069
4075
 
4070
4076
  try {
@@ -4088,6 +4094,8 @@ export const create_conversation = async function (req, job_id, headers) {
4088
4094
  conversation_obj,
4089
4095
  conversation_type,
4090
4096
  initiator_uid: uid,
4097
+ email_direction,
4098
+ email_id,
4091
4099
 
4092
4100
  account_profiles: [account_profile_obj._id],
4093
4101
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4476",
3
+ "version": "1.1.4478",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",