@xuda.io/ai_module 1.1.4141 → 1.1.4143
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 +11 -7
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1698,15 +1698,18 @@ export const submit_agentic_studio_chat_gpt_prompt = async function (req) {
|
|
|
1698
1698
|
export const get_chat_conversation = async function (req) {
|
|
1699
1699
|
let { conversation_id, order = 'asc', limit, after, _id, uid } = req;
|
|
1700
1700
|
|
|
1701
|
+
const account_profile_info = await account_module.get_active_account_profile_info(uid);
|
|
1702
|
+
|
|
1701
1703
|
if (_id) {
|
|
1702
|
-
const app_id = await account_module.get_account_default_project_id(uid);
|
|
1703
|
-
let data = await db_module.get_app_couch_doc(app_id, _id);
|
|
1704
|
+
// const app_id = await account_module.get_account_default_project_id(uid);
|
|
1705
|
+
let data = await db_module.get_app_couch_doc(account_profile_info.app_id, _id);
|
|
1704
1706
|
return data;
|
|
1705
1707
|
}
|
|
1706
1708
|
|
|
1707
1709
|
try {
|
|
1708
|
-
const project_db = await get_account_project_db(uid);
|
|
1709
|
-
let conversation_doc = await project_db.get(conversation_id);
|
|
1710
|
+
// const project_db = await get_account_project_db(uid);
|
|
1711
|
+
// let conversation_doc = await project_db.get(conversation_id);
|
|
1712
|
+
let conversation_doc = await db_module.get_app_couch_doc(account_profile_info.app_id, conversation_id);
|
|
1710
1713
|
let reference_doc;
|
|
1711
1714
|
if (conversation_doc.shared_from_uid) {
|
|
1712
1715
|
reference_doc = _.cloneDeep(conversation_doc);
|
|
@@ -4251,10 +4254,10 @@ export const create_conversation = async function (req, job_id, headers) {
|
|
|
4251
4254
|
receiver_conversation_doc.chat_image = sender_conversation_doc.chat_image;
|
|
4252
4255
|
await db_module.save_app_couch_doc_native(receiver_app_id, receiver_conversation_doc);
|
|
4253
4256
|
|
|
4254
|
-
await update_conversation_mood_level(conversation_obj.id, prompt, uid, contact_uid_chat_conversation, true);
|
|
4257
|
+
await update_conversation_mood_level(conversation_obj.id, prompt, uid, contact_uid_chat_conversation, true, account_profile_info);
|
|
4255
4258
|
} else {
|
|
4256
4259
|
// other cases rather then chat
|
|
4257
|
-
await update_conversation_mood_level(conversation_obj.id, prompt, null, receiver_contact_doc.contact_uid, conversation_doc.reference_type === 'contacts');
|
|
4260
|
+
await update_conversation_mood_level(conversation_obj.id, prompt, null, receiver_contact_doc.contact_uid, conversation_doc.reference_type === 'contacts', account_profile_info);
|
|
4258
4261
|
}
|
|
4259
4262
|
}
|
|
4260
4263
|
}, 1000);
|
|
@@ -4342,7 +4345,7 @@ export const submit_chat_conversation = async function (req, job_id, headers) {
|
|
|
4342
4345
|
}
|
|
4343
4346
|
};
|
|
4344
4347
|
|
|
4345
|
-
const update_conversation_mood_level = async function (conversation_id, prompt, sender_uid, receiver_uid, update_contact) {
|
|
4348
|
+
const update_conversation_mood_level = async function (conversation_id, prompt, sender_uid, receiver_uid, update_contact, account_profile_info) {
|
|
4346
4349
|
try {
|
|
4347
4350
|
// analyze the mood of the conversation
|
|
4348
4351
|
const mood_level = await submit_chat_gpt_prompt({
|
|
@@ -4353,6 +4356,7 @@ const update_conversation_mood_level = async function (conversation_id, prompt,
|
|
|
4353
4356
|
mood_level: z.number().describe('mood level of interaction: -2: very negative,-1: negative 0:natural 1:positive 2: very positive'),
|
|
4354
4357
|
}),
|
|
4355
4358
|
metadata: { conversation_id, func: 'update_conversation_mood_level' },
|
|
4359
|
+
account_profile_info,
|
|
4356
4360
|
});
|
|
4357
4361
|
|
|
4358
4362
|
const mood_level_obj = JSON5.parse(mood_level.data);
|