diff --git a/packages/assistify-ai/server/SmartiProxy.js b/packages/assistify-ai/server/SmartiProxy.js index 5c7cea60e3fa..9f22a091d20b 100644 --- a/packages/assistify-ai/server/SmartiProxy.js +++ b/packages/assistify-ai/server/SmartiProxy.js @@ -42,7 +42,7 @@ export class SmartiProxy { try { SystemLogger.debug('Sending request to Smarti', method, 'to', url, 'body', JSON.stringify(body)); const response = HTTP.call(method, url, {data: body, headers: header}); - if (response.statusCode === 200 || response.statusCode === 201) { + if (response.statusCode < 400) { return response.data || response.content; //.data if it's a json-response } else { SystemLogger.debug('Got unexpected result from Smarti', method, 'to', url, 'response', JSON.stringify(response)); diff --git a/packages/assistify-ai/server/lib/SmartiAdapter.js b/packages/assistify-ai/server/lib/SmartiAdapter.js index bb90a416f298..2f8fbd9f6ed0 100644 --- a/packages/assistify-ai/server/lib/SmartiAdapter.js +++ b/packages/assistify-ai/server/lib/SmartiAdapter.js @@ -97,7 +97,9 @@ export class SmartiAdapter { // The "support_area" in Smarti is an optional property. A historic conversation belonging to the same support_are increases relevance let supportArea = room.parentRoomId || room.topic || room.expertise; if (!supportArea) { - if (helpRequest && helpRequest.supportArea) { + if (room.t === '') { + supportArea = 'livechat'; + } else if (helpRequest && helpRequest.supportArea) { supportArea = helpRequest.supportArea; } else { supportArea = room.name; @@ -113,7 +115,7 @@ export class SmartiAdapter { 'channel_id': [message.rid] }, 'user': { - 'id': room.u._id + 'id': room.u ? room.u._id : room.v._id }, 'messages': [requestBodyMessage], 'context': {