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
// Return a short, 3-8 word title for the provided plan text
34
-
constplanText=context||"";
35
-
prompt=`Generate a concise, human-friendly title (3-8 words) for the following study plan or description:\n\n${planText}\n\nOnly output the title on a single line. Do not include any extra commentary.`+userPromptNote;
36
-
systemInstruction=`You are an assistant that creates short titles for study plans. Return only a single short title.`;
37
-
}else{
38
-
// Default: full study plan generation
39
-
prompt=`Create a detailed, actionable study plan for this student using the following context:\n${context||"No additional context provided."}${userPromptNote}\n\nProduce a structured plan with 3-6 recommended study sessions/tasks. For each item include:\n- A short title\n- An estimated duration (in minutes)\n- Priority (high/medium/low)\n- A one-sentence justification\n- Concrete next steps or exercises to do during the session\n\nOutput the plan in Markdown, with clear headings and bullet points.`;
40
-
systemInstruction=`You are EduBox Study Planner. Produce a helpful, step-by-step study plan aimed at a college student. Favor slightly longer, concrete recommendations with next-step actions and example exercises.`;
// Derive authenticated userId from Clerk for any persistence. We still allow
22
+
// unauthenticated requests to stream content, but persistence requires auth.
23
+
const{ userId }=awaitauth();
24
+
25
+
// Build prompt + system instruction depending on requested contentType
26
+
constcontentType=options?.contentType;
27
+
constuserPromptNote=options?.userPrompt
28
+
? `\n\nUser request: ${options.userPrompt}`
29
+
: "";
30
+
31
+
letprompt: string;
32
+
letsystemInstruction: string;
33
+
34
+
if(contentType==="study_plan_title"){
35
+
// Return a short, 3-8 word title for the provided plan text
36
+
constplanText=context||"";
37
+
prompt=
38
+
`Generate a concise, human-friendly title (3-8 words) for the following study plan or description:\n\n${planText}\n\nOnly output the title on a single line. Do not include any extra commentary.`+
39
+
userPromptNote;
40
+
systemInstruction=`You are an assistant that creates short titles for study plans. Return only a single short title.`;
41
+
}else{
42
+
// Default: full study plan generation
43
+
prompt=`Create a detailed, actionable study plan for this student using the following context:\n${
44
+
context||"No additional context provided."
45
+
}${userPromptNote}\n\nProduce a structured plan with 3-6 recommended study sessions/tasks. For each item include:\n- A short title\n- An estimated duration (in minutes)\n- Priority (high/medium/low)\n- A one-sentence justification\n- Concrete next steps or exercises to do during the session\n\nOutput the plan in Markdown, with clear headings and bullet points.`;
46
+
systemInstruction=`You are EduBox Study Planner. Produce a helpful, step-by-step study plan aimed at a college student. Favor slightly longer, concrete recommendations with next-step actions and example exercises.`;
0 commit comments