From 653778b13d5b01d3daaaee69992386a534ac3096 Mon Sep 17 00:00:00 2001 From: Arik Chakma Date: Wed, 9 Apr 2025 21:14:16 +0600 Subject: [PATCH] wip --- .../GenerateCourse/AICourseContent.tsx | 4 +++ .../GenerateCourse/AICourseLesson.tsx | 32 +++++++++++++------ .../GenerateCourse/ModifyCoursePrompt.tsx | 17 ++++++---- .../GenerateCourse/RegenerateLesson.tsx | 22 +++++++++++-- 4 files changed, 57 insertions(+), 18 deletions(-) diff --git a/src/components/GenerateCourse/AICourseContent.tsx b/src/components/GenerateCourse/AICourseContent.tsx index 6dc8aeec6..e2abc32dc 100644 --- a/src/components/GenerateCourse/AICourseContent.tsx +++ b/src/components/GenerateCourse/AICourseContent.tsx @@ -472,6 +472,10 @@ export function AICourseContent(props: AICourseContentProps) { onUpgrade={() => setShowUpgradeModal(true)} isAIChatsOpen={isAIChatsOpen} setIsAIChatsOpen={setIsAIChatsOpen} + isForkable={isForkable} + onForkCourse={() => { + setIsForkingCourse(true); + }} /> )} diff --git a/src/components/GenerateCourse/AICourseLesson.tsx b/src/components/GenerateCourse/AICourseLesson.tsx index 3264c729d..3a10b5680 100644 --- a/src/components/GenerateCourse/AICourseLesson.tsx +++ b/src/components/GenerateCourse/AICourseLesson.tsx @@ -70,6 +70,9 @@ type AICourseLessonProps = { isAIChatsOpen: boolean; setIsAIChatsOpen: (isOpen: boolean) => void; + + isForkable: boolean; + onForkCourse: () => void; }; export function AICourseLesson(props: AICourseLessonProps) { @@ -91,6 +94,9 @@ export function AICourseLesson(props: AICourseLessonProps) { isAIChatsOpen, setIsAIChatsOpen, + + isForkable, + onForkCourse, } = props; const [isLoading, setIsLoading] = useState(true); @@ -108,8 +114,7 @@ export function AICourseLesson(props: AICourseLessonProps) { >([ { role: 'assistant', - content: - 'Hey, I am your AI instructor. How can I help you today? 🤖', + content: 'Hey, I am your AI instructor. How can I help you today? 🤖', isDefault: true, }, ]); @@ -205,7 +210,7 @@ export function AICourseLesson(props: AICourseLessonProps) { const questions = getQuestionsFromResult(result); setDefaultQuestions(questions); - + const newResult = result.replace( /=START_QUESTIONS=.*?=END_QUESTIONS=/, '', @@ -284,7 +289,7 @@ export function AICourseLesson(props: AICourseLessonProps) {
{(isGenerating || isLoading) && ( -
+
{!isGenerating && !isLoading && ( -
+
-

+

{currentLessonTitle?.replace(/^Lesson\s*?\d+[\.:]\s*/, '')}

{!error && isLoggedIn() && (
)} diff --git a/src/components/GenerateCourse/ModifyCoursePrompt.tsx b/src/components/GenerateCourse/ModifyCoursePrompt.tsx index 35583635d..94824f822 100644 --- a/src/components/GenerateCourse/ModifyCoursePrompt.tsx +++ b/src/components/GenerateCourse/ModifyCoursePrompt.tsx @@ -4,10 +4,17 @@ import { Modal } from '../Modal'; export type ModifyCoursePromptProps = { onClose: () => void; onSubmit: (prompt: string) => void; + title?: string; + description?: string; }; export function ModifyCoursePrompt(props: ModifyCoursePromptProps) { - const { onClose, onSubmit } = props; + const { + onClose, + onSubmit, + title = 'Give AI more context', + description = 'Pass additional information to the AI to generate a course outline.', + } = props; const [prompt, setPrompt] = useState(''); @@ -25,12 +32,8 @@ export function ModifyCoursePrompt(props: ModifyCoursePromptProps) { >
-

- Give AI more context -

-

- Pass additional information to the AI to generate a course outline. -

+

{title}

+

{description}