diff --git a/apps/nextjs/src/components/AppComponents/QuizDesigner/QuizContent.tsx b/apps/nextjs/src/components/AppComponents/QuizDesigner/QuizContent.tsx index 23a5ef2bc..ec2da0e8e 100644 --- a/apps/nextjs/src/components/AppComponents/QuizDesigner/QuizContent.tsx +++ b/apps/nextjs/src/components/AppComponents/QuizDesigner/QuizContent.tsx @@ -41,7 +41,7 @@ const QuizContent = ({ potentialNewQuestions, isLoading: suggestedQuestionsLoading, hasError: suggestedQuestionsHasError, - setPotentialNewQuestion, + setPotentialNewQuestions, } = useSuggestedQuestions({ state, dispatch, @@ -85,7 +85,7 @@ const QuizContent = ({ potentialNewQuestions={potentialNewQuestions} dispatch={dispatch} suggestedQuestionsGeneration={suggestedQuestionsGeneration} - setPotentialNewQuestions={setPotentialNewQuestion} + setPotentialNewQuestions={setPotentialNewQuestions} questionsWrapperRef={questionsWrapperRef} questionRefs={questionRefs} /> diff --git a/apps/nextjs/src/components/AppComponents/QuizDesigner/QuizDesignerPageContent.tsx b/apps/nextjs/src/components/AppComponents/QuizDesigner/QuizDesignerPageContent.tsx index ff0ab3fd5..d6ce17e6c 100644 --- a/apps/nextjs/src/components/AppComponents/QuizDesigner/QuizDesignerPageContent.tsx +++ b/apps/nextjs/src/components/AppComponents/QuizDesigner/QuizDesignerPageContent.tsx @@ -47,7 +47,7 @@ const QuizDesignerPageContent = ({ potentialNewQuestions, isLoading: suggestedQuestionsLoading, hasError: suggestedQuestionsHasError, - setPotentialNewQuestion, + setPotentialNewQuestions, } = useSuggestedQuestions({ state, dispatch, @@ -101,7 +101,7 @@ const QuizDesignerPageContent = ({ suggestedQuestionsHasError={suggestedQuestionsHasError} potentialNewQuestions={potentialNewQuestions} dispatch={dispatch} - setPotentialNewQuestions={setPotentialNewQuestion} + setPotentialNewQuestions={setPotentialNewQuestions} suggestedQuestionsGeneration={suggestedQuestionsGeneration} questionRefs={questionRefs} questionsWrapperRef={questionsWrapperRef} diff --git a/apps/nextjs/src/hooks/useSuggestedQuestions.ts b/apps/nextjs/src/hooks/useSuggestedQuestions.ts index 4a2c8f192..b7c4a6414 100644 --- a/apps/nextjs/src/hooks/useSuggestedQuestions.ts +++ b/apps/nextjs/src/hooks/useSuggestedQuestions.ts @@ -31,7 +31,7 @@ const useSuggestedQuestions = ({ state, dispatch, }: UseSuggestedQuestionsProps) => { - const [potentialNewQuestions, setPotentialNewQuestion] = + const [potentialNewQuestions, setPotentialNewQuestions] = useState([]); useEffect(() => { @@ -39,7 +39,7 @@ const useSuggestedQuestions = ({ state.status === QuizAppStatus.EditingSubjectAndKS || state.status === QuizAppStatus.Initial ) { - setPotentialNewQuestion([]); + setPotentialNewQuestions([]); } }, [state]); @@ -60,7 +60,7 @@ const useSuggestedQuestions = ({ }); }, onSuccess: ({ data }) => { - setPotentialNewQuestion(data.response); + setPotentialNewQuestions(data.response); }, }, ); @@ -107,7 +107,7 @@ const useSuggestedQuestions = ({ hasError, potentialNewQuestions, medianTimeTakenForPrompt, - setPotentialNewQuestion, + setPotentialNewQuestions, }; }; diff --git a/apps/nextjs/src/hooks/useTemporaryLessonPlanWithStreamingEdits.ts b/apps/nextjs/src/hooks/useTemporaryLessonPlanWithStreamingEdits.ts index ec963f1a3..d0e355649 100644 --- a/apps/nextjs/src/hooks/useTemporaryLessonPlanWithStreamingEdits.ts +++ b/apps/nextjs/src/hooks/useTemporaryLessonPlanWithStreamingEdits.ts @@ -106,7 +106,7 @@ export const useTemporaryLessonPlanWithStreamingEdits = ({ // ); return useMemo(() => { - if (!throttledAssistantMessages || !throttledAssistantMessages.length) { + if (!throttledAssistantMessages?.length) { return { tempLessonPlan: tempLessonPlanRef.current, partialPatches: [], diff --git a/apps/nextjs/src/lib/hooks/use-copy-to-clipboard.tsx b/apps/nextjs/src/lib/hooks/use-copy-to-clipboard.tsx index ff9f9af67..59f5bdedc 100644 --- a/apps/nextjs/src/lib/hooks/use-copy-to-clipboard.tsx +++ b/apps/nextjs/src/lib/hooks/use-copy-to-clipboard.tsx @@ -2,13 +2,13 @@ import * as React from "react"; -interface useCopyToClipboardProps { +interface UseCopyToClipboardProps { timeout?: number; } export function useCopyToClipboard({ timeout = 2000, -}: useCopyToClipboardProps) { +}: UseCopyToClipboardProps) { const [isCopied, setIsCopied] = React.useState(false); const copyToClipboard = (value: string) => { @@ -20,7 +20,7 @@ export function useCopyToClipboard({ return; } - navigator.clipboard.writeText(value).then(() => { + void navigator.clipboard.writeText(value).then(() => { setIsCopied(true); setTimeout(() => { diff --git a/apps/nextjs/tests-e2e/tests/aila-chat/helpers.ts b/apps/nextjs/tests-e2e/tests/aila-chat/helpers.ts index 63a1ba0f2..ee8d9b39c 100644 --- a/apps/nextjs/tests-e2e/tests/aila-chat/helpers.ts +++ b/apps/nextjs/tests-e2e/tests/aila-chat/helpers.ts @@ -67,7 +67,7 @@ export async function getSectionsComplete(page: Page): Promise { const progressText = await page.getByTestId("chat-progress").textContent(); const match = (progressText ?? "").match(/(\d+) of 10 sections complete/); - if (match && match[1]) { + if (match?.[1]) { return parseInt(match[1], 10); } else { return 0; diff --git a/packages/api/src/router/testSupport/prepareUser.ts b/packages/api/src/router/testSupport/prepareUser.ts index edeedde1a..4059173a5 100644 --- a/packages/api/src/router/testSupport/prepareUser.ts +++ b/packages/api/src/router/testSupport/prepareUser.ts @@ -120,7 +120,7 @@ const deleteOldTestUser = async () => { return; } - const users = testUsers.sort( + const users = testUsers.toSorted( (a, b) => new Date(a.lastActiveAt ?? a.createdAt).getTime() - new Date(b.lastActiveAt ?? b.createdAt).getTime(), @@ -143,7 +143,7 @@ const deleteOldTestUser = async () => { log.info( `${userToDelete.primaryEmailAddress?.emailAddress} already deleted, retrying`, ); - deleteOldTestUser(); + await deleteOldTestUser(); } else { throw e; } diff --git a/packages/core/src/models/lessonPlans.ts b/packages/core/src/models/lessonPlans.ts index c71e02efd..4fe742539 100644 --- a/packages/core/src/models/lessonPlans.ts +++ b/packages/core/src/models/lessonPlans.ts @@ -137,9 +137,7 @@ export class LessonPlans { lessonPlanJsonSchema: JSON.stringify(LessonPlanJsonSchema), llmResponseJsonSchema: JSON.stringify(LLMResponseJsonSchema), isUsingStructuredOutput: - process.env.NEXT_PUBLIC_STRUCTURED_OUTPUTS_ENABLED === "true" - ? true - : false, + process.env.NEXT_PUBLIC_STRUCTURED_OUTPUTS_ENABLED === "true", }); const systemPrompt = compiledTemplate; diff --git a/packages/core/src/models/lessons.ts b/packages/core/src/models/lessons.ts index c826b26ea..87c86c779 100644 --- a/packages/core/src/models/lessons.ts +++ b/packages/core/src/models/lessons.ts @@ -305,7 +305,7 @@ export class Lessons { lessonId, quizQuestionId, }: { - question: { answer?: string | string[] | null | undefined }; + question: { answer?: string | string[] | null }; answer: string; lessonId: string; quizQuestionId: string; diff --git a/packages/core/src/prompts/lesson-assistant/variants.ts b/packages/core/src/prompts/lesson-assistant/variants.ts index beb06c26b..9db309cf5 100644 --- a/packages/core/src/prompts/lesson-assistant/variants.ts +++ b/packages/core/src/prompts/lesson-assistant/variants.ts @@ -1,6 +1,6 @@ import z from "zod"; -import type { TemplateProps} from "."; +import type { TemplateProps } from "."; import { getPromptParts } from "."; import type { OakPromptDefinition, OakPromptVariant } from "../types"; @@ -59,9 +59,7 @@ export const generateVariants = (): OakPromptVariant[] => { llmResponseJsonSchema: "", lessonPlan: {}, isUsingStructuredOutput: - process.env.NEXT_PUBLIC_STRUCTURED_OUTPUTS_ENABLED === "true" - ? true - : false, + process.env.NEXT_PUBLIC_STRUCTURED_OUTPUTS_ENABLED === "true", }, slug, ); diff --git a/packages/ingest/src/embedding/handleEmbeddingBatchSuccess.ts b/packages/ingest/src/embedding/handleEmbeddingBatchSuccess.ts index 14a4b1246..3f32818ed 100644 --- a/packages/ingest/src/embedding/handleEmbeddingBatchSuccess.ts +++ b/packages/ingest/src/embedding/handleEmbeddingBatchSuccess.ts @@ -72,6 +72,9 @@ export async function handleEmbeddingBatchSuccess({ continue; } + if (errors.length > 0) { + log.info(`Errors: ${errors.length}`); + } lessonIdsCompleted.add(lessonId); }