@peopl-health/nexus 1.4.8 → 1.5.1
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.
|
@@ -332,27 +332,14 @@ class NexusMessaging {
|
|
|
332
332
|
|
|
333
333
|
async handleMessageWithAssistant(messageData) {
|
|
334
334
|
try {
|
|
335
|
-
// Convert Twilio format to internal format if needed
|
|
336
|
-
const internalMessage = this.provider.constructor.name === 'TwilioProvider'
|
|
337
|
-
? convertTwilioToInternalFormat(messageData)
|
|
338
|
-
: messageData;
|
|
339
|
-
|
|
340
|
-
// Extract standardized data
|
|
341
|
-
const extractedData = {
|
|
342
|
-
from: internalMessage.key?.remoteJid || '',
|
|
343
|
-
message: internalMessage.message?.conversation || '',
|
|
344
|
-
messageId: internalMessage.key?.id || '',
|
|
345
|
-
fromMe: internalMessage.key?.fromMe || false
|
|
346
|
-
};
|
|
347
|
-
|
|
348
335
|
const response = await replyAssistant(
|
|
349
|
-
|
|
350
|
-
|
|
336
|
+
messageData.from,
|
|
337
|
+
messageData.message
|
|
351
338
|
);
|
|
352
339
|
|
|
353
340
|
if (response) {
|
|
354
341
|
await this.sendMessage({
|
|
355
|
-
to:
|
|
342
|
+
to: messageData.from,
|
|
356
343
|
message: response
|
|
357
344
|
});
|
|
358
345
|
}
|
|
@@ -221,7 +221,7 @@ const replyAssistant = async function (code, message_ = null, thread_ = null, ru
|
|
|
221
221
|
console.log('THREAD STOPPED', code, thread?.active);
|
|
222
222
|
if (!thread || !thread.active) return null;
|
|
223
223
|
|
|
224
|
-
const patientReply =
|
|
224
|
+
const patientReply = await getLastMessages(code);
|
|
225
225
|
console.log('UNREAD DATA', patientReply);
|
|
226
226
|
if (!patientReply) {
|
|
227
227
|
console.log('No relevant data found for this assistant.');
|