impact-chatbot 2.3.16 → 2.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +28 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +28 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/services/chatbot-services.d.ts +1 -0
- package/dist/utlis.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -105,6 +105,20 @@ const likeDislikeComment = async (payload) => {
|
|
|
105
105
|
return false;
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
|
+
// Like/Dislike Messages for agent
|
|
109
|
+
const likeDislikeCommentForAgent = async (payload, baseUrl) => {
|
|
110
|
+
try {
|
|
111
|
+
return axiosInstance({
|
|
112
|
+
url: `${baseUrl}/chatbot/agent/analytics/like`,
|
|
113
|
+
data: payload,
|
|
114
|
+
method: "POST",
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
console.error("likeDislikeComment error", error);
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
108
122
|
const fetchIntentApiResponse = async (input = "@apply_filter What is sales discount in cabezon mtd?") => {
|
|
109
123
|
try {
|
|
110
124
|
return axiosInstance({
|
|
@@ -536,7 +550,7 @@ const parseResponse = (data, type, agentId = "", currentMode = "", disableTimeAn
|
|
|
536
550
|
* @param {object} templateData
|
|
537
551
|
* @returns
|
|
538
552
|
*/
|
|
539
|
-
const handleMessageLike = async (question, liked, setLoadingState, displaySnackMessages, templateData, activeConversationId, answer, chatDataInfoRef, chatIndex, setChatDataState) => {
|
|
553
|
+
const handleMessageLike = async (question, liked, setLoadingState, displaySnackMessages, templateData, activeConversationId, answer, chatDataInfoRef, chatIndex, setChatDataState, baseUrl, sessionId) => {
|
|
540
554
|
let answerData;
|
|
541
555
|
let questionData;
|
|
542
556
|
answer?.forEach((item) => {
|
|
@@ -561,7 +575,17 @@ const handleMessageLike = async (question, liked, setLoadingState, displaySnackM
|
|
|
561
575
|
const activeMessage = chatDataInfoRef?.[currentMode]?.conversations?.[1]?.messages?.[chatIndex];
|
|
562
576
|
// const activeMessage = chats?.[currentMode].conversations[activeConversationId].messages[activeMessageIndex];
|
|
563
577
|
try {
|
|
564
|
-
|
|
578
|
+
let request;
|
|
579
|
+
if (currentMode === "agent") {
|
|
580
|
+
const agentPayload = {
|
|
581
|
+
session_id: sessionId,
|
|
582
|
+
liked,
|
|
583
|
+
};
|
|
584
|
+
request = await likeDislikeCommentForAgent(agentPayload, baseUrl);
|
|
585
|
+
}
|
|
586
|
+
else {
|
|
587
|
+
request = await likeDislikeComment(payload);
|
|
588
|
+
}
|
|
565
589
|
if (request?.status) {
|
|
566
590
|
let updatedMessage = {
|
|
567
591
|
...activeMessage,
|
|
@@ -9954,8 +9978,8 @@ const SmartBot = (props) => {
|
|
|
9954
9978
|
...loadingState,
|
|
9955
9979
|
[isLike ? "like" : "dislike"]: key,
|
|
9956
9980
|
});
|
|
9957
|
-
handleMessageLike(key, isLike, setLoadingState, displaySnackMessages, templateData, activeConversationId, answer, chatDataInfoRef.current, chatIndex, setChatDataState);
|
|
9958
|
-
}, 5000, { trailing: false }), [loadingState, templateData, displaySnackMessages]);
|
|
9981
|
+
handleMessageLike(key, isLike, setLoadingState, displaySnackMessages, templateData, activeConversationId, answer, chatDataInfoRef.current, chatIndex, setChatDataState, baseUrl, sessionId);
|
|
9982
|
+
}, 5000, { trailing: false }), [loadingState, templateData, displaySnackMessages, sessionId, baseUrl]);
|
|
9959
9983
|
useEffect(() => {
|
|
9960
9984
|
handleUploadAccess();
|
|
9961
9985
|
}, []);
|