diff --git a/src/app/new-project/sampleQue.js b/src/app/new-project/sampleQue.js index a011b43..820e94d 100644 --- a/src/app/new-project/sampleQue.js +++ b/src/app/new-project/sampleQue.js @@ -1,6 +1,6 @@ const sampleQuestion = [ { "question_type": "fill_in_blanks", "input_question": "This model output contains grammatical errors." }, - { "question_type": "rating", "input_question": "Rate this sentence on a scale of 1 to 10 based on grammatical errors, 1 being lowest and 5 being highest rating.", "rating_scale_list": [1,2,3,4,5]}, + { "question_type": "rating", "input_question": "Rate this sentence on a scale of 1 to 5 based on grammatical errors, 1 being lowest and 5 being highest rating.", "rating_scale_list": [1,2,3,4,5]}, { "question_type": "multi_select_options", "input_question": "Which of the following improvements might make the model's output better?", "input_selections_list": ["Answer by the model should be more factual and contain a detailed information.", "The answer could have been rephrased to make it more presentable.", "Avoiding silly mistakes would do wonders to this answer", "None of the above."]}, { "question_type": "mcq", "input_question": "Is the answer given by the model satisfactory on the basis of data collection guidelines shared by your team lead?", "input_selections_list": ["Yes, it can be accepted without any changes.", "Yes, but need minor improvements.", "No, there are some major improvements required.", "No, the model is completely hallucinating"]} ] diff --git a/src/app/ui/pages/chat/AllTaskPage.jsx b/src/app/ui/pages/chat/AllTaskPage.jsx index d866d7e..90368d0 100644 --- a/src/app/ui/pages/chat/AllTaskPage.jsx +++ b/src/app/ui/pages/chat/AllTaskPage.jsx @@ -158,8 +158,11 @@ const AllTaskPage = () => { }, [taskData]); useEffect(() => { if (AnnotationsTaskDetails?.length > 0) { - setLoading(false); setAnnotations(AnnotationsTaskDetails); + setLoading(false); + + + } }, [AnnotationsTaskDetails]); @@ -432,57 +435,6 @@ console.log(annotations); componentToRender = null; break; } - useEffect(() => { - if (AnnotationsTaskDetails?.length > 0) { - setLoading(false); - } - }, [AnnotationsTaskDetails]); - - // const formatResponseformatResponse = (response) => { - // response = String(response); - // const output = []; - // let count = 0; - - // while (response) { - // response = response.trim(); - // let index = response.indexOf("```"); - // if (index == -1) { - // output.push({ - // type: "text", - // value: response, - // }); - // break; - // } else { - // count++; - // if (count % 2 !== 0) { - // output.push({ - // type: "text", - // value: response.substring(0, index), - // }); - // response = response.slice(index + 3); - // } else if (count % 2 === 0) { - // let next_space = response.indexOf("\n"); - // let language = response.substring(0, next_space); - // response = response.slice(next_space + 1); - // let new_index = response.indexOf("```"); - // let value = response.substring(0, new_index); - // output.push({ - // type: "code", - // value: value, - // language: language, - // }); - // response = response.slice(new_index + 3); - // } - // } - // } - // return output; - // }; - - // const formatPrompt = (prompt) => { - // const lines = prompt.split("\n"); - // const markdownString = lines.join(" \n"); - // return markdownString; - // }; return ( <> @@ -560,29 +512,7 @@ console.log(annotations); readOnly={true} > - -
- {/* */} -
+ { if (forms?.length > 0 && interactions?.length > 0) { - const defaultFormId = 1; + const defaultFormId = forms[0]?.prompt_output_pair_id; const currentForm = forms.find( (form) => form?.prompt_output_pair_id === defaultFormId ); diff --git a/src/app/ui/pages/n-screen-preference-ranking/PreferenceRanking.jsx b/src/app/ui/pages/n-screen-preference-ranking/PreferenceRanking.jsx index 69dab69..d8279fc 100644 --- a/src/app/ui/pages/n-screen-preference-ranking/PreferenceRanking.jsx +++ b/src/app/ui/pages/n-screen-preference-ranking/PreferenceRanking.jsx @@ -176,17 +176,18 @@ const PreferenceRanking = ({ console.log("jack", "3"); } - }, [forms, interactions]); + }, [forms, interactions, setForms, questions]); useEffect(() => { - + console.log(forms,interactions,"checking"); + if (forms?.length > 0 && interactions?.length > 0) { - const defaultFormId = 1; + const defaultFormId = forms[0]?.prompt_output_pair_id; const currentForm = forms?.find( (form) => form?.prompt_output_pair_id == defaultFormId, ); - console.log(forms, currentForm); + console.log("forms", currentForm); if (currentForm) { console.log("current form: " + JSON.stringify(currentForm)); @@ -221,7 +222,7 @@ const PreferenceRanking = ({ } console.log("jack", "4"); - }, [forms, interactions, questions?.length]); + }, [forms, interactions, setCurrentInteraction, questions?.length]); useEffect(() => { if (!forms || forms.length === 0) { setAnswered(false);