feat: init ai editor writer and continue writing feature

This commit is contained in:
swve 2024-01-11 01:39:43 +01:00
parent 21f1f2fd94
commit 5b79cbed89
12 changed files with 446 additions and 29 deletions

View file

@ -8,6 +8,8 @@ import { getAccessTokenFromRefreshTokenCookie, getNewAccessTokenUsingRefreshToke
import { getOrganizationContextInfo, getOrganizationContextInfoWithId } from "@services/organizations/orgs";
import SessionProvider from "@components/Contexts/SessionContext";
import EditorOptionsProvider from "@components/Contexts/Editor/EditorContext";
import AIChatBotProvider from "@components/Contexts/AI/AIChatBotContext";
import AIEditorProvider from "@components/Contexts/AI/AIEditorContext";
type MetadataProps = {
params: { orgslug: string, courseid: string, activityid: string };
@ -36,13 +38,14 @@ const EditActivity = async (params: any) => {
const courseInfo = await getCourseMetadataWithAuthHeader(courseid, { revalidate: 0, tags: ['courses'] }, access_token ? access_token : null)
const activity = await getActivityWithAuthHeader(activityuuid, { revalidate: 0, tags: ['activities'] }, access_token ? access_token : null)
const org = await getOrganizationContextInfoWithId(courseInfo.org_id, { revalidate: 1800, tags: ['organizations'] });
console.log('courseInfo', courseInfo)
return (
<EditorOptionsProvider options={{ isEditable: true }}>
<SessionProvider>
<EditorWrapper org={org} course={courseInfo} activity={activity} content={activity.content}></EditorWrapper>
</SessionProvider>
<AIEditorProvider>
<SessionProvider>
<EditorWrapper org={org} course={courseInfo} activity={activity} content={activity.content}></EditorWrapper>
</SessionProvider>
</AIEditorProvider>
</EditorOptionsProvider>
);
}