Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions course-matrix/backend/src/controllers/aiController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ export const chat = asyncHandler(async (req: Request, res: Response) => {
- If the user provides a course code of length 6 like CSCA08, then assume they mean CSCA08H3 (H3 appended)
- If the user wants to create a timetable, first call getCourses to get course information on the requested courses, then call generateTimetable.
- Do not make up fake courses or offerings.
- You can only edit title of the timetable, nothing else. If a user tries to edit something else, acknowledge this limitation.
- For delete timetable requests, if the user asks to delete an ambiguous timetable name (i.e many with similar name exist) then ask them to clarify which one
- For delete timetable requests, first check that the timetable the user is refering to exists
- For delete timetable requests, ask for user confirmation with command "/timetable confirm" before proceeding. If their next message is anything other than "/timetable confim" then cancel the deletion.
Expand All @@ -273,13 +274,10 @@ export const chat = asyncHandler(async (req: Request, res: Response) => {
},
}),
updateTimetable: tool({
description: "Update a user's timetable by title and/or semester",
description: "Update a user's timetable's title",
parameters: z.object({
id: z.number().positive(),
timetable_title: z.string().optional(),
semester: z
.enum(["Fall 2025", "Summer 2025", "Winter 2026"])
.optional(),
}),
execute: async (args) => {
return await availableFunctions.updateTimetable(args, req);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,13 @@ const TimetableBuilder = () => {
<Form {...form}>
<FormContext.Provider value={form}>
<form
onSubmit={form.handleSubmit(handleGenerate)}
onSubmit={form.handleSubmit(handleGenerate, (errors) => {
console.error("Form submission errors:", errors);
})}
className="space-y-8"
>
<div className="flex gap-8 w-full">
{/* <FormField
<FormField
control={form.control}
name="semester"
render={({ field }) => (
Expand All @@ -382,11 +384,13 @@ const TimetableBuilder = () => {
<FormControl>
<Select
onValueChange={(value) => {
form.reset({ offeringIds: [], courses: [] });
form.setValue("offeringIds", []);
form.setValue("courses", []);
form.setValue("semester", value);
}}
value={field.value}
defaultValue={field.value}
disabled={isEditingTimetable}
>
<SelectTrigger className="w-[140px]">
<SelectValue placeholder="Select a semester" />
Expand All @@ -405,7 +409,7 @@ const TimetableBuilder = () => {
<FormMessage />
</FormItem>
)}
/> */}
/>

<FormField
control={form.control}
Expand Down Expand Up @@ -436,7 +440,7 @@ const TimetableBuilder = () => {
<p className="text-sm">
Selected courses: {selectedCourses.length} (Max 8)
</p>
{!isEditingTimetable && (
{!isEditingTimetable && !isGeneratingTimetables && (
<div className="flex items-center gap-2">
<Checkbox
id="manual-selection"
Expand Down