@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.
- package/index.mjs +7 -9
- 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
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
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
|
-
|
|
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
|
}
|