UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

44 lines 1.56 kB
import { agentAssistTranslator } from "../helpers/agentAssistTranslator.helper"; import stylesPartial from "./stylesPartial"; const sentimentAnalysisTemplate = ({ sentiment, fontSize, input, }) => { const mapSentimentToColor = { positive: "bg-positive", negative: "bg-negative", neutral: "bg-neutral", }; let currentSentiment = sentiment === null || sentiment === void 0 ? void 0 : sentiment.toLowerCase(); if (currentSentiment) { Object.keys(mapSentimentToColor).forEach((key) => { if (currentSentiment.includes(key)) { currentSentiment = key; } }); } const translatedSentiment = agentAssistTranslator({ key: currentSentiment, input, }); return ` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Positive Box</title> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css"> <style> ${stylesPartial} </style> </head> <body> <div class="flex h-screen justify-center bg-gray-100 rounded-lg"> <div class="flex flex-1 items-center justify-center overflow-hidden rounded-lg ${mapSentimentToColor[currentSentiment]} shadow-md"> <span class="${fontSize} font-semibold text-white">${translatedSentiment}</span> </div> </div> </body> </html> `; }; export default sentimentAnalysisTemplate; //# sourceMappingURL=sentimentAnalysisTemplate.js.map