@xuda.io/ai_module 1.1.5514 → 1.1.5516
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 +17 -9
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -5124,18 +5124,26 @@ const add_conversation_item = async function (uid, profile_id, conversation_id,
|
|
|
5124
5124
|
|
|
5125
5125
|
let text = `${new Date()} User Uid: ${uid} User Name: ${account_info.full_name} Type: ${conversation_type}`;
|
|
5126
5126
|
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
content: [{ type: 'input_text', text }],
|
|
5132
|
-
},
|
|
5133
|
-
],
|
|
5127
|
+
switch (conversation_type) {
|
|
5128
|
+
case 'note':
|
|
5129
|
+
text += ` ${body}`;
|
|
5130
|
+
break;
|
|
5134
5131
|
|
|
5132
|
+
default:
|
|
5133
|
+
break;
|
|
5134
|
+
}
|
|
5135
|
+
|
|
5136
|
+
const items = [
|
|
5137
|
+
{
|
|
5138
|
+
type: 'message',
|
|
5139
|
+
role: 'user',
|
|
5140
|
+
content: [{ type: 'input_text', text }],
|
|
5141
|
+
},
|
|
5142
|
+
];
|
|
5135
5143
|
|
|
5136
5144
|
try {
|
|
5137
5145
|
const item = await client.conversations.items.create(conversation_doc.reference_conversation_id, {
|
|
5138
|
-
items
|
|
5146
|
+
items,
|
|
5139
5147
|
});
|
|
5140
5148
|
} catch (err) {
|
|
5141
5149
|
throw err;
|
|
@@ -5144,7 +5152,7 @@ const items= [
|
|
|
5144
5152
|
try {
|
|
5145
5153
|
let contact_doc = await db_module.get_app_couch_doc_native(account_profile_info.app_id, contact_id);
|
|
5146
5154
|
const item = await client.conversations.items.create(contact_doc.contact_reference_conversation_id, {
|
|
5147
|
-
items
|
|
5155
|
+
items,
|
|
5148
5156
|
});
|
|
5149
5157
|
} catch (err) {
|
|
5150
5158
|
throw err;
|