mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 16:43:16 +00:00
Fixed the feedback issue
This commit is contained in:
@@ -111,7 +111,7 @@ export default function Conversation() {
|
||||
const handleFeedback = (query: Query, feedback: FEEDBACK, index: number) => {
|
||||
const prevFeedback = query.feedback;
|
||||
dispatch(updateQuery({ index, query: { feedback } }));
|
||||
handleSendFeedback(query.prompt, query.response!, feedback).catch(() =>
|
||||
handleSendFeedback(query.prompt, query.response!, feedback,conversationId as string,index).catch(() =>
|
||||
dispatch(updateQuery({ index, query: { feedback: prevFeedback } })),
|
||||
);
|
||||
};
|
||||
|
||||
@@ -429,6 +429,11 @@ const ConversationBubble = forwardRef<
|
||||
feedback === 'LIKE' || type !== 'ERROR'
|
||||
? 'group-hover:lg:visible'
|
||||
: ''
|
||||
}
|
||||
${
|
||||
feedback === 'DISLIKE' && type !== 'ERROR'
|
||||
? ' hidden'
|
||||
: ''
|
||||
}`}
|
||||
>
|
||||
<div>
|
||||
@@ -445,11 +450,14 @@ const ConversationBubble = forwardRef<
|
||||
isLikeClicked || feedback === 'LIKE'
|
||||
? 'fill-white-3000 stroke-purple-30 dark:fill-transparent'
|
||||
: 'fill-none stroke-gray-4000'
|
||||
}`}
|
||||
} `}
|
||||
onClick={() => {
|
||||
if(feedback===undefined){
|
||||
console.log("liked")
|
||||
handleFeedback?.('LIKE');
|
||||
setIsLikeClicked(true);
|
||||
setIsDislikeClicked(false);
|
||||
}
|
||||
}}
|
||||
onMouseEnter={() => setIsLikeHovered(true)}
|
||||
onMouseLeave={() => setIsLikeHovered(false)}
|
||||
@@ -462,9 +470,13 @@ const ConversationBubble = forwardRef<
|
||||
!isDislikeClicked ? 'lg:invisible' : ''
|
||||
} ${
|
||||
feedback === 'DISLIKE' || type !== 'ERROR'
|
||||
? 'group-hover:lg:visible'
|
||||
? ' group-hover:lg:visible'
|
||||
: ''
|
||||
}`}
|
||||
} ${
|
||||
feedback === 'LIKE' && type !== 'ERROR'
|
||||
? ' hidden'
|
||||
: ''
|
||||
} `}
|
||||
>
|
||||
<div>
|
||||
<div
|
||||
@@ -481,9 +493,11 @@ const ConversationBubble = forwardRef<
|
||||
: 'fill-none stroke-gray-4000'
|
||||
}`}
|
||||
onClick={() => {
|
||||
if(feedback===undefined){
|
||||
handleFeedback?.('DISLIKE');
|
||||
setIsDislikeClicked(true);
|
||||
setIsLikeClicked(false);
|
||||
}
|
||||
}}
|
||||
onMouseEnter={() => setIsDislikeHovered(true)}
|
||||
onMouseLeave={() => setIsDislikeHovered(false)}
|
||||
|
||||
@@ -202,12 +202,16 @@ export function handleSendFeedback(
|
||||
prompt: string,
|
||||
response: string,
|
||||
feedback: FEEDBACK,
|
||||
conversation_id:string,
|
||||
prompt_index:number
|
||||
) {
|
||||
return conversationService
|
||||
.feedback({
|
||||
question: prompt,
|
||||
answer: response,
|
||||
feedback: feedback,
|
||||
conversation_id:conversation_id,
|
||||
question_index:prompt_index
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
|
||||
Reference in New Issue
Block a user