You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Hello! I am your AI assistant! You can ask me for help with the question or any other programming related queries while you are coding.";
63
+
constgreetingMessage={
64
+
id: uuidv4(),
65
+
userId: "assistant",
66
+
text: greeting,
67
+
timestamp: newDate(),
68
+
};
69
+
setAiMessages((prev)=>[...prev,greetingMessage]);
70
+
},[]);
71
+
72
+
useEffect(()=>{
73
+
if(question){
74
+
constcontext=`${question.title}: ${question.description}. Your job is to assist a student who is solving this problem. Provide hints and guide them through the problem solving process if they ask for it. Do not answer irrelevant questions, try to keep the student focussed on the task.`;
75
+
constsystemMessage={
76
+
id: uuidv4(),
77
+
userId: "system",
78
+
text: context,
79
+
timestamp: newDate(),
80
+
};
81
+
setAiMessages((prev)=>[...prev,systemMessage]);
82
+
}
83
+
},[question]);
84
+
85
+
useEffect(()=>{
86
+
if(!auth?.user?.id)return;// Avoid connecting if user is not authenticated
text: `This is the student's current code now: ${code}. Take note of any changes and be prepared to explain, correct or fix any issues in the code if the student asks.`,
0 commit comments