Files
talk/plugins/talk-plugin-toxic-comments/server/resolvers.js
T
immber 5173af2a27 talk-plugin-toxic-comments - ADD MODEL VARIABLE TO TOXIC COMMENTS (#2178)
* updated readme

* added config var TALK_PERSPECTIVE_MODEL

* fixed duplication on readme

* fixed link on readme

* fix: applied some changes
2019-02-07 00:22:10 +00:00

16 lines
432 B
JavaScript

const get = require('lodash/get');
const { API_MODEL } = require('./config');
module.exports = {
Comment: {
toxicity: comment =>
// Try to get the score from the custom model first, but fall back to the
// TOXICITY score if it isn't provided.
get(
comment,
`metadata.perspective.${API_MODEL}.summaryScore`,
get(comment, 'metadata.perspective.TOXICITY.summaryScore')
),
},
};