@xuda.io/ai_module 1.1.3797 → 1.1.3799
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 +2 -9
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -4130,6 +4130,7 @@ export const submit_chat_conversation = async function (req, job_id, headers) {
|
|
|
4130
4130
|
let conversation_doc = await db_module.get_app_couch_doc_native(app_id, conversation_id);
|
|
4131
4131
|
req.conversation_doc = conversation_doc;
|
|
4132
4132
|
if (conversation_doc.conversation_type === 'note') {
|
|
4133
|
+
return await chat_note(req, job_id, header);
|
|
4133
4134
|
} else {
|
|
4134
4135
|
if (conversation_doc.reference_type === 'contacts') {
|
|
4135
4136
|
return await contact_chat_conversation(req, job_id, headers);
|
|
@@ -4236,20 +4237,12 @@ const contact_chat_conversation = async function (req, job_id, headers) {
|
|
|
4236
4237
|
return { code: 15, data: item };
|
|
4237
4238
|
};
|
|
4238
4239
|
|
|
4239
|
-
const
|
|
4240
|
+
const chat_note = async function (req, job_id, headers) {
|
|
4240
4241
|
const { uid } = req;
|
|
4241
4242
|
let { prompt, conversation_doc, attachments = [], ai_agents } = req;
|
|
4242
4243
|
|
|
4243
4244
|
const conversation_id = conversation_doc._id;
|
|
4244
4245
|
|
|
4245
|
-
const receiver_contact_doc = await account_module.get_contact_info(uid, null, conversation_doc.reference_id);
|
|
4246
|
-
const receiver_app_id = await account_module.get_account_default_project_id(receiver_contact_doc.contact_uid);
|
|
4247
|
-
let receiver_conversation_doc = await db_module.get_app_couch_doc_native(receiver_app_id, conversation_id);
|
|
4248
|
-
|
|
4249
|
-
const sender_contact_doc = await account_module.get_contact_info(uid, null, conversation_doc.reference_id);
|
|
4250
|
-
const sender_app_id = await account_module.get_account_default_project_id(uid);
|
|
4251
|
-
let sender_conversation_doc = await db_module.get_app_couch_doc_native(sender_app_id, conversation_id);
|
|
4252
|
-
|
|
4253
4246
|
const item = await client.conversations.items.create(conversation_id, {
|
|
4254
4247
|
items: [
|
|
4255
4248
|
{
|