- );
-};
-
-
-
-## External Component
-
-import Counters from '../components/counters'
-
-
diff --git a/apps/docs/pages/builds/_meta.json b/apps/docs/pages/builds/_meta.json
new file mode 100644
index 0000000..66c9f6d
--- /dev/null
+++ b/apps/docs/pages/builds/_meta.json
@@ -0,0 +1,3 @@
+{
+ "environment": "Environment Api Keys"
+}
\ No newline at end of file
diff --git a/apps/docs/pages/builds/environment/_meta.json b/apps/docs/pages/builds/environment/_meta.json
new file mode 100644
index 0000000..6a96a3f
--- /dev/null
+++ b/apps/docs/pages/builds/environment/_meta.json
@@ -0,0 +1,8 @@
+{
+ "database": "Database PostgreSQL",
+ "openai": "OpenAI Providers Connection",
+ "auth0": "Accounts Authentication Auth0",
+ "pricing": "Chat GPT and Dall-E Models Pricing",
+ "s3bucket": "S3 Bucket for image storage"
+
+}
\ No newline at end of file
diff --git a/apps/docs/pages/builds/environment/auth0.mdx b/apps/docs/pages/builds/environment/auth0.mdx
new file mode 100644
index 0000000..9a9ee0f
--- /dev/null
+++ b/apps/docs/pages/builds/environment/auth0.mdx
@@ -0,0 +1,11 @@
+# **Accounts Authentication Auth0**
+> ```.env filename=".env" copy
+> # Providers Connections
+> AUTH0_SECRET= ""
+> AUTH0_BASE_URL="http://localhost:3000"
+> AUTH0_ISSUER_BASE_URL= ""
+> AUTH0_CLIENT_ID= ""
+> AUTH0_CLIENT_SECRET= ""
+> ```
+> > To get the secret environment key for Auth0
+> >
\ No newline at end of file
diff --git a/apps/docs/pages/builds/environment/database.mdx b/apps/docs/pages/builds/environment/database.mdx
new file mode 100644
index 0000000..76a35d3
--- /dev/null
+++ b/apps/docs/pages/builds/environment/database.mdx
@@ -0,0 +1,11 @@
+# **Database PostgreSQL**
+> The WizePrompt database
+> ```.env filename=".env" copy
+> # DB PostgreSQL
+> DATABASE_URL= " "
+> ```
+> > To get the environment key for the web database you will need to migrate the **Prisma Squema** of your local repository to your *PostgreSQL* app.
+> > ```js
+> > npx prisma migrate
+> > ```
+> > You will need to have **Prisma** already installed
\ No newline at end of file
diff --git a/apps/docs/pages/builds/environment/openai.mdx b/apps/docs/pages/builds/environment/openai.mdx
new file mode 100644
index 0000000..5806d2a
--- /dev/null
+++ b/apps/docs/pages/builds/environment/openai.mdx
@@ -0,0 +1,7 @@
+# **OpenAI Providers Connection**
+> ```.env filename=".env" copy
+> # Providers Connections
+> OPENAI_API_KEY= ""
+> ```
+> > To get the environment key
+> >
\ No newline at end of file
diff --git a/apps/docs/pages/builds/environment/pricing.mdx b/apps/docs/pages/builds/environment/pricing.mdx
new file mode 100644
index 0000000..e221bfc
--- /dev/null
+++ b/apps/docs/pages/builds/environment/pricing.mdx
@@ -0,0 +1,16 @@
+# **Chat GPT and Dall-E models pricing**
+> > *GPT Pricing*
+> > ```.env filename=".env" copy
+> > # GPT Model pricing per 1000 tokens
+> > NEXT_PUBLIC_GPT_35_INPUT = "0.0015"
+> > NEXT_PUBLIC_GPT_35_OUTPUT = "0.0020"
+> > NEXT_PUBLIC_GPT_4_INPUT = "0.03"
+> > NEXT_PUBLIC_GPT_4_OUTPUT = "0.06"
+> > ```
+> > *Dall-E Pricing*
+> > ```.env filename=".env" copy
+> > # DALLE Model pricing per resolution
+> > NEXT_PUBLIC_DALLE_256 = "0.016"
+> > NEXT_PUBLIC_DALLE_512 = "0.018"
+> > NEXT_PUBLIC_DALLE_1024 = "0.02"
+> > ```
\ No newline at end of file
diff --git a/apps/docs/pages/builds/environment/s3bucket.mdx b/apps/docs/pages/builds/environment/s3bucket.mdx
new file mode 100644
index 0000000..761764f
--- /dev/null
+++ b/apps/docs/pages/builds/environment/s3bucket.mdx
@@ -0,0 +1,7 @@
+# **S3 Bucket for image storage**
+> ```.env filename=".env" copy
+> # S3 Bucket
+> S3_SECRET_KEY = ""
+> ```
+> > To get the environment secret key for the S3 Bucket
+> >
\ No newline at end of file
diff --git a/apps/docs/pages/especifications.mdx b/apps/docs/pages/especifications.mdx
new file mode 100644
index 0000000..068b76b
--- /dev/null
+++ b/apps/docs/pages/especifications.mdx
@@ -0,0 +1,11 @@
+# Project requirements and especifications
+
+## Requirements
+
+Tools and Hardware Requirements Declaration
+
+## Specifications
+
+Technical Specifications
+
+
diff --git a/apps/docs/pages/index.mdx b/apps/docs/pages/index.mdx
index 058465c..8dad295 100644
--- a/apps/docs/pages/index.mdx
+++ b/apps/docs/pages/index.mdx
@@ -1,11 +1,27 @@
-# Introduction
-
-Welcome to Nextra! This is a basic docs template. You can use it as a starting point for your own project :)
+# Welcome to WizePrompt
-## What is Nextra?
+## Project Overview
+The web application WizePropmt is a software that permits the
+communication between a user and different types of AI
+language models. Through the use of credits, WizePrompt is able to
+manage and regulate the user consults to the language models.
-A **simple**, **powerful** and **flexible** site generation framework with everything you love from Next.js.
+## Information of the Project
+```js
+App Name: WizePrompt
+Customer: Wizeline
-## Documentation
+Project Administrator:
+David Gerardo Martínez
-The documentation is available at [https://nextra.site](https://nextra.site).
+Development Team:
+David Gerardo Martínez - William Frank Monroy
+María Eugenia Ontiveros - Jackeline Conant
+Emilio Ortiz - Rodrigo Rodriguez
+
+Design Team:
+David Gerardo Martínez - William Frank Monroy
+Jackeline Conant
+```
+
+** About this file
diff --git a/apps/docs/pages/maintain.mdx b/apps/docs/pages/maintain.mdx
new file mode 100644
index 0000000..1a1db1b
--- /dev/null
+++ b/apps/docs/pages/maintain.mdx
@@ -0,0 +1 @@
+# Notes for future maintainers
\ No newline at end of file
diff --git a/apps/docs/pages/setup/_meta.json b/apps/docs/pages/setup/_meta.json
new file mode 100644
index 0000000..3bf850e
--- /dev/null
+++ b/apps/docs/pages/setup/_meta.json
@@ -0,0 +1,4 @@
+{
+ "gitcode": "Git Code to Local System",
+ "packages": "Dependency Packages and Tools"
+}
\ No newline at end of file
diff --git a/apps/docs/pages/setup/gitcode.mdx b/apps/docs/pages/setup/gitcode.mdx
new file mode 100644
index 0000000..ffed24b
--- /dev/null
+++ b/apps/docs/pages/setup/gitcode.mdx
@@ -0,0 +1,47 @@
+# Setup instructions
+
+## Fetching git code to local system
+
+Commands that will use Github tools to fetch WizePrompt git code to local system
+* **Clone WizePrompt repository from Github web app:**
+```js filename="TERMINAL" {1} copy
+git clone https://github.com/wizelineacademy/itesm-socioformador-ago-dec-2023-team-02.git
+```
+* **Check the main development branch:**
+>```js filename="TERMINAL" {1} copy
+>git checkout development
+>```
+> **Fetch any changes made to the development branch:**
+>```js filename="TERMINAL" {1} copy
+>git fetch
+>```
+> > If there are some changes to the branch write:
+> > ```js filename="TERMINAL" {1} copy
+> > git pull
+> > ```
+>If previous commands were used the git code should be already updated and inside the local repository.
+
+## Installing project specific dependency packages and tools
+
+* **Pnpm package Manager**
+> Pnpm is an efficient package manager for Wizepropmt dependencies installation.
+> > **Pnpm installation**
+> >
+> *🞂 If you have pnpm installed already, skip this step and move to project dependencies.*
+* **Project dependencies**
+> Download and install the project dependencies for the app to run correctly with pnpm command.
+>```js filename="TERMINAL" {1} copy
+> pnpm install
+>```
+> This specific command will appear, wait for it to end installing and test.
+> > 🞂 For the other dependencies you will need to access the **web** and **docs** folder of your local repository and repeat the pnpm command.
+> If all the dependencies are installed the system will respond with:
+>```js
+> Scope: all 6 workspace projects
+>../.. prepare$ husky install
+>│ husky - Git hooks installed
+>└─ Done in X.Xs
+>Done in XX.Xs
+>```
+
+## Commands / Instructions for starting a server / OS service required by the project to run etc
\ No newline at end of file
diff --git a/apps/docs/pages/setup/packages.mdx b/apps/docs/pages/setup/packages.mdx
new file mode 100644
index 0000000..370e03d
--- /dev/null
+++ b/apps/docs/pages/setup/packages.mdx
@@ -0,0 +1,22 @@
+## Installing project specific dependency packages and tools
+
+* **Pnpm package Manager**
+> Pnpm is an efficient package manager for Wizepropmt dependencies installation.
+> > **Pnpm installation**
+> >
+> *🞂 If you have pnpm installed already, skip this step and move to project dependencies.*
+* **Project dependencies**
+> Download and install the project dependencies for the app to run correctly with pnpm command.
+>```js filename="TERMINAL" {1} copy
+> pnpm install
+>```
+> This specific command will appear, wait for it to end installing and test.
+
+> If all the dependencies are installed the system will respond with:
+>```js
+> Scope: all 6 workspace projects
+>../.. prepare$ husky install
+>│ husky - Git hooks installed
+>└─ Done in X.Xs
+>Done in XX.Xs
+>```
\ No newline at end of file
diff --git a/apps/docs/pages/testing.mdx b/apps/docs/pages/testing.mdx
new file mode 100644
index 0000000..01e2f16
--- /dev/null
+++ b/apps/docs/pages/testing.mdx
@@ -0,0 +1 @@
+# Unit Testing or Basic testing steps
\ No newline at end of file
diff --git a/apps/docs/theme.config.tsx b/apps/docs/theme.config.tsx
index 6b42fde..4fcf4b1 100644
--- a/apps/docs/theme.config.tsx
+++ b/apps/docs/theme.config.tsx
@@ -2,14 +2,11 @@ import React from "react";
import { DocsThemeConfig } from "nextra-theme-docs";
const config: DocsThemeConfig = {
- logo: My Project,
+ logo: SAM WizePrompt Proyect,
project: {
- link: "https://github.com/shuding/nextra-docs-template",
+ link: "https://github.com/wizelineacademy/itesm-socioformador-ago-dec-2023-team-02",
},
- chat: {
- link: "https://discord.com",
- },
- docsRepositoryBase: "https://github.com/shuding/nextra-docs-template",
+ docsRepositoryBase: "https://github.com/wizelineacademy/itesm-socioformador-ago-dec-2023-team-02",
footer: {
text: "Nextra Docs Template",
},
diff --git a/apps/web/.env.example b/apps/web/.env.example
index 07c7086..6412b9c 100644
--- a/apps/web/.env.example
+++ b/apps/web/.env.example
@@ -9,4 +9,7 @@ AUTH0_SECRET=
AUTH0_BASE_URL=
AUTH0_ISSUER_BASE_URL=
AUTH0_CLIENT_ID=
-AUTH0_CLIENT_SECRET=
\ No newline at end of file
+AUTH0_CLIENT_SECRET=
+
+# S3 Bucket
+S3_SECRET_KEY=
\ No newline at end of file
diff --git a/apps/web/app/(root)/(admin)/layout.tsx b/apps/web/app/(root)/(admin)/layout.tsx
deleted file mode 100644
index 8e93484..0000000
--- a/apps/web/app/(root)/(admin)/layout.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-
-export default function AdminRootLayout({
- children,
-}: {
- children: React.ReactNode;
-}): any {
- return (
-
-
- {children}
-
-
- );
-}
-
\ No newline at end of file
diff --git a/apps/web/app/(root)/(user)/conversation/[id]/page.tsx b/apps/web/app/(root)/(user)/conversation/[id]/page.tsx
index e69de29..c654878 100644
--- a/apps/web/app/(root)/(user)/conversation/[id]/page.tsx
+++ b/apps/web/app/(root)/(user)/conversation/[id]/page.tsx
@@ -0,0 +1,50 @@
+import ConversationBody from "@/components/user/conversationBody/molecules/conversation-body";
+
+/*
+import { getConversationById } from "@/lib/conversation";
+import { getAllMessages } from "@/lib/message";
+import { Conversation, Message as WizepromptMessage } from "@prisma/client";
+import { convertToGptMessage } from "@/lib/helper/gpt/convert-message-type";
+import { Message } from "ai";
+import ConversationHeader from "@/components/molecules/user/conversationHeader/conversation-top-header";
+import PromptTextInput from "@/components/molecules/user/conversationBody/prompt-text-input";
+import MessageList from "@/components/molecules/user/conversationBody/message-list";
+import { JsonObject, JsonValue } from "@prisma/client/runtime/library";
+
+const providerImage =
+ "https://avatars.githubusercontent.com/u/86160567?s=200&v=4"; // URL de la imagen del remitente
+
+const userImage =
+ "https://ui-avatars.com/api/?background=007CFF&color=fff&name=David";
+
+interface ConversationParameters {
+ userContext: String;
+ responseContext: String;
+ temperature: Number;
+}
+*/
+export default function ConversationPage(): JSX.Element {
+ /*
+ //get conversation data from api
+ const conversationData = await getConversationById(id);
+
+ //get messages of conversation
+ const messagesData = await getAllMessages(id);
+
+ //validate data
+
+
+ //convert messages to gpt messages
+ const wizePromptMessages: WizepromptMessage[] = messagesData.data || [];
+ const messages: Message[] = wizePromptMessages.map(convertToGptMessage);
+
+ //set parameters
+ const conversation = conversationData.data || {} as Conversation;
+ const parameters = conversation.parameters || {userContext: "", responseContext: "", temperature: 0.5} as ConversationParameters;
+ //const userContextParameters = parameters.userContext || "";
+ */
+
+ return (
+
+ );
+}
\ No newline at end of file
diff --git a/apps/web/app/(root)/(user)/conversation/layout.tsx b/apps/web/app/(root)/(user)/conversation/layout.tsx
index bd46cc6..d092688 100644
--- a/apps/web/app/(root)/(user)/conversation/layout.tsx
+++ b/apps/web/app/(root)/(user)/conversation/layout.tsx
@@ -1,23 +1,111 @@
-import "../../..globals.css";
import type { Metadata } from "next";
-import LeftSidebar from "@/components/shared/left-sidebar";
+import type { Tag, User } from "@prisma/client";
+import { Suspense } from "react";
+import { getSession } from "@auth0/nextjs-auth0";
+import { redirect } from "next/navigation";
+import ConversationSidebar from "@/components/user/conversationSidebar/organisms/conversation-sidebar";
+import { getAllConversationsByUserId } from "@/lib/conversation";
+import { getAllSidebarTagsByUserID } from "@/lib/tag";
+import type { SidebarConversation } from "@/types/sidebar-conversation-types";
+import { getAllModelsWithProvider } from "@/lib/model";
+import type { ModelWithProvider } from "@/types/moder-with-provider-types";
+import { PrismaUserContextProvider } from "@/context/prisma-user-context";
+import { getUserbyAuthID } from "@/lib/user";
+import { Skeleton } from "@/components/ui/skeleton";
+import { ConversationsContextProvider } from "@/context/conversations-context";
export const metadata: Metadata = {
title: "WizePrompt",
description: "",
};
-export default function RootLayout({
- children,
-}: {
- children: React.ReactNode;
-}): any {
+function SidebarSuspense(): JSX.Element {
return (
-
-
-
-
{children}
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
+export default async function ConversationRootLayout({children}: {children: React.ReactNode}): Promise {
+ const { user } = (await getSession()) || {};
+
+ //If no user, redirect to login
+ if (!user) {
+ redirect("/api/auth/login");
+ }
+
+ //get user from database
+ const userAuthID: string = user.sub;
+ const prismaUser: User | undefined = (await getUserbyAuthID(userAuthID)).data;
+
+ // If fetching of user data failed, redirect to login.
+ if (!prismaUser){
+ redirect("/api/auth/login");
+ }
+
+ const userConversations: SidebarConversation[] = prismaUser
+ ? (await getAllConversationsByUserId(prismaUser.id)).data || []
+ : [];
+ const userTags: Tag[] = prismaUser
+ ? (await getAllSidebarTagsByUserID(prismaUser.id)).data || []
+ : [];
+ const models: ModelWithProvider[] = prismaUser
+ ? (await getAllModelsWithProvider()).data || []
+ : [];
+
+ return (
+ }>
+
+
+
+
+
+ {children}
+
+
+
+
+
);
}
diff --git a/apps/web/app/(root)/(user)/conversation/new/page.tsx b/apps/web/app/(root)/(user)/conversation/new/page.tsx
index a21d535..6b96263 100644
--- a/apps/web/app/(root)/(user)/conversation/new/page.tsx
+++ b/apps/web/app/(root)/(user)/conversation/new/page.tsx
@@ -1,15 +1,10 @@
-import ChatComponent from "@/components/chat-component";
-// Prisma does not support Edge without the Data Proxy currently
-// export const runtime = 'edge'
-export const preferredRegion = "home";
-export const dynamic = "force-dynamic";
+import Welcome from "@/components/user/newConversation/organism/welcome";
+import { getAllModelsWithProvider } from "@/lib/model";
+import type { ModelWithProvider } from "@/types/moder-with-provider-types";
-function HomePage(): any {
- return (
-
-
-
- );
-}
+export default async function NewConversationPage(): Promise {
+ const models: ModelWithProvider[] =
+ (await getAllModelsWithProvider()).data || [];
-export default HomePage;
+ return ;
+}
diff --git a/apps/web/app/(root)/(user)/layout.tsx b/apps/web/app/(root)/(user)/layout.tsx
index 3a92ce5..be2e913 100644
--- a/apps/web/app/(root)/(user)/layout.tsx
+++ b/apps/web/app/(root)/(user)/layout.tsx
@@ -1,11 +1,9 @@
-export default function UserRootLayout({
- children,
-}: {
- children: React.ReactNode;
-}): any {
- return (
-
- {children}
-
- );
+// import { withPageAuthRequired } from "@auth0/nextjs-auth0";
+
+// export default withPageAuthRequired(function User({ children }: any): any {
+// return children;
+// });
+
+export default function UserLayout({ children }: any): any {
+ return children;
}
diff --git a/apps/web/app/(root)/admin/group/[id]/page.tsx b/apps/web/app/(root)/admin/group/[id]/page.tsx
new file mode 100644
index 0000000..8e1c35b
--- /dev/null
+++ b/apps/web/app/(root)/admin/group/[id]/page.tsx
@@ -0,0 +1,9 @@
+import GroupBody from "@/components/admin/groupBody/organisms/group-body";
+
+export default function GroupPage(): JSX.Element {
+ return (
+
+
+
+ );
+}
diff --git a/apps/web/app/(root)/admin/layout.tsx b/apps/web/app/(root)/admin/layout.tsx
new file mode 100644
index 0000000..b274989
--- /dev/null
+++ b/apps/web/app/(root)/admin/layout.tsx
@@ -0,0 +1,43 @@
+import type { Group, User } from "@prisma/client";
+import { redirect } from "next/navigation";
+import { getSession } from "@auth0/nextjs-auth0";
+import GroupSidebar from "@/components/admin/groupSidebar/organisms/group-sidebar";
+import { GroupsContextProvider } from "@/context/groups-context";
+import { getAllGroups } from "@/lib/group";
+import { sortGroups } from "@/helpers/group-helpers";
+import { getUserbyAuthID } from "@/lib/user";
+import { PrismaUserContextProvider } from "@/context/prisma-user-context";
+
+export default async function AdminRootLayout({children}: {children: React.ReactNode;}): Promise {
+ const { user } = (await getSession()) || {};
+
+ //If no user, redirect to login
+ if (!user) {
+ redirect("/api/auth/login");
+ }
+
+ //get user from database
+ const userAuthID: string = user.sub;
+ const prismaUser: User | undefined = (await getUserbyAuthID(userAuthID)).data;
+
+ // If fetching of user data failed, redirect to login.
+ if (!prismaUser){
+ redirect("/api/auth/login");
+ }
+
+ const allUsersGroupId = 1
+ const initialGroups: Group[] = sortGroups((await getAllGroups()).data || [], allUsersGroupId)
+
+ return (
+
+
+
+
+
+ {children}
+
+
+
+
+ );
+}
\ No newline at end of file
diff --git a/apps/web/app/(root)/layout.tsx b/apps/web/app/(root)/layout.tsx
index b2021af..7ebae68 100644
--- a/apps/web/app/(root)/layout.tsx
+++ b/apps/web/app/(root)/layout.tsx
@@ -28,7 +28,7 @@ export default function RootLayout({
{children}
-
+