Skip to content

Commit ef9771b

Browse files
minhhaitran08github-actions[bot]
authored andcommitted
Auto-formatted the code using Prettier
1 parent eca6fc9 commit ef9771b

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

course-matrix/backend/src/controllers/aiController.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const pinecone = new Pinecone({
3131
});
3232

3333
const index: Index<RecordMetadata> = pinecone.Index(
34-
process.env.PINECONE_INDEX_NAME!
34+
process.env.PINECONE_INDEX_NAME!,
3535
);
3636

3737
console.log("Connected to OpenAI API");
@@ -88,7 +88,7 @@ function analyzeQuery(query: string): {
8888
"prerequisites",
8989
"corequisites",
9090
"departments",
91-
"programs"
91+
"programs",
9292
);
9393
}
9494

@@ -105,7 +105,7 @@ function analyzeQuery(query: string): {
105105
async function searchSelectedNamespaces(
106106
query: string,
107107
k: number,
108-
namespaces: string[]
108+
namespaces: string[],
109109
): Promise<Document[]> {
110110
let allResults: Document[] = [];
111111

@@ -126,7 +126,7 @@ async function searchSelectedNamespaces(
126126
// Search results count given by the min result count for a given namespace (or k if k is greater)
127127
const results = await namespaceStore.similaritySearch(
128128
query,
129-
Math.max(k, namespaceToMinResults.get(namespace))
129+
Math.max(k, namespaceToMinResults.get(namespace)),
130130
);
131131
console.log(`Found ${results.length} results in namespace: ${namespace}`);
132132
allResults = [...allResults, ...results];
@@ -147,7 +147,7 @@ async function searchSelectedNamespaces(
147147
// Reformulate user query to make more concise query to database, taking into consideration context
148148
async function reformulateQuery(
149149
latestQuery: string,
150-
conversationHistory: any[]
150+
conversationHistory: any[],
151151
): Promise<string> {
152152
try {
153153
const openai = new OpenAI({
@@ -240,7 +240,7 @@ export const chat = asyncHandler(async (req: Request, res: Response) => {
240240
// Use GPT-4o to reformulate the query based on conversation history
241241
const reformulatedQuery = await reformulateQuery(
242242
latestMessage,
243-
conversationHistory.slice(-CHATBOT_MEMORY_THRESHOLD) // last K messages
243+
conversationHistory.slice(-CHATBOT_MEMORY_THRESHOLD), // last K messages
244244
);
245245
console.log(">>>> Original query:", latestMessage);
246246
console.log(">>>> Reformulated query:", reformulatedQuery);
@@ -254,15 +254,15 @@ export const chat = asyncHandler(async (req: Request, res: Response) => {
254254
if (requiresSearch) {
255255
console.log(
256256
`Query requires knowledge retrieval, searching namespaces: ${relevantNamespaces.join(
257-
", "
258-
)}`
257+
", ",
258+
)}`,
259259
);
260260

261261
// Search only relevant namespaces
262262
const searchResults = await searchSelectedNamespaces(
263263
reformulatedQuery,
264264
3,
265-
relevantNamespaces
265+
relevantNamespaces,
266266
);
267267
// console.log("Search Results: ", searchResults);
268268

@@ -330,15 +330,15 @@ export const testSimilaritySearch = asyncHandler(
330330
if (requiresSearch) {
331331
console.log(
332332
`Query requires knowledge retrieval, searching namespaces: ${relevantNamespaces.join(
333-
", "
334-
)}`
333+
", ",
334+
)}`,
335335
);
336336

337337
// Search only the relevant namespaces
338338
const searchResults = await searchSelectedNamespaces(
339339
message,
340340
3,
341-
relevantNamespaces
341+
relevantNamespaces,
342342
);
343343
console.log("Search Results: ", searchResults);
344344

@@ -348,11 +348,11 @@ export const testSimilaritySearch = asyncHandler(
348348
}
349349
} else {
350350
console.log(
351-
"Query does not require knowledge retrieval, skipping search"
351+
"Query does not require knowledge retrieval, skipping search",
352352
);
353353
}
354354

355355
console.log("CONTEXT: ", context);
356356
res.status(200).send(context);
357-
}
357+
},
358358
);

course-matrix/backend/src/utils/embeddings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ async function processPDF(filePath: string, namespace: string) {
7171
// console.log("Sample split docs: ", splitDocs.slice(0, 6))
7272

7373
console.log(
74-
`Split into ${splitDocs.length} sections by "Calendar Section:" delimiter`
74+
`Split into ${splitDocs.length} sections by "Calendar Section:" delimiter`,
7575
);
7676

7777
// Store the split documents as embeddings

course-matrix/frontend/src/pages/TimetableBuilder/TimetableBuilder.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const TimetableBuilder = () => {
120120
});
121121

122122
const { data: eventsData, isLoading: eventsLoading } = useGetEventsQuery(
123-
timetableId
123+
timetableId,
124124
) as {
125125
data: { courseEvents: unknown[]; userEvents: unknown[] };
126126
isLoading: boolean;
@@ -254,7 +254,7 @@ const TimetableBuilder = () => {
254254
<SelectItem key={value} value={value}>
255255
{value}
256256
</SelectItem>
257-
)
257+
),
258258
)}
259259
</SelectContent>
260260
</Select>

0 commit comments

Comments
 (0)