Name
sn_nlu_workbench.NLUConflictResult
Description
Utility to parse the conflict result
Script
var NLUConflictResult = Class.create();
(function() {
var tableName = NLUWorkbenchConstants.tables.NLU_CONFLICT_RESULT;
var isReadOnly = function(utterance, scope) {
if (utterance.intent.model.sys_policy === 'read')
return true;
return utterance.intent.model.sys_scope.toString() !== scope;
};
var getUtteranceData = function(gr, index, scope) {
return {
id: gr.getValue('utterance_' + index),
text: gr.getDisplayValue('utterance_' + index),
original: gr.getValue('original_utterance_' + index),
readOnly: isReadOnly(gr['utterance_' + index], scope)
};
};
NLUConflictResult.getResults = function(query, scope) {
var results = {
high: [],
critical: []
};
var gr = new GlideRecord(tableName);
gr.addEncodedQuery(query);
gr.query();
while (gr.next()) {
results[gr.getValue('tag')].push({
sysId: gr.getUniqueValue(),
ignored: gr.getValue('ignored') === '1',
intent1: {
id: gr.getValue('intent_1'),
name: gr.getDisplayValue('intent_1')
},
intent2: {
id: gr.getValue('intent_2'),
name: gr.getDisplayValue('intent_2')
},
utterance1: getUtteranceData(gr, 1, scope),
utterance2: getUtteranceData(gr, 2, scope),
});
}
return results;
};
NLUConflictResult.prototype = {
initialize: function() {},
type: 'NLUConflictResult'
};
})();
Sys ID
fc28dc5507da301028ef0a701ad3001b