Skip to content

Commit

Permalink
update AssessCode for better User Experience
Browse files Browse the repository at this point in the history
  • Loading branch information
suryanshkushwaha committed Nov 9, 2024
1 parent 47d6085 commit 987a44d
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ const CollaborationServiceIntegratedView: React.FC = () => {
const editorRef = useRef<any>(null);
const navigate = useNavigate();
const [yText, setYText] = useState<Y.Text | null>(null);
const [commentoutput, setCommentOutput] = useState<string | null>(null);
console.log(commentoutput);
// const [commentoutput, setCommentOutput] = useState<string | null>(null);
// console.log(commentoutput);
//let topic = 'topic';
//let difficulty = 'difficulty';
// Declare question object
Expand Down Expand Up @@ -191,10 +191,12 @@ const CollaborationServiceIntegratedView: React.FC = () => {
try {
if (!yText) {
console.error('Error: Yjs text instance is not available');
setCommentOutput('Error: Yjs text instance is not available');
setOutput('Error: Yjs text instance is not available');
return;
}

setOutput('Waiting for code assessment...');

const currentCode = yText.toString();
const questionInput = "1: Question - " + questionTitle + "\n" + "2: Description" + questionDescription + "\n";
const codeAttempt = "3: Code attempt in - " + syntaxFullLang + "\n" + currentCode;
Expand All @@ -205,7 +207,7 @@ const CollaborationServiceIntegratedView: React.FC = () => {
setOutput(responseContent)
} catch (error) {
console.error('Error executing OpenAI API call:', error);
setCommentOutput('Error executing code');
setOutput('Error executing code');
}
};

Expand Down

0 comments on commit 987a44d

Please sign in to comment.