@cognigy/rest-api-client
Version:
Cognigy REST-Client
108 lines • 3.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.THINK = void 0;
/* Custom modules */
const createNodeDescriptor_1 = require("../../createNodeDescriptor");
const logFullConfigToDebugMode_1 = require("../../../helper/logFullConfigToDebugMode");
/**
* @deprecated since 4.98.0.
* Use THINK_V2 instead
*/
exports.THINK = (0, createNodeDescriptor_1.createNodeDescriptor)({
type: "think",
defaultLabel: "Think Legacy",
summary: "UI__NODE_EDITOR__THINK__SUMMARY",
appearance: {
showIcon: false,
},
constraints: {
placement: {},
creatable: false,
},
fields: [
{
key: "thinkType",
type: "select",
label: "UI__NODE_EDITOR__THINK__THINK_TYPE__LABEL",
description: "UI__NODE_EDITOR__THINK__THINK_TYPE__DESCRIPTION",
params: {
options: [
{
label: "UI__NODE_EDITOR__THINK__THINK_TYPE__DEFAULT__LABEL",
value: "default",
},
{
label: "UI__NODE_EDITOR__THINK__THINK_TYPE__INTENT__LABEL",
value: "intent",
},
],
},
defaultValue: "default"
},
{
key: "text",
type: "cognigyText",
label: "UI__NODE_EDITOR__THINK__TEXT__LABEL",
description: "UI__NODE_EDITOR__THINK__TEXT__DESCRIPTION",
condition: {
key: "thinkType",
value: "intent",
negate: true
}
},
{
key: "data",
type: "json",
label: "UI__NODE_EDITOR__THINK__DATA__LABEL",
defaultValue: "{}",
condition: {
key: "thinkType",
value: "intent",
negate: true
}
},
{
key: "intent",
type: "cognigyText",
label: "UI__NODE_EDITOR__THINK__INTENT__LABEL",
description: "UI__NODE_EDITOR__THINK__INTENT__DESCRIPTION",
condition: {
key: "thinkType",
value: "intent"
}
},
],
sections: [
{
key: "advanced",
label: "UI__NODE_EDITOR__THINK__ADVANCED__LABEL",
defaultCollapsed: true,
fields: [
"thinkType",
"data"
]
}
],
form: [
{ type: "field", key: "text" },
{ type: "field", key: "intent" },
{ type: "section", key: "advanced" },
],
preview: {
key: "text",
type: "text",
},
tags: ["logic", "recursion", "inject"],
function: async ({ cognigy, config }) => {
const { text, data, intent, thinkType, } = config;
const { api } = cognigy;
(0, logFullConfigToDebugMode_1.logFullConfigToDebugMode)(cognigy, config);
if (thinkType === "intent") {
api.think(`cIntent:${intent}`, null);
}
else if (text || data) {
api.think(text, data);
}
}
});
//# sourceMappingURL=think.js.map