UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

124 lines 4.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GET_TRANSCRIPT = void 0; /* Custom modules */ const createNodeDescriptor_1 = require("../../createNodeDescriptor"); const transcripts_1 = require("../../../interfaces/transcripts/transcripts"); /** * Node name: 'getTranscript' * * Purpose: * Get the transcript of the current session * @param mode the mode in which the transcript should be read * @param limit the number of entries to read */ exports.GET_TRANSCRIPT = (0, createNodeDescriptor_1.createNodeDescriptor)({ type: "getTranscript", defaultLabel: "Get Transcript", summary: "UI__NODE_EDITOR__GET_TRANSCRIPT__SUMMARY", appearance: { showIcon: false }, fields: [ { key: "limit", type: "slider", label: "UI__NODE_EDITOR__GET_TRANSCRIPT__FIELDS__LIMIT__LABEL", description: "UI__NODE_EDITOR__GET_TRANSCRIPT__FIELDS__LIMIT__DESCRIPTION", defaultValue: 25, params: { min: 0, max: 50, step: 1, }, }, { key: "storeLocation", type: "select", label: "UI__NODE_EDITOR__GET_TRANSCRIPT__FIELDS__STORE_LOCATION__LABEL", params: { options: [ { label: "UI__NODE_EDITOR__GET_TRANSCRIPT__FIELDS__STORE_LOCATION__OPTIONS__INPUT", value: "input" }, { label: "UI__NODE_EDITOR__GET_TRANSCRIPT__FIELDS__STORE_LOCATION__OPTIONS__CONTEXT", value: "context" } ], }, defaultValue: "input" }, { key: "inputKey", type: "cognigyText", label: "UI__NODE_EDITOR__GET_TRANSCRIPT__FIELDS__INPUT_KEY__LABEL", defaultValue: "transcript", condition: { key: "storeLocation", value: "input", } }, { key: "contextKey", type: "cognigyText", label: "UI__NODE_EDITOR__GET_TRANSCRIPT__FIELDS__CONTEXT_KEY__LABEL", defaultValue: "transcript", condition: { key: "storeLocation", value: "context", } }, { key: "includeTextAlternativeInTranscript", type: "toggle", label: "UI__NODE_EDITOR__GET_TRANSCRIPT__FIELDS__INCLUDE_TEXT_ALTERNATIVE_IN_TRANSCRIPT__LABEL", description: "UI__NODE_EDITOR__GET_TRANSCRIPT__FIELDS__INCLUDE_TEXT_ALTERNATIVE_IN_TRANSCRIPT__DESCRIPTION", defaultValue: true, }, ], sections: [ { key: "storage", label: "UI__NODE_EDITOR__GET_TRANSCRIPT__FIELDS__STORAGE__LABEL", defaultCollapsed: true, fields: [ "storeLocation", "inputKey", "contextKey", ] }, { key: "advanced", label: "UI__NODE_EDITOR__SERVICE__AI_AGENT_JOB__SECTIONS__ADVANCED__LABEL", defaultCollapsed: true, fields: [ "includeTextAlternativeInTranscript", ], }, ], form: [ { type: "field", key: "limit" }, { type: "section", key: "storage" }, { type: "section", key: "advanced" }, ], tags: ["service", "transcripts"], function: async ({ cognigy, config }) => { var _a; const { limit, storeLocation, inputKey, contextKey, includeTextAlternativeInTranscript } = config; const { api } = cognigy; const transcript = await api.getTranscript({ limit, excludeDataOnlyMessagesFilter: [transcripts_1.TranscriptRole.AGENT], includeTextAlternativeInTranscript, }); if (storeLocation === "context") { (_a = api.addToContext) === null || _a === void 0 ? void 0 : _a.call(api, contextKey, transcript, "simple"); } else { api.addToInput(inputKey, transcript); } } }); //# sourceMappingURL=getTranscript.js.map