Skip to content

Commit

Permalink
Smarti Widget 0.7.1 (RocketChat#332)
Browse files Browse the repository at this point in the history
* Smarti-203: Flag widget messages
* Smarti-203: Rename widget message flag to skipAnalysis
* Smarti-52: Add support for edited messages
* redlink-gmbh/smarti#221: Set room topic as support area for conversation
* Revert "redlink-gmbh/smarti#221: Set room topic as support area for conversation"
 This reverts commit c7966a3.
* redlink-gmbh/smarti#225: Fix widget footer styling
* redlink-gmbh/smarti#220: Improve error handling
* SmartiWidgetBackend: Improve error handling
  • Loading branch information
Peym4n authored and mrsimpson committed May 14, 2018
1 parent 622129d commit ee465b7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
3 changes: 1 addition & 2 deletions packages/assistify-ai/client/public/stylesheets/smarti.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@
}

.smarti #widgetContainer #widgetWrapper #widgetFooter {
position: absolute;
bottom: 0;
position: relative;
background: #f4f4f4;
color: #747474;
opacity: 1;
Expand Down
3 changes: 3 additions & 0 deletions packages/assistify-ai/server/SmartiProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ export class SmartiProxy {
SystemLogger.debug('Got unexpected result from Smarti', method, 'to', url, 'response', JSON.stringify(response));
}
} catch (error) {
SystemLogger.error('Could not complete', method, 'to', url, error.response);
SystemLogger.debug(error);

if (onError) {
const recoveryResult = onError(error);
if (recoveryResult !== undefined) {
Expand Down
8 changes: 7 additions & 1 deletion packages/assistify-ai/server/lib/SmartiAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,16 @@ export class SmartiAdapter {
'content': message.msg,
'user': {
'id': message.u._id
}
},
'metadata': {}
//,"private" : false
};

if (message.origin === 'smartiWidget') {
requestBodyMessage.metadata.skipAnalysis = true;
}

SystemLogger.debug('RocketChatMessage:', message);
SystemLogger.debug('Message:', requestBodyMessage);

let conversationId = SmartiAdapter._getConversationId(message.rid, message);
Expand Down
19 changes: 15 additions & 4 deletions packages/assistify-ai/server/methods/SmartiWidgetBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ Meteor.methods({
}
}
)(verbs.get, `legacy/rocket.chat?channel_id=${ channelId }`, null, (error) => {
// 404 is expected if no mapping exists
if (error.response.statusCode === 404) {
return null;
if (error) {
// 404 is expected if no mapping exists
if (error.response && error.response.statusCode === 404) {
return null;
}
return {errorCode: error.code};
}
});

Expand Down Expand Up @@ -84,7 +87,15 @@ Meteor.methods({
return !RocketChat.authz.hasPermission(userId, 'send-many-messages');
}
}
)(verbs.get, `conversation/${ conversationId }/analysis`);
)(verbs.get, `conversation/${ conversationId }/analysis`, null, (error) => {
if (error) {
// 404 is expected if no mapping exists
if (error.response && error.response.statusCode === 404) {
return null;
}
return {errorCode: error.code};
}
});
},

/**
Expand Down

0 comments on commit ee465b7

Please sign in to comment.