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.cjs.js
CHANGED
|
@@ -127,6 +127,20 @@ const likeDislikeComment = async (payload) => {
|
|
|
127
127
|
return false;
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
|
+
// Like/Dislike Messages for agent
|
|
131
|
+
const likeDislikeCommentForAgent = async (payload, baseUrl) => {
|
|
132
|
+
try {
|
|
133
|
+
return axiosInstance({
|
|
134
|
+
url: `${baseUrl}/chatbot/agent/analytics/like`,
|
|
135
|
+
data: payload,
|
|
136
|
+
method: "POST",
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
console.error("likeDislikeComment error", error);
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
130
144
|
const fetchIntentApiResponse = async (input = "@apply_filter What is sales discount in cabezon mtd?") => {
|
|
131
145
|
try {
|
|
132
146
|
return axiosInstance({
|
|
@@ -558,7 +572,7 @@ const parseResponse = (data, type, agentId = "", currentMode = "", disableTimeAn
|
|
|
558
572
|
* @param {object} templateData
|
|
559
573
|
* @returns
|
|
560
574
|
*/
|
|
561
|
-
const handleMessageLike = async (question, liked, setLoadingState, displaySnackMessages, templateData, activeConversationId, answer, chatDataInfoRef, chatIndex, setChatDataState) => {
|
|
575
|
+
const handleMessageLike = async (question, liked, setLoadingState, displaySnackMessages, templateData, activeConversationId, answer, chatDataInfoRef, chatIndex, setChatDataState, baseUrl, sessionId) => {
|
|
562
576
|
let answerData;
|
|
563
577
|
let questionData;
|
|
564
578
|
answer?.forEach((item) => {
|
|
@@ -583,7 +597,17 @@ const handleMessageLike = async (question, liked, setLoadingState, displaySnackM
|
|
|
583
597
|
const activeMessage = chatDataInfoRef?.[currentMode]?.conversations?.[1]?.messages?.[chatIndex];
|
|
584
598
|
// const activeMessage = chats?.[currentMode].conversations[activeConversationId].messages[activeMessageIndex];
|
|
585
599
|
try {
|
|
586
|
-
|
|
600
|
+
let request;
|
|
601
|
+
if (currentMode === "agent") {
|
|
602
|
+
const agentPayload = {
|
|
603
|
+
session_id: sessionId,
|
|
604
|
+
liked,
|
|
605
|
+
};
|
|
606
|
+
request = await likeDislikeCommentForAgent(agentPayload, baseUrl);
|
|
607
|
+
}
|
|
608
|
+
else {
|
|
609
|
+
request = await likeDislikeComment(payload);
|
|
610
|
+
}
|
|
587
611
|
if (request?.status) {
|
|
588
612
|
let updatedMessage = {
|
|
589
613
|
...activeMessage,
|
|
@@ -9976,8 +10000,8 @@ const SmartBot = (props) => {
|
|
|
9976
10000
|
...loadingState,
|
|
9977
10001
|
[isLike ? "like" : "dislike"]: key,
|
|
9978
10002
|
});
|
|
9979
|
-
handleMessageLike(key, isLike, setLoadingState, displaySnackMessages, templateData, activeConversationId, answer, chatDataInfoRef.current, chatIndex, setChatDataState);
|
|
9980
|
-
}, 5000, { trailing: false }), [loadingState, templateData, displaySnackMessages]);
|
|
10003
|
+
handleMessageLike(key, isLike, setLoadingState, displaySnackMessages, templateData, activeConversationId, answer, chatDataInfoRef.current, chatIndex, setChatDataState, baseUrl, sessionId);
|
|
10004
|
+
}, 5000, { trailing: false }), [loadingState, templateData, displaySnackMessages, sessionId, baseUrl]);
|
|
9981
10005
|
React.useEffect(() => {
|
|
9982
10006
|
handleUploadAccess();
|
|
9983
10007
|
}, []);
|