├── 10
├── .eslintrc.json
├── types
│ └── chat.d.ts
├── app
│ ├── favicon.ico
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── page.tsx
│ └── layout.tsx
├── next.config.js
├── postcss.config.js
├── public
│ ├── images
│ │ └── new-tab.png
│ └── vercel.svg
├── components
│ └── home
│ │ ├── Main
│ │ ├── Welcome.tsx
│ │ └── index.tsx
│ │ └── Navigation
│ │ └── index.tsx
├── .gitignore
├── tailwind.config.js
├── package.json
├── tsconfig.json
└── reducers
│ └── AppReducer.ts
├── 11
├── .eslintrc.json
├── app
│ ├── favicon.ico
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── page.tsx
│ └── layout.tsx
├── next.config.js
├── postcss.config.js
├── public
│ ├── images
│ │ └── new-tab.png
│ └── vercel.svg
├── types
│ └── chat.d.ts
├── components
│ └── home
│ │ ├── Main
│ │ ├── Welcome.tsx
│ │ └── index.tsx
│ │ └── Navigation
│ │ └── index.tsx
├── .gitignore
├── tailwind.config.js
├── tsconfig.json
└── reducers
│ └── AppReducer.ts
├── 12
├── .eslintrc.json
├── app
│ ├── favicon.ico
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── api
│ │ ├── test
│ │ │ └── route.ts
│ │ └── chat
│ │ │ └── route.ts
│ ├── page.tsx
│ └── layout.tsx
├── next.config.js
├── postcss.config.js
├── public
│ ├── images
│ │ └── new-tab.png
│ └── vercel.svg
├── types
│ └── chat.d.ts
├── components
│ └── home
│ │ ├── Main
│ │ ├── Welcome.tsx
│ │ └── index.tsx
│ │ └── Navigation
│ │ └── index.tsx
├── .gitignore
├── tailwind.config.js
└── tsconfig.json
├── 13
├── .eslintrc.json
├── app
│ ├── favicon.ico
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── api
│ │ └── test
│ │ │ └── route.ts
│ ├── page.tsx
│ └── layout.tsx
├── next.config.js
├── postcss.config.js
├── public
│ ├── images
│ │ └── new-tab.png
│ └── vercel.svg
├── types
│ └── chat.d.ts
├── components
│ └── home
│ │ ├── Main
│ │ ├── Welcome.tsx
│ │ └── index.tsx
│ │ └── Navigation
│ │ └── index.tsx
├── .gitignore
├── doc.md
├── tailwind.config.js
└── tsconfig.json
├── 14
├── .eslintrc.json
├── app
│ ├── favicon.ico
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── api
│ │ └── test
│ │ │ └── route.ts
│ ├── page.tsx
│ └── layout.tsx
├── next.config.js
├── postcss.config.js
├── public
│ ├── images
│ │ └── new-tab.png
│ └── vercel.svg
├── types
│ └── chat.d.ts
├── components
│ └── home
│ │ ├── Main
│ │ ├── Welcome.tsx
│ │ └── index.tsx
│ │ └── Navigation
│ │ └── index.tsx
├── .gitignore
├── tailwind.config.js
└── tsconfig.json
├── 15
├── .eslintrc.json
├── app
│ ├── favicon.ico
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── api
│ │ ├── test
│ │ │ └── route.ts
│ │ └── message
│ │ │ └── update
│ │ │ └── route.ts
│ ├── page.tsx
│ └── layout.tsx
├── next.config.js
├── postcss.config.js
├── prisma
│ ├── chatgpt-app.sqlite
│ ├── migrations
│ │ ├── migration_lock.toml
│ │ └── 20230914084314_init
│ │ │ └── migration.sql
│ └── schema.prisma
├── public
│ ├── images
│ │ └── new-tab.png
│ └── vercel.svg
├── types
│ └── chat.d.ts
├── components
│ └── home
│ │ ├── Main
│ │ ├── Welcome.tsx
│ │ └── index.tsx
│ │ └── Navigation
│ │ └── index.tsx
├── lib
│ └── prisma.ts
├── .gitignore
├── doc.md
├── tailwind.config.js
└── tsconfig.json
├── 16
├── .eslintrc.json
├── app
│ ├── favicon.ico
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── api
│ │ ├── test
│ │ │ └── route.ts
│ │ └── message
│ │ │ ├── delete
│ │ │ └── route.ts
│ │ │ └── update
│ │ │ └── route.ts
│ └── page.tsx
├── next.config.js
├── postcss.config.js
├── prisma
│ ├── chatgpt-app.sqlite
│ ├── migrations
│ │ ├── migration_lock.toml
│ │ └── 20230914084314_init
│ │ │ └── migration.sql
│ └── schema.prisma
├── public
│ ├── images
│ │ └── new-tab.png
│ └── vercel.svg
├── types
│ └── chat.d.ts
├── components
│ └── home
│ │ ├── Main
│ │ ├── Welcome.tsx
│ │ └── index.tsx
│ │ └── Navigation
│ │ └── index.tsx
├── lib
│ └── prisma.ts
├── .gitignore
├── tailwind.config.js
└── tsconfig.json
├── 17
├── .eslintrc.json
├── app
│ ├── favicon.ico
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── api
│ │ ├── test
│ │ │ └── route.ts
│ │ ├── message
│ │ │ ├── delete
│ │ │ │ └── route.ts
│ │ │ └── list
│ │ │ │ └── route.ts
│ │ └── chat
│ │ │ └── list
│ │ │ └── route.ts
│ └── page.tsx
├── next.config.js
├── postcss.config.js
├── prisma
│ ├── chatgpt-app.sqlite
│ ├── migrations
│ │ ├── migration_lock.toml
│ │ └── 20230914084314_init
│ │ │ └── migration.sql
│ └── schema.prisma
├── public
│ ├── images
│ │ └── new-tab.png
│ └── vercel.svg
├── types
│ └── chat.d.ts
├── components
│ └── home
│ │ ├── Main
│ │ ├── Welcome.tsx
│ │ └── index.tsx
│ │ └── Navigation
│ │ └── index.tsx
├── lib
│ └── prisma.ts
├── .gitignore
├── tailwind.config.js
└── tsconfig.json
├── 18
├── .eslintrc.json
├── app
│ ├── favicon.ico
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── api
│ │ ├── test
│ │ │ └── route.ts
│ │ ├── message
│ │ │ ├── delete
│ │ │ │ └── route.ts
│ │ │ └── list
│ │ │ │ └── route.ts
│ │ └── chat
│ │ │ └── list
│ │ │ └── route.ts
│ └── page.tsx
├── next.config.js
├── postcss.config.js
├── prisma
│ ├── chatgpt-app.sqlite
│ ├── migrations
│ │ ├── migration_lock.toml
│ │ └── 20230914084314_init
│ │ │ └── migration.sql
│ └── schema.prisma
├── public
│ ├── images
│ │ └── new-tab.png
│ └── vercel.svg
├── types
│ └── chat.d.ts
├── components
│ └── home
│ │ ├── Main
│ │ ├── Welcome.tsx
│ │ └── index.tsx
│ │ └── Navigation
│ │ └── index.tsx
├── lib
│ └── prisma.ts
├── .gitignore
├── tailwind.config.js
└── tsconfig.json
├── 19
├── .eslintrc.json
├── app
│ ├── favicon.ico
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── api
│ │ ├── test
│ │ │ └── route.ts
│ │ ├── chat
│ │ │ ├── update
│ │ │ │ └── route.ts
│ │ │ ├── list
│ │ │ │ └── route.ts
│ │ │ └── delete
│ │ │ │ └── route.ts
│ │ └── message
│ │ │ ├── delete
│ │ │ └── route.ts
│ │ │ └── list
│ │ │ └── route.ts
│ └── page.tsx
├── next.config.js
├── postcss.config.js
├── prisma
│ ├── chatgpt-app.sqlite
│ ├── migrations
│ │ ├── migration_lock.toml
│ │ └── 20230914084314_init
│ │ │ └── migration.sql
│ └── schema.prisma
├── public
│ ├── images
│ │ └── new-tab.png
│ └── vercel.svg
├── types
│ └── chat.d.ts
├── components
│ └── home
│ │ ├── Main
│ │ ├── Welcome.tsx
│ │ └── index.tsx
│ │ └── Navigation
│ │ └── index.tsx
├── lib
│ └── prisma.ts
├── .gitignore
├── tailwind.config.js
└── tsconfig.json
├── 20
├── .env.development
├── .eslintrc.json
├── app
│ ├── favicon.ico
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── api
│ │ ├── test
│ │ │ └── route.ts
│ │ ├── chat
│ │ │ ├── update
│ │ │ │ └── route.ts
│ │ │ ├── list
│ │ │ │ └── route.ts
│ │ │ └── delete
│ │ │ │ └── route.ts
│ │ └── message
│ │ │ ├── delete
│ │ │ └── route.ts
│ │ │ └── list
│ │ │ └── route.ts
│ └── page.tsx
├── next.config.js
├── postcss.config.js
├── prisma
│ ├── chatgpt-app.sqlite
│ ├── migrations
│ │ ├── migration_lock.toml
│ │ └── 20230914084314_init
│ │ │ └── migration.sql
│ └── schema.prisma
├── public
│ ├── images
│ │ └── new-tab.png
│ └── vercel.svg
├── doc.md
├── lib
│ ├── openai.ts
│ └── prisma.ts
├── types
│ └── chat.d.ts
├── components
│ └── home
│ │ ├── Main
│ │ └── Welcome.tsx
│ │ └── Navigation
│ │ └── index.tsx
├── .gitignore
├── tailwind.config.js
└── tsconfig.json
├── 21
├── .env.development
├── .eslintrc.json
├── doc.md
├── app
│ ├── favicon.ico
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── api
│ │ ├── test
│ │ │ └── route.ts
│ │ ├── chat
│ │ │ ├── update
│ │ │ │ └── route.ts
│ │ │ ├── list
│ │ │ │ └── route.ts
│ │ │ └── delete
│ │ │ │ └── route.ts
│ │ └── message
│ │ │ ├── delete
│ │ │ └── route.ts
│ │ │ └── list
│ │ │ └── route.ts
│ └── page.tsx
├── next.config.js
├── postcss.config.js
├── prisma
│ ├── chatgpt-app.sqlite
│ ├── migrations
│ │ ├── migration_lock.toml
│ │ └── 20230914084314_init
│ │ │ └── migration.sql
│ └── schema.prisma
├── public
│ ├── images
│ │ └── new-tab.png
│ └── vercel.svg
├── lib
│ ├── openai.ts
│ └── prisma.ts
├── types
│ └── chat.d.ts
├── components
│ └── home
│ │ ├── Main
│ │ └── Welcome.tsx
│ │ └── Navigation
│ │ └── index.tsx
├── .gitignore
├── tailwind.config.js
└── tsconfig.json
├── 01
├── .eslintrc.json
├── app
│ ├── favicon.ico
│ ├── page.tsx
│ ├── layout.tsx
│ └── globals.css
├── next.config.js
├── postcss.config.js
├── .gitignore
├── tailwind.config.js
├── public
│ └── vercel.svg
├── package.json
└── tsconfig.json
├── 02
├── .eslintrc.json
├── app
│ ├── globals.css
│ ├── favicon.ico
│ ├── page.tsx
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ └── layout.tsx
├── next.config.js
├── postcss.config.js
├── .gitignore
├── tailwind.config.js
├── public
│ └── vercel.svg
├── package.json
└── tsconfig.json
├── 03
├── .eslintrc.json
├── app
│ ├── globals.css
│ ├── favicon.ico
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ └── layout.tsx
├── components
│ └── home
│ │ ├── Navigation.tsx
│ │ └── Main.tsx
├── next.config.js
├── postcss.config.js
├── .gitignore
├── tailwind.config.js
├── public
│ └── vercel.svg
├── package.json
└── tsconfig.json
├── 04
├── .eslintrc.json
├── app
│ ├── favicon.ico
│ ├── globals.css
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── page.tsx
│ └── layout.tsx
├── next.config.js
├── postcss.config.js
├── components
│ ├── home
│ │ ├── Main.tsx
│ │ └── Navigation.tsx
│ └── common
│ │ └── Button.tsx
├── tailwind.config.js
├── .gitignore
├── public
│ └── vercel.svg
├── package.json
└── tsconfig.json
├── 05
├── .eslintrc.json
├── app
│ ├── favicon.ico
│ ├── globals.css
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── page.tsx
│ └── layout.tsx
├── next.config.js
├── postcss.config.js
├── components
│ └── home
│ │ ├── Main
│ │ └── index.tsx
│ │ └── Navigation
│ │ └── index.tsx
├── doc.md
├── tailwind.config.js
├── .gitignore
├── public
│ └── vercel.svg
├── package.json
├── reducers
│ └── AppReducer.ts
└── tsconfig.json
├── 06
├── .eslintrc.json
├── app
│ ├── favicon.ico
│ ├── globals.css
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── page.tsx
│ └── layout.tsx
├── next.config.js
├── postcss.config.js
├── components
│ └── home
│ │ ├── Main
│ │ └── index.tsx
│ │ └── Navigation
│ │ └── index.tsx
├── doc.md
├── tailwind.config.js
├── .gitignore
├── public
│ └── vercel.svg
├── package.json
├── reducers
│ └── AppReducer.ts
└── tsconfig.json
├── 07
├── .eslintrc.json
├── types
│ └── chat.d.ts
├── app
│ ├── favicon.ico
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── page.tsx
│ └── layout.tsx
├── next.config.js
├── postcss.config.js
├── components
│ └── home
│ │ ├── Main
│ │ └── index.tsx
│ │ └── Navigation
│ │ └── index.tsx
├── tailwind.config.js
├── .gitignore
├── public
│ └── vercel.svg
├── package.json
├── reducers
│ └── AppReducer.ts
└── tsconfig.json
├── 08
├── .eslintrc.json
├── types
│ └── chat.d.ts
├── app
│ ├── favicon.ico
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── page.tsx
│ └── layout.tsx
├── next.config.js
├── postcss.config.js
├── components
│ └── home
│ │ ├── Main
│ │ └── index.tsx
│ │ └── Navigation
│ │ └── index.tsx
├── tailwind.config.js
├── .gitignore
├── public
│ └── vercel.svg
├── package.json
├── reducers
│ └── AppReducer.ts
└── tsconfig.json
├── 09
├── .eslintrc.json
├── types
│ └── chat.d.ts
├── app
│ ├── favicon.ico
│ ├── chat
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── page.tsx
│ └── layout.tsx
├── next.config.js
├── postcss.config.js
├── doc.md
├── components
│ └── home
│ │ ├── Main
│ │ ├── index.tsx
│ │ └── Welcome.tsx
│ │ └── Navigation
│ │ └── index.tsx
├── tailwind.config.js
├── .gitignore
├── public
│ └── vercel.svg
├── package.json
├── tsconfig.json
└── reducers
│ └── AppReducer.ts
└── README.md
/20/.env.development:
--------------------------------------------------------------------------------
1 | AZURE_ENDPOINT=
2 | AZURE_API_KEY=
--------------------------------------------------------------------------------
/21/.env.development:
--------------------------------------------------------------------------------
1 | AZURE_ENDPOINT=
2 | AZURE_API_KEY=
--------------------------------------------------------------------------------
/01/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/02/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/03/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/04/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/05/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/06/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/07/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/08/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/09/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/10/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/11/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/12/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/13/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/14/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/15/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/16/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/17/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/18/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/19/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/20/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/21/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/21/doc.md:
--------------------------------------------------------------------------------
1 | 使用 5 到 10 个字直接返回这句话的简要主题,不要解释、不要标点、不要语气词、不要多余文本,如果没有主题,请直接返回'新对话'
2 |
--------------------------------------------------------------------------------
/02/app/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
--------------------------------------------------------------------------------
/03/app/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
--------------------------------------------------------------------------------
/03/components/home/Navigation.tsx:
--------------------------------------------------------------------------------
1 | export default function Navigation() {
2 | return
3 | }
4 |
--------------------------------------------------------------------------------
/07/types/chat.d.ts:
--------------------------------------------------------------------------------
1 | export interface Chat {
2 | id: string
3 | title: string
4 | updateTime: number
5 | }
--------------------------------------------------------------------------------
/08/types/chat.d.ts:
--------------------------------------------------------------------------------
1 | export interface Chat {
2 | id: string
3 | title: string
4 | updateTime: number
5 | }
--------------------------------------------------------------------------------
/09/types/chat.d.ts:
--------------------------------------------------------------------------------
1 | export interface Chat {
2 | id: string
3 | title: string
4 | updateTime: number
5 | }
--------------------------------------------------------------------------------
/10/types/chat.d.ts:
--------------------------------------------------------------------------------
1 | export interface Chat {
2 | id: string
3 | title: string
4 | updateTime: number
5 | }
--------------------------------------------------------------------------------
/01/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/01/app/favicon.ico
--------------------------------------------------------------------------------
/02/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/02/app/favicon.ico
--------------------------------------------------------------------------------
/03/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/03/app/favicon.ico
--------------------------------------------------------------------------------
/04/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/04/app/favicon.ico
--------------------------------------------------------------------------------
/05/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/05/app/favicon.ico
--------------------------------------------------------------------------------
/06/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/06/app/favicon.ico
--------------------------------------------------------------------------------
/07/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/07/app/favicon.ico
--------------------------------------------------------------------------------
/08/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/08/app/favicon.ico
--------------------------------------------------------------------------------
/09/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/09/app/favicon.ico
--------------------------------------------------------------------------------
/10/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/10/app/favicon.ico
--------------------------------------------------------------------------------
/11/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/11/app/favicon.ico
--------------------------------------------------------------------------------
/12/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/12/app/favicon.ico
--------------------------------------------------------------------------------
/13/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/13/app/favicon.ico
--------------------------------------------------------------------------------
/14/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/14/app/favicon.ico
--------------------------------------------------------------------------------
/15/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/15/app/favicon.ico
--------------------------------------------------------------------------------
/16/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/16/app/favicon.ico
--------------------------------------------------------------------------------
/17/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/17/app/favicon.ico
--------------------------------------------------------------------------------
/18/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/18/app/favicon.ico
--------------------------------------------------------------------------------
/19/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/19/app/favicon.ico
--------------------------------------------------------------------------------
/20/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/20/app/favicon.ico
--------------------------------------------------------------------------------
/21/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/21/app/favicon.ico
--------------------------------------------------------------------------------
/01/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/01/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/02/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/02/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/03/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/03/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/04/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/04/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/05/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/05/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/06/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/06/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/07/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/07/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/08/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/08/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/09/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/09/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/10/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/10/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/11/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/11/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/12/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/12/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/13/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/13/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/14/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/14/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/15/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/15/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/16/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/16/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/17/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/17/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/18/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/18/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/19/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/19/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/20/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/20/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/21/next.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('next').NextConfig} */
2 | const nextConfig = {}
3 |
4 | module.exports = nextConfig
5 |
--------------------------------------------------------------------------------
/21/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/10/public/images/new-tab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/10/public/images/new-tab.png
--------------------------------------------------------------------------------
/11/public/images/new-tab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/11/public/images/new-tab.png
--------------------------------------------------------------------------------
/12/public/images/new-tab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/12/public/images/new-tab.png
--------------------------------------------------------------------------------
/13/public/images/new-tab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/13/public/images/new-tab.png
--------------------------------------------------------------------------------
/14/public/images/new-tab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/14/public/images/new-tab.png
--------------------------------------------------------------------------------
/15/prisma/chatgpt-app.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/15/prisma/chatgpt-app.sqlite
--------------------------------------------------------------------------------
/15/public/images/new-tab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/15/public/images/new-tab.png
--------------------------------------------------------------------------------
/16/prisma/chatgpt-app.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/16/prisma/chatgpt-app.sqlite
--------------------------------------------------------------------------------
/16/public/images/new-tab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/16/public/images/new-tab.png
--------------------------------------------------------------------------------
/17/prisma/chatgpt-app.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/17/prisma/chatgpt-app.sqlite
--------------------------------------------------------------------------------
/17/public/images/new-tab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/17/public/images/new-tab.png
--------------------------------------------------------------------------------
/18/prisma/chatgpt-app.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/18/prisma/chatgpt-app.sqlite
--------------------------------------------------------------------------------
/18/public/images/new-tab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/18/public/images/new-tab.png
--------------------------------------------------------------------------------
/19/prisma/chatgpt-app.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/19/prisma/chatgpt-app.sqlite
--------------------------------------------------------------------------------
/19/public/images/new-tab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/19/public/images/new-tab.png
--------------------------------------------------------------------------------
/20/prisma/chatgpt-app.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/20/prisma/chatgpt-app.sqlite
--------------------------------------------------------------------------------
/20/public/images/new-tab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/20/public/images/new-tab.png
--------------------------------------------------------------------------------
/21/prisma/chatgpt-app.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/21/prisma/chatgpt-app.sqlite
--------------------------------------------------------------------------------
/21/public/images/new-tab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhixingxiaoke/react-hands-on-tutorial-for-beginners/HEAD/21/public/images/new-tab.png
--------------------------------------------------------------------------------
/03/components/home/Main.tsx:
--------------------------------------------------------------------------------
1 | export default function Main({ counter }: { counter: number }) {
2 | return 主体内容: {counter}
3 | }
4 |
--------------------------------------------------------------------------------
/15/prisma/migrations/migration_lock.toml:
--------------------------------------------------------------------------------
1 | # Please do not edit this file manually
2 | # It should be added in your version-control system (i.e. Git)
3 | provider = "sqlite"
--------------------------------------------------------------------------------
/16/prisma/migrations/migration_lock.toml:
--------------------------------------------------------------------------------
1 | # Please do not edit this file manually
2 | # It should be added in your version-control system (i.e. Git)
3 | provider = "sqlite"
--------------------------------------------------------------------------------
/17/prisma/migrations/migration_lock.toml:
--------------------------------------------------------------------------------
1 | # Please do not edit this file manually
2 | # It should be added in your version-control system (i.e. Git)
3 | provider = "sqlite"
--------------------------------------------------------------------------------
/18/prisma/migrations/migration_lock.toml:
--------------------------------------------------------------------------------
1 | # Please do not edit this file manually
2 | # It should be added in your version-control system (i.e. Git)
3 | provider = "sqlite"
--------------------------------------------------------------------------------
/19/prisma/migrations/migration_lock.toml:
--------------------------------------------------------------------------------
1 | # Please do not edit this file manually
2 | # It should be added in your version-control system (i.e. Git)
3 | provider = "sqlite"
--------------------------------------------------------------------------------
/20/prisma/migrations/migration_lock.toml:
--------------------------------------------------------------------------------
1 | # Please do not edit this file manually
2 | # It should be added in your version-control system (i.e. Git)
3 | provider = "sqlite"
--------------------------------------------------------------------------------
/21/prisma/migrations/migration_lock.toml:
--------------------------------------------------------------------------------
1 | # Please do not edit this file manually
2 | # It should be added in your version-control system (i.e. Git)
3 | provider = "sqlite"
--------------------------------------------------------------------------------
/04/app/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
5 | html,
6 | body {
7 | height: 100%;
8 | font-size: 16px;
9 | }
10 |
--------------------------------------------------------------------------------
/05/app/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
5 | html,
6 | body {
7 | height: 100%;
8 | font-size: 16px;
9 | }
10 |
--------------------------------------------------------------------------------
/06/app/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
5 | html,
6 | body {
7 | height: 100%;
8 | font-size: 16px;
9 | }
10 |
--------------------------------------------------------------------------------
/09/doc.md:
--------------------------------------------------------------------------------
1 | ```
2 | import { PiLightningFill, PiShootingStarFill } from "react-icons/pi"
3 |
4 | ```
5 |
6 | ```
7 | import { MdOutlineTipsAndUpdates } from "react-icons/md"
8 | ```
9 |
--------------------------------------------------------------------------------
/02/app/page.tsx:
--------------------------------------------------------------------------------
1 | export default function Home() {
2 | return (
3 |
4 | Hello React
5 |
6 | )
7 | }
8 |
--------------------------------------------------------------------------------
/20/doc.md:
--------------------------------------------------------------------------------
1 | You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.
2 |
3 | 请使用 js 和 azure openai sdk 实现对话生成
4 |
5 | 鲁迅为什么暴打周树人
6 |
--------------------------------------------------------------------------------
/02/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return
{children}
7 | }
8 |
--------------------------------------------------------------------------------
/03/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return {children}
7 | }
8 |
--------------------------------------------------------------------------------
/04/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return {children}
7 | }
8 |
--------------------------------------------------------------------------------
/05/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return {children}
7 | }
8 |
--------------------------------------------------------------------------------
/06/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return {children}
7 | }
8 |
--------------------------------------------------------------------------------
/07/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return {children}
7 | }
8 |
--------------------------------------------------------------------------------
/08/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return {children}
7 | }
8 |
--------------------------------------------------------------------------------
/09/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return {children}
7 | }
8 |
--------------------------------------------------------------------------------
/10/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return {children}
7 | }
8 |
--------------------------------------------------------------------------------
/11/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return {children}
7 | }
8 |
--------------------------------------------------------------------------------
/12/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return {children}
7 | }
8 |
--------------------------------------------------------------------------------
/13/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return {children}
7 | }
8 |
--------------------------------------------------------------------------------
/14/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return {children}
7 | }
8 |
--------------------------------------------------------------------------------
/15/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return {children}
7 | }
8 |
--------------------------------------------------------------------------------
/16/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return {children}
7 | }
8 |
--------------------------------------------------------------------------------
/17/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return {children}
7 | }
8 |
--------------------------------------------------------------------------------
/18/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return {children}
7 | }
8 |
--------------------------------------------------------------------------------
/19/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return {children}
7 | }
8 |
--------------------------------------------------------------------------------
/20/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return {children}
7 | }
8 |
--------------------------------------------------------------------------------
/21/app/chat/layout.tsx:
--------------------------------------------------------------------------------
1 | export default function RootLayout({
2 | children
3 | }: {
4 | children: React.ReactNode
5 | }) {
6 | return {children}
7 | }
8 |
--------------------------------------------------------------------------------
/12/app/api/test/route.ts:
--------------------------------------------------------------------------------
1 | import { NextRequest, NextResponse } from "next/server";
2 |
3 | export async function GET(request: NextRequest) {
4 | const { url } = request
5 | return NextResponse.json({ url })
6 | }
--------------------------------------------------------------------------------
/13/app/api/test/route.ts:
--------------------------------------------------------------------------------
1 | import { NextRequest, NextResponse } from "next/server";
2 |
3 | export async function GET(request: NextRequest) {
4 | const { url } = request
5 | return NextResponse.json({ url })
6 | }
--------------------------------------------------------------------------------
/14/app/api/test/route.ts:
--------------------------------------------------------------------------------
1 | import { NextRequest, NextResponse } from "next/server";
2 |
3 | export async function GET(request: NextRequest) {
4 | const { url } = request
5 | return NextResponse.json({ url })
6 | }
--------------------------------------------------------------------------------
/15/app/api/test/route.ts:
--------------------------------------------------------------------------------
1 | import { NextRequest, NextResponse } from "next/server";
2 |
3 | export async function GET(request: NextRequest) {
4 | const { url } = request
5 | return NextResponse.json({ url })
6 | }
--------------------------------------------------------------------------------
/16/app/api/test/route.ts:
--------------------------------------------------------------------------------
1 | import { NextRequest, NextResponse } from "next/server";
2 |
3 | export async function GET(request: NextRequest) {
4 | const { url } = request
5 | return NextResponse.json({ url })
6 | }
--------------------------------------------------------------------------------
/17/app/api/test/route.ts:
--------------------------------------------------------------------------------
1 | import { NextRequest, NextResponse } from "next/server";
2 |
3 | export async function GET(request: NextRequest) {
4 | const { url } = request
5 | return NextResponse.json({ url })
6 | }
--------------------------------------------------------------------------------
/18/app/api/test/route.ts:
--------------------------------------------------------------------------------
1 | import { NextRequest, NextResponse } from "next/server";
2 |
3 | export async function GET(request: NextRequest) {
4 | const { url } = request
5 | return NextResponse.json({ url })
6 | }
--------------------------------------------------------------------------------
/19/app/api/test/route.ts:
--------------------------------------------------------------------------------
1 | import { NextRequest, NextResponse } from "next/server";
2 |
3 | export async function GET(request: NextRequest) {
4 | const { url } = request
5 | return NextResponse.json({ url })
6 | }
--------------------------------------------------------------------------------
/20/app/api/test/route.ts:
--------------------------------------------------------------------------------
1 | import { NextRequest, NextResponse } from "next/server";
2 |
3 | export async function GET(request: NextRequest) {
4 | const { url } = request
5 | return NextResponse.json({ url })
6 | }
--------------------------------------------------------------------------------
/21/app/api/test/route.ts:
--------------------------------------------------------------------------------
1 | import { NextRequest, NextResponse } from "next/server";
2 |
3 | export async function GET(request: NextRequest) {
4 | const { url } = request
5 | return NextResponse.json({ url })
6 | }
--------------------------------------------------------------------------------
/04/components/home/Main.tsx:
--------------------------------------------------------------------------------
1 | export default function Main() {
2 | return (
3 |
4 | 主体内容
5 |
6 | )
7 | }
8 |
--------------------------------------------------------------------------------
/11/types/chat.d.ts:
--------------------------------------------------------------------------------
1 | export interface Chat {
2 | id: string
3 | title: string
4 | updateTime: number
5 | }
6 |
7 | export interface Message {
8 | id: string
9 | role: "user" | "assistant"
10 | content: string
11 | }
--------------------------------------------------------------------------------
/12/types/chat.d.ts:
--------------------------------------------------------------------------------
1 | export interface Chat {
2 | id: string
3 | title: string
4 | updateTime: number
5 | }
6 |
7 | export interface Message {
8 | id: string
9 | role: "user" | "assistant"
10 | content: string
11 | }
--------------------------------------------------------------------------------
/20/lib/openai.ts:
--------------------------------------------------------------------------------
1 | import { OpenAIClient, AzureKeyCredential } from "@azure/openai";
2 |
3 | const client = new OpenAIClient(
4 | process.env.AZURE_ENDPOINT!,
5 | new AzureKeyCredential(process.env.AZURE_API_KEY!)
6 | );
7 |
8 | export default client
--------------------------------------------------------------------------------
/21/lib/openai.ts:
--------------------------------------------------------------------------------
1 | import { OpenAIClient, AzureKeyCredential } from "@azure/openai";
2 |
3 | const client = new OpenAIClient(
4 | process.env.AZURE_ENDPOINT!,
5 | new AzureKeyCredential(process.env.AZURE_API_KEY!)
6 | );
7 |
8 | export default client
--------------------------------------------------------------------------------
/05/components/home/Main/index.tsx:
--------------------------------------------------------------------------------
1 | import Menu from "./Menu"
2 |
3 | export default function Main() {
4 | return (
5 |
6 |
7 |
8 | )
9 | }
10 |
--------------------------------------------------------------------------------
/06/components/home/Main/index.tsx:
--------------------------------------------------------------------------------
1 | import Menu from "./Menu"
2 |
3 | export default function Main() {
4 | return (
5 |
6 |
7 |
8 | )
9 | }
10 |
--------------------------------------------------------------------------------
/07/components/home/Main/index.tsx:
--------------------------------------------------------------------------------
1 | import Menu from "./Menu"
2 |
3 | export default function Main() {
4 | return (
5 |
6 |
7 |
8 | )
9 | }
10 |
--------------------------------------------------------------------------------
/08/components/home/Main/index.tsx:
--------------------------------------------------------------------------------
1 | import Menu from "./Menu"
2 |
3 | export default function Main() {
4 | return (
5 |
6 |
7 |
8 | )
9 | }
10 |
--------------------------------------------------------------------------------
/04/components/home/Navigation.tsx:
--------------------------------------------------------------------------------
1 | import Button from "@/components/common/Button"
2 |
3 | export default function Navigation() {
4 | return (
5 |
8 | )
9 | }
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # React 入门实战教程
2 |
3 | 本课程我们将学习 React 的基础知识, React 是目前最流行的 JavaScript 库,使用 React 可以高效的开发 Web 前端项目,这门课程我们采用边学边开发的模式,通过一个类似 ChatGPT 前端的实战项目来学习 React 基础知识,除了 React 的基础知识以外,还包括 Next.js 和 tailwindcss 等框架的使用。在学习这个课程之前需要先学习 HTML 和 CSS 以及 JavaScript,如果你还没学习过这些内容,可以查看我们的 HTML 和 CSS 入门教程以及 JavaScript 基础教程。
4 |
--------------------------------------------------------------------------------
/02/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/03/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/04/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/05/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/06/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/07/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/08/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/09/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/10/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/11/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/12/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/13/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/14/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/15/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/16/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/17/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/18/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/19/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/20/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/21/app/chat/page.tsx:
--------------------------------------------------------------------------------
1 | import { Metadata } from "next"
2 |
3 | export const metadata: Metadata = {
4 | title: "Chat"
5 | }
6 |
7 | export default function Chat() {
8 | return (
9 |
10 | Chat
11 |
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/04/app/page.tsx:
--------------------------------------------------------------------------------
1 | import Navigation from "@/components/home/Navigation"
2 | import Main from "@/components/home/Main"
3 |
4 | export default function Home() {
5 | return (
6 |
7 |
8 |
9 |
10 | )
11 | }
12 |
--------------------------------------------------------------------------------
/13/types/chat.d.ts:
--------------------------------------------------------------------------------
1 | export interface Chat {
2 | id: string
3 | title: string
4 | updateTime: number
5 | }
6 |
7 | export interface Message {
8 | id: string
9 | role: "user" | "assistant"
10 | content: string
11 | }
12 |
13 | export interface MessageRequestBody {
14 | messages: Message[]
15 | model: string
16 | }
--------------------------------------------------------------------------------
/14/types/chat.d.ts:
--------------------------------------------------------------------------------
1 | export interface Chat {
2 | id: string
3 | title: string
4 | updateTime: number
5 | }
6 |
7 | export interface Message {
8 | id: string
9 | role: "user" | "assistant"
10 | content: string
11 | }
12 |
13 | export interface MessageRequestBody {
14 | messages: Message[]
15 | model: string
16 | }
--------------------------------------------------------------------------------
/15/types/chat.d.ts:
--------------------------------------------------------------------------------
1 | export interface Chat {
2 | id: string
3 | title: string
4 | updateTime: number
5 | }
6 |
7 | export interface Message {
8 | id: string
9 | role: "user" | "assistant"
10 | content: string
11 | chatId: string
12 | }
13 |
14 | export interface MessageRequestBody {
15 | messages: Message[]
16 | model: string
17 | }
--------------------------------------------------------------------------------
/16/types/chat.d.ts:
--------------------------------------------------------------------------------
1 | export interface Chat {
2 | id: string
3 | title: string
4 | updateTime: number
5 | }
6 |
7 | export interface Message {
8 | id: string
9 | role: "user" | "assistant"
10 | content: string
11 | chatId: string
12 | }
13 |
14 | export interface MessageRequestBody {
15 | messages: Message[]
16 | model: string
17 | }
--------------------------------------------------------------------------------
/17/types/chat.d.ts:
--------------------------------------------------------------------------------
1 | export interface Chat {
2 | id: string
3 | title: string
4 | updateTime: number
5 | }
6 |
7 | export interface Message {
8 | id: string
9 | role: "user" | "assistant"
10 | content: string
11 | chatId: string
12 | }
13 |
14 | export interface MessageRequestBody {
15 | messages: Message[]
16 | model: string
17 | }
--------------------------------------------------------------------------------
/18/types/chat.d.ts:
--------------------------------------------------------------------------------
1 | export interface Chat {
2 | id: string
3 | title: string
4 | updateTime: number
5 | }
6 |
7 | export interface Message {
8 | id: string
9 | role: "user" | "assistant"
10 | content: string
11 | chatId: string
12 | }
13 |
14 | export interface MessageRequestBody {
15 | messages: Message[]
16 | model: string
17 | }
--------------------------------------------------------------------------------
/19/types/chat.d.ts:
--------------------------------------------------------------------------------
1 | export interface Chat {
2 | id: string
3 | title: string
4 | updateTime: number
5 | }
6 |
7 | export interface Message {
8 | id: string
9 | role: "user" | "assistant"
10 | content: string
11 | chatId: string
12 | }
13 |
14 | export interface MessageRequestBody {
15 | messages: Message[]
16 | model: string
17 | }
--------------------------------------------------------------------------------
/20/types/chat.d.ts:
--------------------------------------------------------------------------------
1 | export interface Chat {
2 | id: string
3 | title: string
4 | updateTime: number
5 | }
6 |
7 | export interface Message {
8 | id: string
9 | role: "user" | "assistant"
10 | content: string
11 | chatId: string
12 | }
13 |
14 | export interface MessageRequestBody {
15 | messages: Message[]
16 | model: string
17 | }
--------------------------------------------------------------------------------
/21/types/chat.d.ts:
--------------------------------------------------------------------------------
1 | export interface Chat {
2 | id: string
3 | title: string
4 | updateTime: number
5 | }
6 |
7 | export interface Message {
8 | id: string
9 | role: "user" | "assistant"
10 | content: string
11 | chatId: string
12 | }
13 |
14 | export interface MessageRequestBody {
15 | messages: Message[]
16 | model: string
17 | }
--------------------------------------------------------------------------------
/05/doc.md:
--------------------------------------------------------------------------------
1 | default: text-black dark:text-gray-300 bg-gray-50 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-900
2 |
3 | outline: border border-gray-300 dark:border-gray-600 text-black dark:text-gray-300 bg-gray-50 hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700
4 |
5 | text: text-black dark:text-gray-300 bg-transparent hover:bg-gray-200 dark:hover:bg-gray-700
6 |
--------------------------------------------------------------------------------
/06/doc.md:
--------------------------------------------------------------------------------
1 | default: text-black dark:text-gray-300 bg-gray-50 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-900
2 |
3 | outline: border border-gray-300 dark:border-gray-600 text-black dark:text-gray-300 bg-gray-50 hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700
4 |
5 | text: text-black dark:text-gray-300 bg-transparent hover:bg-gray-200 dark:hover:bg-gray-700
6 |
--------------------------------------------------------------------------------
/09/components/home/Main/index.tsx:
--------------------------------------------------------------------------------
1 | import Menu from "./Menu"
2 | import Welcome from "./Welcome"
3 |
4 | export default function Main() {
5 | return (
6 |
7 |
8 |
9 |
10 | )
11 | }
12 |
--------------------------------------------------------------------------------
/01/app/page.tsx:
--------------------------------------------------------------------------------
1 | import Image from "next/image"
2 | import React from "react"
3 |
4 | export default function Home() {
5 | return (
6 |
7 | Hello React
8 | {React.createElement("h1", null, "Hello React!!!")}
9 |
10 | )
11 | }
12 |
--------------------------------------------------------------------------------
/04/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | darkMode: "class",
4 | content: [
5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}",
6 | "./components/**/*.{js,ts,jsx,tsx,mdx}",
7 | "./app/**/*.{js,ts,jsx,tsx,mdx}"
8 | ],
9 | theme: {
10 | extend: {}
11 | },
12 | plugins: []
13 | }
14 |
--------------------------------------------------------------------------------
/05/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | darkMode: "class",
4 | content: [
5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}",
6 | "./components/**/*.{js,ts,jsx,tsx,mdx}",
7 | "./app/**/*.{js,ts,jsx,tsx,mdx}"
8 | ],
9 | theme: {
10 | extend: {}
11 | },
12 | plugins: []
13 | }
14 |
--------------------------------------------------------------------------------
/06/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | darkMode: "class",
4 | content: [
5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}",
6 | "./components/**/*.{js,ts,jsx,tsx,mdx}",
7 | "./app/**/*.{js,ts,jsx,tsx,mdx}"
8 | ],
9 | theme: {
10 | extend: {}
11 | },
12 | plugins: []
13 | }
14 |
--------------------------------------------------------------------------------
/07/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | darkMode: "class",
4 | content: [
5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}",
6 | "./components/**/*.{js,ts,jsx,tsx,mdx}",
7 | "./app/**/*.{js,ts,jsx,tsx,mdx}"
8 | ],
9 | theme: {
10 | extend: {}
11 | },
12 | plugins: []
13 | }
14 |
--------------------------------------------------------------------------------
/08/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | darkMode: "class",
4 | content: [
5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}",
6 | "./components/**/*.{js,ts,jsx,tsx,mdx}",
7 | "./app/**/*.{js,ts,jsx,tsx,mdx}"
8 | ],
9 | theme: {
10 | extend: {}
11 | },
12 | plugins: []
13 | }
14 |
--------------------------------------------------------------------------------
/09/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | darkMode: "class",
4 | content: [
5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}",
6 | "./components/**/*.{js,ts,jsx,tsx,mdx}",
7 | "./app/**/*.{js,ts,jsx,tsx,mdx}"
8 | ],
9 | theme: {
10 | extend: {}
11 | },
12 | plugins: []
13 | }
14 |
--------------------------------------------------------------------------------
/19/app/api/chat/update/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function POST(request: NextRequest) {
5 | const body = await request.json()
6 | const { id, ...data } = body
7 | await prisma.chat.update({
8 | data,
9 | where: {
10 | id
11 | }
12 | })
13 | return NextResponse.json({ code: 0 })
14 | }
--------------------------------------------------------------------------------
/20/app/api/chat/update/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function POST(request: NextRequest) {
5 | const body = await request.json()
6 | const { id, ...data } = body
7 | await prisma.chat.update({
8 | data,
9 | where: {
10 | id
11 | }
12 | })
13 | return NextResponse.json({ code: 0 })
14 | }
--------------------------------------------------------------------------------
/21/app/api/chat/update/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function POST(request: NextRequest) {
5 | const body = await request.json()
6 | const { id, ...data } = body
7 | await prisma.chat.update({
8 | data,
9 | where: {
10 | id
11 | }
12 | })
13 | return NextResponse.json({ code: 0 })
14 | }
--------------------------------------------------------------------------------
/04/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import "./globals.css"
2 | import type { Metadata } from "next"
3 |
4 | export const metadata: Metadata = {
5 | title: "Create Next App",
6 | description: "Generated by create next app"
7 | }
8 |
9 | export default function RootLayout({
10 | children
11 | }: {
12 | children: React.ReactNode
13 | }) {
14 | return (
15 |
16 | {children}
17 |
18 | )
19 | }
20 |
--------------------------------------------------------------------------------
/16/app/api/message/delete/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function POST(request: NextRequest) {
5 | const id = request.nextUrl.searchParams.get("id")
6 | if (!id) {
7 | return NextResponse.json({ code: -1 })
8 | }
9 | await prisma.message.delete({
10 | where: {
11 | id
12 | }
13 | })
14 | return NextResponse.json({ code: 0 })
15 | }
--------------------------------------------------------------------------------
/17/app/api/message/delete/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function POST(request: NextRequest) {
5 | const id = request.nextUrl.searchParams.get("id")
6 | if (!id) {
7 | return NextResponse.json({ code: -1 })
8 | }
9 | await prisma.message.delete({
10 | where: {
11 | id
12 | }
13 | })
14 | return NextResponse.json({ code: 0 })
15 | }
--------------------------------------------------------------------------------
/18/app/api/message/delete/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function POST(request: NextRequest) {
5 | const id = request.nextUrl.searchParams.get("id")
6 | if (!id) {
7 | return NextResponse.json({ code: -1 })
8 | }
9 | await prisma.message.delete({
10 | where: {
11 | id
12 | }
13 | })
14 | return NextResponse.json({ code: 0 })
15 | }
--------------------------------------------------------------------------------
/19/app/api/message/delete/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function POST(request: NextRequest) {
5 | const id = request.nextUrl.searchParams.get("id")
6 | if (!id) {
7 | return NextResponse.json({ code: -1 })
8 | }
9 | await prisma.message.delete({
10 | where: {
11 | id
12 | }
13 | })
14 | return NextResponse.json({ code: 0 })
15 | }
--------------------------------------------------------------------------------
/20/app/api/message/delete/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function POST(request: NextRequest) {
5 | const id = request.nextUrl.searchParams.get("id")
6 | if (!id) {
7 | return NextResponse.json({ code: -1 })
8 | }
9 | await prisma.message.delete({
10 | where: {
11 | id
12 | }
13 | })
14 | return NextResponse.json({ code: 0 })
15 | }
--------------------------------------------------------------------------------
/21/app/api/message/delete/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function POST(request: NextRequest) {
5 | const id = request.nextUrl.searchParams.get("id")
6 | if (!id) {
7 | return NextResponse.json({ code: -1 })
8 | }
9 | await prisma.message.delete({
10 | where: {
11 | id
12 | }
13 | })
14 | return NextResponse.json({ code: 0 })
15 | }
--------------------------------------------------------------------------------
/05/app/page.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import Navigation from "@/components/home/Navigation"
4 | import Main from "@/components/home/Main"
5 | import { useAppContext } from "@/components/AppContext"
6 |
7 | export default function Home() {
8 | const {
9 | state: { themeMode }
10 | } = useAppContext()
11 | return (
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/06/app/page.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import Navigation from "@/components/home/Navigation"
4 | import Main from "@/components/home/Main"
5 | import { useAppContext } from "@/components/AppContext"
6 |
7 | export default function Home() {
8 | const {
9 | state: { themeMode }
10 | } = useAppContext()
11 | return (
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/07/app/page.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import Navigation from "@/components/home/Navigation"
4 | import Main from "@/components/home/Main"
5 | import { useAppContext } from "@/components/AppContext"
6 |
7 | export default function Home() {
8 | const {
9 | state: { themeMode }
10 | } = useAppContext()
11 | return (
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/08/app/page.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import Navigation from "@/components/home/Navigation"
4 | import Main from "@/components/home/Main"
5 | import { useAppContext } from "@/components/AppContext"
6 |
7 | export default function Home() {
8 | const {
9 | state: { themeMode }
10 | } = useAppContext()
11 | return (
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/09/app/page.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import Navigation from "@/components/home/Navigation"
4 | import Main from "@/components/home/Main"
5 | import { useAppContext } from "@/components/AppContext"
6 |
7 | export default function Home() {
8 | const {
9 | state: { themeMode }
10 | } = useAppContext()
11 | return (
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/10/app/page.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import Navigation from "@/components/home/Navigation"
4 | import Main from "@/components/home/Main"
5 | import { useAppContext } from "@/components/AppContext"
6 |
7 | export default function Home() {
8 | const {
9 | state: { themeMode }
10 | } = useAppContext()
11 | return (
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/11/app/page.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import Navigation from "@/components/home/Navigation"
4 | import Main from "@/components/home/Main"
5 | import { useAppContext } from "@/components/AppContext"
6 |
7 | export default function Home() {
8 | const {
9 | state: { themeMode }
10 | } = useAppContext()
11 | return (
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/12/app/page.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import Navigation from "@/components/home/Navigation"
4 | import Main from "@/components/home/Main"
5 | import { useAppContext } from "@/components/AppContext"
6 |
7 | export default function Home() {
8 | const {
9 | state: { themeMode }
10 | } = useAppContext()
11 | return (
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/13/app/page.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import Navigation from "@/components/home/Navigation"
4 | import Main from "@/components/home/Main"
5 | import { useAppContext } from "@/components/AppContext"
6 |
7 | export default function Home() {
8 | const {
9 | state: { themeMode }
10 | } = useAppContext()
11 | return (
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/14/app/page.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import Navigation from "@/components/home/Navigation"
4 | import Main from "@/components/home/Main"
5 | import { useAppContext } from "@/components/AppContext"
6 |
7 | export default function Home() {
8 | const {
9 | state: { themeMode }
10 | } = useAppContext()
11 | return (
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/15/app/page.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import Navigation from "@/components/home/Navigation"
4 | import Main from "@/components/home/Main"
5 | import { useAppContext } from "@/components/AppContext"
6 |
7 | export default function Home() {
8 | const {
9 | state: { themeMode }
10 | } = useAppContext()
11 | return (
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/16/app/page.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import Navigation from "@/components/home/Navigation"
4 | import Main from "@/components/home/Main"
5 | import { useAppContext } from "@/components/AppContext"
6 |
7 | export default function Home() {
8 | const {
9 | state: { themeMode }
10 | } = useAppContext()
11 | return (
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/17/app/page.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import Navigation from "@/components/home/Navigation"
4 | import Main from "@/components/home/Main"
5 | import { useAppContext } from "@/components/AppContext"
6 |
7 | export default function Home() {
8 | const {
9 | state: { themeMode }
10 | } = useAppContext()
11 | return (
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/18/app/page.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import Navigation from "@/components/home/Navigation"
4 | import Main from "@/components/home/Main"
5 | import { useAppContext } from "@/components/AppContext"
6 |
7 | export default function Home() {
8 | const {
9 | state: { themeMode }
10 | } = useAppContext()
11 | return (
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/19/app/page.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import Navigation from "@/components/home/Navigation"
4 | import Main from "@/components/home/Main"
5 | import { useAppContext } from "@/components/AppContext"
6 |
7 | export default function Home() {
8 | const {
9 | state: { themeMode }
10 | } = useAppContext()
11 | return (
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/20/app/page.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import Navigation from "@/components/home/Navigation"
4 | import Main from "@/components/home/Main"
5 | import { useAppContext } from "@/components/AppContext"
6 |
7 | export default function Home() {
8 | const {
9 | state: { themeMode }
10 | } = useAppContext()
11 | return (
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/21/app/page.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import Navigation from "@/components/home/Navigation"
4 | import Main from "@/components/home/Main"
5 | import { useAppContext } from "@/components/AppContext"
6 |
7 | export default function Home() {
8 | const {
9 | state: { themeMode }
10 | } = useAppContext()
11 | return (
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/04/components/common/Button.tsx:
--------------------------------------------------------------------------------
1 | import { ComponentPropsWithoutRef } from "react"
2 |
3 | export default function Button({
4 | children,
5 | className,
6 | ...props
7 | }: ComponentPropsWithoutRef<"button">) {
8 | return (
9 |
15 | )
16 | }
17 |
--------------------------------------------------------------------------------
/02/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import "./globals.css"
2 | import type { Metadata } from "next"
3 |
4 | export const metadata: Metadata = {
5 | title: "Create Next App",
6 | description: "Generated by create next app"
7 | }
8 |
9 | export default function RootLayout({
10 | children
11 | }: {
12 | children: React.ReactNode
13 | }) {
14 | return (
15 |
16 | {children}
17 |
18 | )
19 | }
20 |
--------------------------------------------------------------------------------
/03/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import "./globals.css"
2 | import type { Metadata } from "next"
3 |
4 | export const metadata: Metadata = {
5 | title: "Create Next App",
6 | description: "Generated by create next app"
7 | }
8 |
9 | export default function RootLayout({
10 | children
11 | }: {
12 | children: React.ReactNode
13 | }) {
14 | return (
15 |
16 | {children}
17 |
18 | )
19 | }
20 |
--------------------------------------------------------------------------------
/09/components/home/Main/Welcome.tsx:
--------------------------------------------------------------------------------
1 | import Example from "./Example"
2 | import ModelSelect from "./ModelSelect"
3 |
4 | export default function Welcome() {
5 | return (
6 |
7 |
8 |
9 | ChatGPT免费使用 - GPT4 & GPT3.5-turo
10 |
11 |
12 |
13 | )
14 | }
15 |
--------------------------------------------------------------------------------
/10/components/home/Main/Welcome.tsx:
--------------------------------------------------------------------------------
1 | import Example from "./Example"
2 | import ModelSelect from "./ModelSelect"
3 |
4 | export default function Welcome() {
5 | return (
6 |
7 |
8 |
9 | ChatGPT免费使用 - GPT4 & GPT3.5-turo
10 |
11 |
12 |
13 | )
14 | }
15 |
--------------------------------------------------------------------------------
/11/components/home/Main/Welcome.tsx:
--------------------------------------------------------------------------------
1 | import Example from "./Example"
2 | import ModelSelect from "./ModelSelect"
3 |
4 | export default function Welcome() {
5 | return (
6 |
7 |
8 |
9 | ChatGPT免费使用 - GPT4 & GPT3.5-turo
10 |
11 |
12 |
13 | )
14 | }
15 |
--------------------------------------------------------------------------------
/12/components/home/Main/Welcome.tsx:
--------------------------------------------------------------------------------
1 | import Example from "./Example"
2 | import ModelSelect from "./ModelSelect"
3 |
4 | export default function Welcome() {
5 | return (
6 |
7 |
8 |
9 | ChatGPT免费使用 - GPT4 & GPT3.5-turo
10 |
11 |
12 |
13 | )
14 | }
15 |
--------------------------------------------------------------------------------
/13/components/home/Main/Welcome.tsx:
--------------------------------------------------------------------------------
1 | import Example from "./Example"
2 | import ModelSelect from "./ModelSelect"
3 |
4 | export default function Welcome() {
5 | return (
6 |
7 |
8 |
9 | ChatGPT免费使用 - GPT4 & GPT3.5-turo
10 |
11 |
12 |
13 | )
14 | }
15 |
--------------------------------------------------------------------------------
/14/components/home/Main/Welcome.tsx:
--------------------------------------------------------------------------------
1 | import Example from "./Example"
2 | import ModelSelect from "./ModelSelect"
3 |
4 | export default function Welcome() {
5 | return (
6 |
7 |
8 |
9 | ChatGPT免费使用 - GPT4 & GPT3.5-turo
10 |
11 |
12 |
13 | )
14 | }
15 |
--------------------------------------------------------------------------------
/15/components/home/Main/Welcome.tsx:
--------------------------------------------------------------------------------
1 | import Example from "./Example"
2 | import ModelSelect from "./ModelSelect"
3 |
4 | export default function Welcome() {
5 | return (
6 |
7 |
8 |
9 | ChatGPT免费使用 - GPT4 & GPT3.5-turo
10 |
11 |
12 |
13 | )
14 | }
15 |
--------------------------------------------------------------------------------
/16/components/home/Main/Welcome.tsx:
--------------------------------------------------------------------------------
1 | import Example from "./Example"
2 | import ModelSelect from "./ModelSelect"
3 |
4 | export default function Welcome() {
5 | return (
6 |
7 |
8 |
9 | ChatGPT免费使用 - GPT4 & GPT3.5-turo
10 |
11 |
12 |
13 | )
14 | }
15 |
--------------------------------------------------------------------------------
/17/components/home/Main/Welcome.tsx:
--------------------------------------------------------------------------------
1 | import Example from "./Example"
2 | import ModelSelect from "./ModelSelect"
3 |
4 | export default function Welcome() {
5 | return (
6 |
7 |
8 |
9 | ChatGPT免费使用 - GPT4 & GPT3.5-turo
10 |
11 |
12 |
13 | )
14 | }
15 |
--------------------------------------------------------------------------------
/18/components/home/Main/Welcome.tsx:
--------------------------------------------------------------------------------
1 | import Example from "./Example"
2 | import ModelSelect from "./ModelSelect"
3 |
4 | export default function Welcome() {
5 | return (
6 |
7 |
8 |
9 | ChatGPT免费使用 - GPT4 & GPT3.5-turo
10 |
11 |
12 |
13 | )
14 | }
15 |
--------------------------------------------------------------------------------
/19/components/home/Main/Welcome.tsx:
--------------------------------------------------------------------------------
1 | import Example from "./Example"
2 | import ModelSelect from "./ModelSelect"
3 |
4 | export default function Welcome() {
5 | return (
6 |
7 |
8 |
9 | ChatGPT免费使用 - GPT4 & GPT3.5-turo
10 |
11 |
12 |
13 | )
14 | }
15 |
--------------------------------------------------------------------------------
/20/components/home/Main/Welcome.tsx:
--------------------------------------------------------------------------------
1 | import Example from "./Example"
2 | import ModelSelect from "./ModelSelect"
3 |
4 | export default function Welcome() {
5 | return (
6 |
7 |
8 |
9 | ChatGPT免费使用 - GPT4 & GPT3.5-turo
10 |
11 |
12 |
13 | )
14 | }
15 |
--------------------------------------------------------------------------------
/21/components/home/Main/Welcome.tsx:
--------------------------------------------------------------------------------
1 | import Example from "./Example"
2 | import ModelSelect from "./ModelSelect"
3 |
4 | export default function Welcome() {
5 | return (
6 |
7 |
8 |
9 | ChatGPT免费使用 - GPT4 & GPT3.5-turo
10 |
11 |
12 |
13 | )
14 | }
15 |
--------------------------------------------------------------------------------
/10/components/home/Main/index.tsx:
--------------------------------------------------------------------------------
1 | import ChatInput from "./ChatInput"
2 | import Menu from "./Menu"
3 | import Welcome from "./Welcome"
4 |
5 | export default function Main() {
6 | return (
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | )
15 | }
16 |
--------------------------------------------------------------------------------
/15/lib/prisma.ts:
--------------------------------------------------------------------------------
1 | import { PrismaClient } from "@prisma/client"
2 |
3 | const prismaClientSingleton = () => {
4 | return new PrismaClient()
5 | }
6 |
7 | type PrismaClientSingleton = ReturnType
8 |
9 | const globalForPrisma = globalThis as unknown as {
10 | prisma: PrismaClientSingleton | undefined
11 | }
12 |
13 | const prisma = globalForPrisma.prisma ?? prismaClientSingleton()
14 |
15 | export default prisma
16 |
17 | if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma
--------------------------------------------------------------------------------
/16/lib/prisma.ts:
--------------------------------------------------------------------------------
1 | import { PrismaClient } from "@prisma/client"
2 |
3 | const prismaClientSingleton = () => {
4 | return new PrismaClient()
5 | }
6 |
7 | type PrismaClientSingleton = ReturnType
8 |
9 | const globalForPrisma = globalThis as unknown as {
10 | prisma: PrismaClientSingleton | undefined
11 | }
12 |
13 | const prisma = globalForPrisma.prisma ?? prismaClientSingleton()
14 |
15 | export default prisma
16 |
17 | if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma
--------------------------------------------------------------------------------
/17/lib/prisma.ts:
--------------------------------------------------------------------------------
1 | import { PrismaClient } from "@prisma/client"
2 |
3 | const prismaClientSingleton = () => {
4 | return new PrismaClient()
5 | }
6 |
7 | type PrismaClientSingleton = ReturnType
8 |
9 | const globalForPrisma = globalThis as unknown as {
10 | prisma: PrismaClientSingleton | undefined
11 | }
12 |
13 | const prisma = globalForPrisma.prisma ?? prismaClientSingleton()
14 |
15 | export default prisma
16 |
17 | if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma
--------------------------------------------------------------------------------
/18/lib/prisma.ts:
--------------------------------------------------------------------------------
1 | import { PrismaClient } from "@prisma/client"
2 |
3 | const prismaClientSingleton = () => {
4 | return new PrismaClient()
5 | }
6 |
7 | type PrismaClientSingleton = ReturnType
8 |
9 | const globalForPrisma = globalThis as unknown as {
10 | prisma: PrismaClientSingleton | undefined
11 | }
12 |
13 | const prisma = globalForPrisma.prisma ?? prismaClientSingleton()
14 |
15 | export default prisma
16 |
17 | if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma
--------------------------------------------------------------------------------
/19/lib/prisma.ts:
--------------------------------------------------------------------------------
1 | import { PrismaClient } from "@prisma/client"
2 |
3 | const prismaClientSingleton = () => {
4 | return new PrismaClient()
5 | }
6 |
7 | type PrismaClientSingleton = ReturnType
8 |
9 | const globalForPrisma = globalThis as unknown as {
10 | prisma: PrismaClientSingleton | undefined
11 | }
12 |
13 | const prisma = globalForPrisma.prisma ?? prismaClientSingleton()
14 |
15 | export default prisma
16 |
17 | if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma
--------------------------------------------------------------------------------
/20/lib/prisma.ts:
--------------------------------------------------------------------------------
1 | import { PrismaClient } from "@prisma/client"
2 |
3 | const prismaClientSingleton = () => {
4 | return new PrismaClient()
5 | }
6 |
7 | type PrismaClientSingleton = ReturnType
8 |
9 | const globalForPrisma = globalThis as unknown as {
10 | prisma: PrismaClientSingleton | undefined
11 | }
12 |
13 | const prisma = globalForPrisma.prisma ?? prismaClientSingleton()
14 |
15 | export default prisma
16 |
17 | if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma
--------------------------------------------------------------------------------
/21/lib/prisma.ts:
--------------------------------------------------------------------------------
1 | import { PrismaClient } from "@prisma/client"
2 |
3 | const prismaClientSingleton = () => {
4 | return new PrismaClient()
5 | }
6 |
7 | type PrismaClientSingleton = ReturnType
8 |
9 | const globalForPrisma = globalThis as unknown as {
10 | prisma: PrismaClientSingleton | undefined
11 | }
12 |
13 | const prisma = globalForPrisma.prisma ?? prismaClientSingleton()
14 |
15 | export default prisma
16 |
17 | if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma
--------------------------------------------------------------------------------
/01/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/02/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/03/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/04/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/05/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/06/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/07/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/08/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/09/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/10/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/11/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/12/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/13/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/13/doc.md:
--------------------------------------------------------------------------------
1 | ```javascript
2 | import { v4 as uuidv4 } from "uuid"
3 | ```
4 |
5 | ```shell
6 | npm i uuid
7 | npm i --save-dev @types/uuid
8 | ```
9 |
10 | 我们可以通过添加`mousemove`和`resize`事件监听器来持续更新元素的位置信息。以下是一个可行的策略:
11 |
12 | 1. 选取你需要监听的元素。
13 |
14 | ```javascript
15 | let element = document.getElementById("your-element-id")
16 | ```
17 |
18 | ▍
19 |
20 | ```
21 | transition-colors
22 |
23 | disabled:shadow-none disabled:bg-transparent disabled:text-gray-300 dark:disabled:text-gray-600
24 | ```
25 |
26 | ```
27 | PiStopBold
28 | ```
29 |
--------------------------------------------------------------------------------
/14/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/15/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/16/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/17/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/18/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/19/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/20/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/21/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env*.local
29 |
30 | # vercel
31 | .vercel
32 |
33 | # typescript
34 | *.tsbuildinfo
35 | next-env.d.ts
36 |
--------------------------------------------------------------------------------
/17/app/api/chat/list/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function GET(request: NextRequest) {
5 | const param = request.nextUrl.searchParams.get("page")
6 | const page = param ? parseInt(param) : 1
7 | const list = await prisma.chat.findMany({
8 | skip: (page - 1) * 20,
9 | take: 20,
10 | orderBy: {
11 | updateTime: "desc"
12 | }
13 | })
14 | return NextResponse.json({ code: 0, data: { list } })
15 | }
--------------------------------------------------------------------------------
/15/doc.md:
--------------------------------------------------------------------------------
1 | ```typescript
2 | import { PrismaClient } from "@prisma/client"
3 |
4 | const prismaClientSingleton = () => {
5 | return new PrismaClient()
6 | }
7 |
8 | type PrismaClientSingleton = ReturnType
9 |
10 | const globalForPrisma = globalThis as unknown as {
11 | prisma: PrismaClientSingleton | undefined
12 | }
13 |
14 | const prisma = globalForPrisma.prisma ?? prismaClientSingleton()
15 |
16 | export default prisma
17 |
18 | if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma
19 | ```
20 |
--------------------------------------------------------------------------------
/01/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | content: [
4 | './pages/**/*.{js,ts,jsx,tsx,mdx}',
5 | './components/**/*.{js,ts,jsx,tsx,mdx}',
6 | './app/**/*.{js,ts,jsx,tsx,mdx}',
7 | ],
8 | theme: {
9 | extend: {
10 | backgroundImage: {
11 | 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
12 | 'gradient-conic':
13 | 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
14 | },
15 | },
16 | },
17 | plugins: [],
18 | }
19 |
--------------------------------------------------------------------------------
/02/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | content: [
4 | './pages/**/*.{js,ts,jsx,tsx,mdx}',
5 | './components/**/*.{js,ts,jsx,tsx,mdx}',
6 | './app/**/*.{js,ts,jsx,tsx,mdx}',
7 | ],
8 | theme: {
9 | extend: {
10 | backgroundImage: {
11 | 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
12 | 'gradient-conic':
13 | 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
14 | },
15 | },
16 | },
17 | plugins: [],
18 | }
19 |
--------------------------------------------------------------------------------
/03/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | content: [
4 | './pages/**/*.{js,ts,jsx,tsx,mdx}',
5 | './components/**/*.{js,ts,jsx,tsx,mdx}',
6 | './app/**/*.{js,ts,jsx,tsx,mdx}',
7 | ],
8 | theme: {
9 | extend: {
10 | backgroundImage: {
11 | 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
12 | 'gradient-conic':
13 | 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
14 | },
15 | },
16 | },
17 | plugins: [],
18 | }
19 |
--------------------------------------------------------------------------------
/10/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | darkMode: "class",
4 | content: [
5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}",
6 | "./components/**/*.{js,ts,jsx,tsx,mdx}",
7 | "./app/**/*.{js,ts,jsx,tsx,mdx}"
8 | ],
9 | theme: {
10 | extend: {
11 | colors: {
12 | primary: {
13 | 500: "#00B981",
14 | 600: "#059669"
15 | }
16 | }
17 | }
18 | },
19 | plugins: []
20 | }
21 |
--------------------------------------------------------------------------------
/11/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | darkMode: "class",
4 | content: [
5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}",
6 | "./components/**/*.{js,ts,jsx,tsx,mdx}",
7 | "./app/**/*.{js,ts,jsx,tsx,mdx}"
8 | ],
9 | theme: {
10 | extend: {
11 | colors: {
12 | primary: {
13 | 500: "#00B981",
14 | 600: "#059669"
15 | }
16 | }
17 | }
18 | },
19 | plugins: []
20 | }
21 |
--------------------------------------------------------------------------------
/12/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | darkMode: "class",
4 | content: [
5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}",
6 | "./components/**/*.{js,ts,jsx,tsx,mdx}",
7 | "./app/**/*.{js,ts,jsx,tsx,mdx}"
8 | ],
9 | theme: {
10 | extend: {
11 | colors: {
12 | primary: {
13 | 500: "#00B981",
14 | 600: "#059669"
15 | }
16 | }
17 | }
18 | },
19 | plugins: []
20 | }
21 |
--------------------------------------------------------------------------------
/13/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | darkMode: "class",
4 | content: [
5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}",
6 | "./components/**/*.{js,ts,jsx,tsx,mdx}",
7 | "./app/**/*.{js,ts,jsx,tsx,mdx}"
8 | ],
9 | theme: {
10 | extend: {
11 | colors: {
12 | primary: {
13 | 500: "#00B981",
14 | 600: "#059669"
15 | }
16 | }
17 | }
18 | },
19 | plugins: []
20 | }
21 |
--------------------------------------------------------------------------------
/14/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | darkMode: "class",
4 | content: [
5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}",
6 | "./components/**/*.{js,ts,jsx,tsx,mdx}",
7 | "./app/**/*.{js,ts,jsx,tsx,mdx}"
8 | ],
9 | theme: {
10 | extend: {
11 | colors: {
12 | primary: {
13 | 500: "#00B981",
14 | 600: "#059669"
15 | }
16 | }
17 | }
18 | },
19 | plugins: []
20 | }
21 |
--------------------------------------------------------------------------------
/15/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | darkMode: "class",
4 | content: [
5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}",
6 | "./components/**/*.{js,ts,jsx,tsx,mdx}",
7 | "./app/**/*.{js,ts,jsx,tsx,mdx}"
8 | ],
9 | theme: {
10 | extend: {
11 | colors: {
12 | primary: {
13 | 500: "#00B981",
14 | 600: "#059669"
15 | }
16 | }
17 | }
18 | },
19 | plugins: []
20 | }
21 |
--------------------------------------------------------------------------------
/16/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | darkMode: "class",
4 | content: [
5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}",
6 | "./components/**/*.{js,ts,jsx,tsx,mdx}",
7 | "./app/**/*.{js,ts,jsx,tsx,mdx}"
8 | ],
9 | theme: {
10 | extend: {
11 | colors: {
12 | primary: {
13 | 500: "#00B981",
14 | 600: "#059669"
15 | }
16 | }
17 | }
18 | },
19 | plugins: []
20 | }
21 |
--------------------------------------------------------------------------------
/17/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | darkMode: "class",
4 | content: [
5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}",
6 | "./components/**/*.{js,ts,jsx,tsx,mdx}",
7 | "./app/**/*.{js,ts,jsx,tsx,mdx}"
8 | ],
9 | theme: {
10 | extend: {
11 | colors: {
12 | primary: {
13 | 500: "#00B981",
14 | 600: "#059669"
15 | }
16 | }
17 | }
18 | },
19 | plugins: []
20 | }
21 |
--------------------------------------------------------------------------------
/18/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | darkMode: "class",
4 | content: [
5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}",
6 | "./components/**/*.{js,ts,jsx,tsx,mdx}",
7 | "./app/**/*.{js,ts,jsx,tsx,mdx}"
8 | ],
9 | theme: {
10 | extend: {
11 | colors: {
12 | primary: {
13 | 500: "#00B981",
14 | 600: "#059669"
15 | }
16 | }
17 | }
18 | },
19 | plugins: []
20 | }
21 |
--------------------------------------------------------------------------------
/19/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | darkMode: "class",
4 | content: [
5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}",
6 | "./components/**/*.{js,ts,jsx,tsx,mdx}",
7 | "./app/**/*.{js,ts,jsx,tsx,mdx}"
8 | ],
9 | theme: {
10 | extend: {
11 | colors: {
12 | primary: {
13 | 500: "#00B981",
14 | 600: "#059669"
15 | }
16 | }
17 | }
18 | },
19 | plugins: []
20 | }
21 |
--------------------------------------------------------------------------------
/20/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | darkMode: "class",
4 | content: [
5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}",
6 | "./components/**/*.{js,ts,jsx,tsx,mdx}",
7 | "./app/**/*.{js,ts,jsx,tsx,mdx}"
8 | ],
9 | theme: {
10 | extend: {
11 | colors: {
12 | primary: {
13 | 500: "#00B981",
14 | 600: "#059669"
15 | }
16 | }
17 | }
18 | },
19 | plugins: []
20 | }
21 |
--------------------------------------------------------------------------------
/21/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | darkMode: "class",
4 | content: [
5 | "./pages/**/*.{js,ts,jsx,tsx,mdx}",
6 | "./components/**/*.{js,ts,jsx,tsx,mdx}",
7 | "./app/**/*.{js,ts,jsx,tsx,mdx}"
8 | ],
9 | theme: {
10 | extend: {
11 | colors: {
12 | primary: {
13 | 500: "#00B981",
14 | 600: "#059669"
15 | }
16 | }
17 | }
18 | },
19 | plugins: []
20 | }
21 |
--------------------------------------------------------------------------------
/01/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import './globals.css'
2 | import type { Metadata } from 'next'
3 | import { Inter } from 'next/font/google'
4 |
5 | const inter = Inter({ subsets: ['latin'] })
6 |
7 | export const metadata: Metadata = {
8 | title: 'Create Next App',
9 | description: 'Generated by create next app',
10 | }
11 |
12 | export default function RootLayout({
13 | children,
14 | }: {
15 | children: React.ReactNode
16 | }) {
17 | return (
18 |
19 | {children}
20 |
21 | )
22 | }
23 |
--------------------------------------------------------------------------------
/17/app/api/message/list/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function GET(request: NextRequest) {
5 | const chatId = request.nextUrl.searchParams.get("chatId")
6 | if (!chatId) {
7 | return NextResponse.json({ code: -1 })
8 | }
9 | const list = await prisma.message.findMany({
10 | where: {
11 | chatId
12 | },
13 | orderBy: {
14 | createTime: "desc"
15 | }
16 | })
17 | return NextResponse.json({ code: 0, data: { list } })
18 | }
--------------------------------------------------------------------------------
/18/app/api/message/list/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function GET(request: NextRequest) {
5 | const chatId = request.nextUrl.searchParams.get("chatId")
6 | if (!chatId) {
7 | return NextResponse.json({ code: -1 })
8 | }
9 | const list = await prisma.message.findMany({
10 | where: {
11 | chatId
12 | },
13 | orderBy: {
14 | createTime: "asc"
15 | }
16 | })
17 | return NextResponse.json({ code: 0, data: { list } })
18 | }
--------------------------------------------------------------------------------
/19/app/api/message/list/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function GET(request: NextRequest) {
5 | const chatId = request.nextUrl.searchParams.get("chatId")
6 | if (!chatId) {
7 | return NextResponse.json({ code: -1 })
8 | }
9 | const list = await prisma.message.findMany({
10 | where: {
11 | chatId
12 | },
13 | orderBy: {
14 | createTime: "asc"
15 | }
16 | })
17 | return NextResponse.json({ code: 0, data: { list } })
18 | }
--------------------------------------------------------------------------------
/20/app/api/message/list/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function GET(request: NextRequest) {
5 | const chatId = request.nextUrl.searchParams.get("chatId")
6 | if (!chatId) {
7 | return NextResponse.json({ code: -1 })
8 | }
9 | const list = await prisma.message.findMany({
10 | where: {
11 | chatId
12 | },
13 | orderBy: {
14 | createTime: "asc"
15 | }
16 | })
17 | return NextResponse.json({ code: 0, data: { list } })
18 | }
--------------------------------------------------------------------------------
/21/app/api/message/list/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function GET(request: NextRequest) {
5 | const chatId = request.nextUrl.searchParams.get("chatId")
6 | if (!chatId) {
7 | return NextResponse.json({ code: -1 })
8 | }
9 | const list = await prisma.message.findMany({
10 | where: {
11 | chatId
12 | },
13 | orderBy: {
14 | createTime: "asc"
15 | }
16 | })
17 | return NextResponse.json({ code: 0, data: { list } })
18 | }
--------------------------------------------------------------------------------
/05/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import AppContextProvider from "@/components/AppContext"
2 | import "./globals.css"
3 | import type { Metadata } from "next"
4 |
5 | export const metadata: Metadata = {
6 | title: "Create Next App",
7 | description: "Generated by create next app"
8 | }
9 |
10 | export default function RootLayout({
11 | children
12 | }: {
13 | children: React.ReactNode
14 | }) {
15 | return (
16 |
17 |
18 | {children}
19 |
20 |
21 | )
22 | }
23 |
--------------------------------------------------------------------------------
/06/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import AppContextProvider from "@/components/AppContext"
2 | import "./globals.css"
3 | import type { Metadata } from "next"
4 |
5 | export const metadata: Metadata = {
6 | title: "Create Next App",
7 | description: "Generated by create next app"
8 | }
9 |
10 | export default function RootLayout({
11 | children
12 | }: {
13 | children: React.ReactNode
14 | }) {
15 | return (
16 |
17 |
18 | {children}
19 |
20 |
21 | )
22 | }
23 |
--------------------------------------------------------------------------------
/07/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import AppContextProvider from "@/components/AppContext"
2 | import "./globals.css"
3 | import type { Metadata } from "next"
4 |
5 | export const metadata: Metadata = {
6 | title: "Create Next App",
7 | description: "Generated by create next app"
8 | }
9 |
10 | export default function RootLayout({
11 | children
12 | }: {
13 | children: React.ReactNode
14 | }) {
15 | return (
16 |
17 |
18 | {children}
19 |
20 |
21 | )
22 | }
23 |
--------------------------------------------------------------------------------
/08/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import AppContextProvider from "@/components/AppContext"
2 | import "./globals.css"
3 | import type { Metadata } from "next"
4 |
5 | export const metadata: Metadata = {
6 | title: "Create Next App",
7 | description: "Generated by create next app"
8 | }
9 |
10 | export default function RootLayout({
11 | children
12 | }: {
13 | children: React.ReactNode
14 | }) {
15 | return (
16 |
17 |
18 | {children}
19 |
20 |
21 | )
22 | }
23 |
--------------------------------------------------------------------------------
/09/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import AppContextProvider from "@/components/AppContext"
2 | import "./globals.css"
3 | import type { Metadata } from "next"
4 |
5 | export const metadata: Metadata = {
6 | title: "Create Next App",
7 | description: "Generated by create next app"
8 | }
9 |
10 | export default function RootLayout({
11 | children
12 | }: {
13 | children: React.ReactNode
14 | }) {
15 | return (
16 |
17 |
18 | {children}
19 |
20 |
21 | )
22 | }
23 |
--------------------------------------------------------------------------------
/10/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import AppContextProvider from "@/components/AppContext"
2 | import "./globals.css"
3 | import type { Metadata } from "next"
4 |
5 | export const metadata: Metadata = {
6 | title: "Create Next App",
7 | description: "Generated by create next app"
8 | }
9 |
10 | export default function RootLayout({
11 | children
12 | }: {
13 | children: React.ReactNode
14 | }) {
15 | return (
16 |
17 |
18 | {children}
19 |
20 |
21 | )
22 | }
23 |
--------------------------------------------------------------------------------
/15/prisma/migrations/20230914084314_init/migration.sql:
--------------------------------------------------------------------------------
1 | -- CreateTable
2 | CREATE TABLE "Chat" (
3 | "id" TEXT NOT NULL PRIMARY KEY,
4 | "title" TEXT NOT NULL,
5 | "updateTime" DATETIME NOT NULL
6 | );
7 |
8 | -- CreateTable
9 | CREATE TABLE "Message" (
10 | "id" TEXT NOT NULL PRIMARY KEY,
11 | "content" TEXT NOT NULL,
12 | "role" TEXT NOT NULL,
13 | "createTime" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
14 | "chatId" TEXT NOT NULL,
15 | CONSTRAINT "Message_chatId_fkey" FOREIGN KEY ("chatId") REFERENCES "Chat" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
16 | );
17 |
--------------------------------------------------------------------------------
/16/prisma/migrations/20230914084314_init/migration.sql:
--------------------------------------------------------------------------------
1 | -- CreateTable
2 | CREATE TABLE "Chat" (
3 | "id" TEXT NOT NULL PRIMARY KEY,
4 | "title" TEXT NOT NULL,
5 | "updateTime" DATETIME NOT NULL
6 | );
7 |
8 | -- CreateTable
9 | CREATE TABLE "Message" (
10 | "id" TEXT NOT NULL PRIMARY KEY,
11 | "content" TEXT NOT NULL,
12 | "role" TEXT NOT NULL,
13 | "createTime" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
14 | "chatId" TEXT NOT NULL,
15 | CONSTRAINT "Message_chatId_fkey" FOREIGN KEY ("chatId") REFERENCES "Chat" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
16 | );
17 |
--------------------------------------------------------------------------------
/17/prisma/migrations/20230914084314_init/migration.sql:
--------------------------------------------------------------------------------
1 | -- CreateTable
2 | CREATE TABLE "Chat" (
3 | "id" TEXT NOT NULL PRIMARY KEY,
4 | "title" TEXT NOT NULL,
5 | "updateTime" DATETIME NOT NULL
6 | );
7 |
8 | -- CreateTable
9 | CREATE TABLE "Message" (
10 | "id" TEXT NOT NULL PRIMARY KEY,
11 | "content" TEXT NOT NULL,
12 | "role" TEXT NOT NULL,
13 | "createTime" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
14 | "chatId" TEXT NOT NULL,
15 | CONSTRAINT "Message_chatId_fkey" FOREIGN KEY ("chatId") REFERENCES "Chat" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
16 | );
17 |
--------------------------------------------------------------------------------
/18/prisma/migrations/20230914084314_init/migration.sql:
--------------------------------------------------------------------------------
1 | -- CreateTable
2 | CREATE TABLE "Chat" (
3 | "id" TEXT NOT NULL PRIMARY KEY,
4 | "title" TEXT NOT NULL,
5 | "updateTime" DATETIME NOT NULL
6 | );
7 |
8 | -- CreateTable
9 | CREATE TABLE "Message" (
10 | "id" TEXT NOT NULL PRIMARY KEY,
11 | "content" TEXT NOT NULL,
12 | "role" TEXT NOT NULL,
13 | "createTime" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
14 | "chatId" TEXT NOT NULL,
15 | CONSTRAINT "Message_chatId_fkey" FOREIGN KEY ("chatId") REFERENCES "Chat" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
16 | );
17 |
--------------------------------------------------------------------------------
/19/prisma/migrations/20230914084314_init/migration.sql:
--------------------------------------------------------------------------------
1 | -- CreateTable
2 | CREATE TABLE "Chat" (
3 | "id" TEXT NOT NULL PRIMARY KEY,
4 | "title" TEXT NOT NULL,
5 | "updateTime" DATETIME NOT NULL
6 | );
7 |
8 | -- CreateTable
9 | CREATE TABLE "Message" (
10 | "id" TEXT NOT NULL PRIMARY KEY,
11 | "content" TEXT NOT NULL,
12 | "role" TEXT NOT NULL,
13 | "createTime" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
14 | "chatId" TEXT NOT NULL,
15 | CONSTRAINT "Message_chatId_fkey" FOREIGN KEY ("chatId") REFERENCES "Chat" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
16 | );
17 |
--------------------------------------------------------------------------------
/20/prisma/migrations/20230914084314_init/migration.sql:
--------------------------------------------------------------------------------
1 | -- CreateTable
2 | CREATE TABLE "Chat" (
3 | "id" TEXT NOT NULL PRIMARY KEY,
4 | "title" TEXT NOT NULL,
5 | "updateTime" DATETIME NOT NULL
6 | );
7 |
8 | -- CreateTable
9 | CREATE TABLE "Message" (
10 | "id" TEXT NOT NULL PRIMARY KEY,
11 | "content" TEXT NOT NULL,
12 | "role" TEXT NOT NULL,
13 | "createTime" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
14 | "chatId" TEXT NOT NULL,
15 | CONSTRAINT "Message_chatId_fkey" FOREIGN KEY ("chatId") REFERENCES "Chat" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
16 | );
17 |
--------------------------------------------------------------------------------
/21/prisma/migrations/20230914084314_init/migration.sql:
--------------------------------------------------------------------------------
1 | -- CreateTable
2 | CREATE TABLE "Chat" (
3 | "id" TEXT NOT NULL PRIMARY KEY,
4 | "title" TEXT NOT NULL,
5 | "updateTime" DATETIME NOT NULL
6 | );
7 |
8 | -- CreateTable
9 | CREATE TABLE "Message" (
10 | "id" TEXT NOT NULL PRIMARY KEY,
11 | "content" TEXT NOT NULL,
12 | "role" TEXT NOT NULL,
13 | "createTime" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
14 | "chatId" TEXT NOT NULL,
15 | CONSTRAINT "Message_chatId_fkey" FOREIGN KEY ("chatId") REFERENCES "Chat" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
16 | );
17 |
--------------------------------------------------------------------------------
/11/components/home/Main/index.tsx:
--------------------------------------------------------------------------------
1 | import ChatInput from "./ChatInput"
2 | import Menu from "./Menu"
3 | import MessageList from "./MessageList"
4 | import Welcome from "./Welcome"
5 |
6 | export default function Main() {
7 | return (
8 |
9 |
10 |
11 | {/* */}
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/12/components/home/Main/index.tsx:
--------------------------------------------------------------------------------
1 | import ChatInput from "./ChatInput"
2 | import Menu from "./Menu"
3 | import MessageList from "./MessageList"
4 | import Welcome from "./Welcome"
5 |
6 | export default function Main() {
7 | return (
8 |
9 |
10 |
11 | {/* */}
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/13/components/home/Main/index.tsx:
--------------------------------------------------------------------------------
1 | import ChatInput from "./ChatInput"
2 | import Menu from "./Menu"
3 | import MessageList from "./MessageList"
4 | import Welcome from "./Welcome"
5 |
6 | export default function Main() {
7 | return (
8 |
9 |
10 |
11 | {/* */}
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/14/components/home/Main/index.tsx:
--------------------------------------------------------------------------------
1 | import ChatInput from "./ChatInput"
2 | import Menu from "./Menu"
3 | import MessageList from "./MessageList"
4 | import Welcome from "./Welcome"
5 |
6 | export default function Main() {
7 | return (
8 |
9 |
10 |
11 | {/* */}
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/15/components/home/Main/index.tsx:
--------------------------------------------------------------------------------
1 | import ChatInput from "./ChatInput"
2 | import Menu from "./Menu"
3 | import MessageList from "./MessageList"
4 | import Welcome from "./Welcome"
5 |
6 | export default function Main() {
7 | return (
8 |
9 |
10 |
11 | {/* */}
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/16/components/home/Main/index.tsx:
--------------------------------------------------------------------------------
1 | import ChatInput from "./ChatInput"
2 | import Menu from "./Menu"
3 | import MessageList from "./MessageList"
4 | import Welcome from "./Welcome"
5 |
6 | export default function Main() {
7 | return (
8 |
9 |
10 |
11 | {/* */}
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/17/components/home/Main/index.tsx:
--------------------------------------------------------------------------------
1 | import ChatInput from "./ChatInput"
2 | import Menu from "./Menu"
3 | import MessageList from "./MessageList"
4 | import Welcome from "./Welcome"
5 |
6 | export default function Main() {
7 | return (
8 |
9 |
10 |
11 | {/* */}
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/18/components/home/Main/index.tsx:
--------------------------------------------------------------------------------
1 | import ChatInput from "./ChatInput"
2 | import Menu from "./Menu"
3 | import MessageList from "./MessageList"
4 | import Welcome from "./Welcome"
5 |
6 | export default function Main() {
7 | return (
8 |
9 |
10 |
11 | {/* */}
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/19/components/home/Main/index.tsx:
--------------------------------------------------------------------------------
1 | import ChatInput from "./ChatInput"
2 | import Menu from "./Menu"
3 | import MessageList from "./MessageList"
4 | import Welcome from "./Welcome"
5 |
6 | export default function Main() {
7 | return (
8 |
9 |
10 |
11 | {/* */}
12 |
13 |
14 |
15 |
16 | )
17 | }
18 |
--------------------------------------------------------------------------------
/01/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/02/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/03/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/04/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/05/components/home/Navigation/index.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import { useAppContext } from "@/components/AppContext"
4 | import Menubar from "./Menubar"
5 | import Toolbar from "./Toolbar"
6 |
7 | export default function Navigation() {
8 | const {
9 | state: { displayNavigation }
10 | } = useAppContext()
11 | return (
12 |
20 | )
21 | }
22 |
--------------------------------------------------------------------------------
/05/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/06/components/home/Navigation/index.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import { useAppContext } from "@/components/AppContext"
4 | import Menubar from "./Menubar"
5 | import Toolbar from "./Toolbar"
6 |
7 | export default function Navigation() {
8 | const {
9 | state: { displayNavigation }
10 | } = useAppContext()
11 | return (
12 |
20 | )
21 | }
22 |
--------------------------------------------------------------------------------
/06/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/07/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/08/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/09/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/10/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/11/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/12/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/13/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/14/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/15/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/16/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/17/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/18/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/19/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/20/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/21/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/12/app/api/chat/route.ts:
--------------------------------------------------------------------------------
1 | import { sleep } from "@/common/util";
2 | import { NextRequest, } from "next/server";
3 |
4 | export async function POST(request: NextRequest) {
5 | const { messageText } = await request.json()
6 | const encoder = new TextEncoder()
7 | const stream = new ReadableStream({
8 | async start(controller) {
9 | for (let i = 0; i < messageText.length; i++) {
10 | await sleep(100)
11 | controller.enqueue(encoder.encode(messageText[i]))
12 | }
13 | controller.close()
14 | }
15 | })
16 | return new Response(stream)
17 | }
--------------------------------------------------------------------------------
/11/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import AppContextProvider from "@/components/AppContext"
2 | import "@/styles/globals.css"
3 | import "@/styles/markdown.css"
4 | import type { Metadata } from "next"
5 |
6 | export const metadata: Metadata = {
7 | title: "Create Next App",
8 | description: "Generated by create next app"
9 | }
10 |
11 | export default function RootLayout({
12 | children
13 | }: {
14 | children: React.ReactNode
15 | }) {
16 | return (
17 |
18 |
19 | {children}
20 |
21 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/12/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import AppContextProvider from "@/components/AppContext"
2 | import "@/styles/globals.css"
3 | import "@/styles/markdown.css"
4 | import type { Metadata } from "next"
5 |
6 | export const metadata: Metadata = {
7 | title: "Create Next App",
8 | description: "Generated by create next app"
9 | }
10 |
11 | export default function RootLayout({
12 | children
13 | }: {
14 | children: React.ReactNode
15 | }) {
16 | return (
17 |
18 |
19 | {children}
20 |
21 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/13/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import AppContextProvider from "@/components/AppContext"
2 | import "@/styles/globals.css"
3 | import "@/styles/markdown.css"
4 | import type { Metadata } from "next"
5 |
6 | export const metadata: Metadata = {
7 | title: "Create Next App",
8 | description: "Generated by create next app"
9 | }
10 |
11 | export default function RootLayout({
12 | children
13 | }: {
14 | children: React.ReactNode
15 | }) {
16 | return (
17 |
18 |
19 | {children}
20 |
21 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/14/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import AppContextProvider from "@/components/AppContext"
2 | import "@/styles/globals.css"
3 | import "@/styles/markdown.css"
4 | import type { Metadata } from "next"
5 |
6 | export const metadata: Metadata = {
7 | title: "Create Next App",
8 | description: "Generated by create next app"
9 | }
10 |
11 | export default function RootLayout({
12 | children
13 | }: {
14 | children: React.ReactNode
15 | }) {
16 | return (
17 |
18 |
19 | {children}
20 |
21 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/15/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import AppContextProvider from "@/components/AppContext"
2 | import "@/styles/globals.css"
3 | import "@/styles/markdown.css"
4 | import type { Metadata } from "next"
5 |
6 | export const metadata: Metadata = {
7 | title: "Create Next App",
8 | description: "Generated by create next app"
9 | }
10 |
11 | export default function RootLayout({
12 | children
13 | }: {
14 | children: React.ReactNode
15 | }) {
16 | return (
17 |
18 |
19 | {children}
20 |
21 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/18/app/api/chat/list/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function GET(request: NextRequest) {
5 | const param = request.nextUrl.searchParams.get("page")
6 | const page = param ? parseInt(param) : 1
7 | const list = await prisma.chat.findMany({
8 | skip: (page - 1) * 20,
9 | take: 20,
10 | orderBy: {
11 | updateTime: "desc"
12 | }
13 | })
14 | const count = await prisma.chat.count()
15 | const hasMore = count > page * 20
16 | return NextResponse.json({ code: 0, data: { list, hasMore } })
17 | }
--------------------------------------------------------------------------------
/19/app/api/chat/list/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function GET(request: NextRequest) {
5 | const param = request.nextUrl.searchParams.get("page")
6 | const page = param ? parseInt(param) : 1
7 | const list = await prisma.chat.findMany({
8 | skip: (page - 1) * 20,
9 | take: 20,
10 | orderBy: {
11 | updateTime: "desc"
12 | }
13 | })
14 | const count = await prisma.chat.count()
15 | const hasMore = count > page * 20
16 | return NextResponse.json({ code: 0, data: { list, hasMore } })
17 | }
--------------------------------------------------------------------------------
/20/app/api/chat/list/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function GET(request: NextRequest) {
5 | const param = request.nextUrl.searchParams.get("page")
6 | const page = param ? parseInt(param) : 1
7 | const list = await prisma.chat.findMany({
8 | skip: (page - 1) * 20,
9 | take: 20,
10 | orderBy: {
11 | updateTime: "desc"
12 | }
13 | })
14 | const count = await prisma.chat.count()
15 | const hasMore = count > page * 20
16 | return NextResponse.json({ code: 0, data: { list, hasMore } })
17 | }
--------------------------------------------------------------------------------
/21/app/api/chat/list/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function GET(request: NextRequest) {
5 | const param = request.nextUrl.searchParams.get("page")
6 | const page = param ? parseInt(param) : 1
7 | const list = await prisma.chat.findMany({
8 | skip: (page - 1) * 20,
9 | take: 20,
10 | orderBy: {
11 | updateTime: "desc"
12 | }
13 | })
14 | const count = await prisma.chat.count()
15 | const hasMore = count > page * 20
16 | return NextResponse.json({ code: 0, data: { list, hasMore } })
17 | }
--------------------------------------------------------------------------------
/01/app/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
5 | :root {
6 | --foreground-rgb: 0, 0, 0;
7 | --background-start-rgb: 214, 219, 220;
8 | --background-end-rgb: 255, 255, 255;
9 | }
10 |
11 | @media (prefers-color-scheme: dark) {
12 | :root {
13 | --foreground-rgb: 255, 255, 255;
14 | --background-start-rgb: 0, 0, 0;
15 | --background-end-rgb: 0, 0, 0;
16 | }
17 | }
18 |
19 | body {
20 | color: rgb(var(--foreground-rgb));
21 | background: linear-gradient(
22 | to bottom,
23 | transparent,
24 | rgb(var(--background-end-rgb))
25 | )
26 | rgb(var(--background-start-rgb));
27 | }
28 |
--------------------------------------------------------------------------------
/01/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "chatgpt-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint"
10 | },
11 | "dependencies": {
12 | "@types/node": "20.4.5",
13 | "@types/react": "18.2.17",
14 | "@types/react-dom": "18.2.7",
15 | "autoprefixer": "10.4.14",
16 | "eslint": "8.45.0",
17 | "eslint-config-next": "13.4.12",
18 | "next": "13.4.12",
19 | "postcss": "8.4.27",
20 | "react": "18.2.0",
21 | "react-dom": "18.2.0",
22 | "tailwindcss": "3.3.3",
23 | "typescript": "5.1.6"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/02/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "chatgpt-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint"
10 | },
11 | "dependencies": {
12 | "@types/node": "20.4.5",
13 | "@types/react": "18.2.17",
14 | "@types/react-dom": "18.2.7",
15 | "autoprefixer": "10.4.14",
16 | "eslint": "8.45.0",
17 | "eslint-config-next": "13.4.12",
18 | "next": "13.4.12",
19 | "postcss": "8.4.27",
20 | "react": "18.2.0",
21 | "react-dom": "18.2.0",
22 | "tailwindcss": "3.3.3",
23 | "typescript": "5.1.6"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/03/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "chatgpt-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint"
10 | },
11 | "dependencies": {
12 | "@types/node": "20.4.5",
13 | "@types/react": "18.2.17",
14 | "@types/react-dom": "18.2.7",
15 | "autoprefixer": "10.4.14",
16 | "eslint": "8.45.0",
17 | "eslint-config-next": "13.4.12",
18 | "next": "13.4.12",
19 | "postcss": "8.4.27",
20 | "react": "18.2.0",
21 | "react-dom": "18.2.0",
22 | "tailwindcss": "3.3.3",
23 | "typescript": "5.1.6"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/04/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "chatgpt-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint"
10 | },
11 | "dependencies": {
12 | "@types/node": "20.4.5",
13 | "@types/react": "18.2.17",
14 | "@types/react-dom": "18.2.7",
15 | "autoprefixer": "10.4.14",
16 | "eslint": "8.45.0",
17 | "eslint-config-next": "13.4.12",
18 | "next": "13.4.12",
19 | "postcss": "8.4.27",
20 | "react": "18.2.0",
21 | "react-dom": "18.2.0",
22 | "tailwindcss": "3.3.3",
23 | "typescript": "5.1.6"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/19/app/api/chat/delete/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function POST(request: NextRequest) {
5 | const id = request.nextUrl.searchParams.get("id")
6 | if (!id) {
7 | return NextResponse.json({ code: -1 })
8 | }
9 | const deleteMessages = prisma.message.deleteMany({
10 | where: {
11 | chatId: id
12 | }
13 | })
14 | const deleteChat = prisma.chat.delete({
15 | where: {
16 | id
17 | }
18 | })
19 | await prisma.$transaction([deleteMessages, deleteChat])
20 | return NextResponse.json({ code: 0 })
21 | }
--------------------------------------------------------------------------------
/20/app/api/chat/delete/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function POST(request: NextRequest) {
5 | const id = request.nextUrl.searchParams.get("id")
6 | if (!id) {
7 | return NextResponse.json({ code: -1 })
8 | }
9 | const deleteMessages = prisma.message.deleteMany({
10 | where: {
11 | chatId: id
12 | }
13 | })
14 | const deleteChat = prisma.chat.delete({
15 | where: {
16 | id
17 | }
18 | })
19 | await prisma.$transaction([deleteMessages, deleteChat])
20 | return NextResponse.json({ code: 0 })
21 | }
--------------------------------------------------------------------------------
/21/app/api/chat/delete/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function POST(request: NextRequest) {
5 | const id = request.nextUrl.searchParams.get("id")
6 | if (!id) {
7 | return NextResponse.json({ code: -1 })
8 | }
9 | const deleteMessages = prisma.message.deleteMany({
10 | where: {
11 | chatId: id
12 | }
13 | })
14 | const deleteChat = prisma.chat.delete({
15 | where: {
16 | id
17 | }
18 | })
19 | await prisma.$transaction([deleteMessages, deleteChat])
20 | return NextResponse.json({ code: 0 })
21 | }
--------------------------------------------------------------------------------
/05/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "chatgpt-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint"
10 | },
11 | "dependencies": {
12 | "@types/node": "20.4.5",
13 | "@types/react": "18.2.17",
14 | "@types/react-dom": "18.2.7",
15 | "autoprefixer": "10.4.14",
16 | "eslint": "8.45.0",
17 | "eslint-config-next": "13.4.12",
18 | "next": "13.4.12",
19 | "postcss": "8.4.27",
20 | "react": "18.2.0",
21 | "react-dom": "18.2.0",
22 | "react-icons": "^4.10.1",
23 | "tailwindcss": "3.3.3",
24 | "typescript": "5.1.6"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/05/reducers/AppReducer.ts:
--------------------------------------------------------------------------------
1 | export type State = {
2 | displayNavigation: boolean
3 | themeMode: "dark" | "light"
4 | }
5 |
6 | export enum ActionType {
7 | UPDATE = "UPDATE"
8 | }
9 |
10 | type UpdateAction = {
11 | type: ActionType.UPDATE
12 | field: string
13 | value: any
14 | }
15 |
16 | export type Action = UpdateAction
17 |
18 | export const initState: State = {
19 | displayNavigation: true,
20 | themeMode: "light"
21 | }
22 |
23 | export function reducer(state: State, action: Action) {
24 | switch (action.type) {
25 | case ActionType.UPDATE:
26 | return { ...state, [action.field]: action.value }
27 | default: throw new Error()
28 | }
29 | }
--------------------------------------------------------------------------------
/06/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "chatgpt-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint"
10 | },
11 | "dependencies": {
12 | "@types/node": "20.4.5",
13 | "@types/react": "18.2.17",
14 | "@types/react-dom": "18.2.7",
15 | "autoprefixer": "10.4.14",
16 | "eslint": "8.45.0",
17 | "eslint-config-next": "13.4.12",
18 | "next": "13.4.12",
19 | "postcss": "8.4.27",
20 | "react": "18.2.0",
21 | "react-dom": "18.2.0",
22 | "react-icons": "^4.10.1",
23 | "tailwindcss": "3.3.3",
24 | "typescript": "5.1.6"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/06/reducers/AppReducer.ts:
--------------------------------------------------------------------------------
1 | export type State = {
2 | displayNavigation: boolean
3 | themeMode: "dark" | "light"
4 | }
5 |
6 | export enum ActionType {
7 | UPDATE = "UPDATE"
8 | }
9 |
10 | type UpdateAction = {
11 | type: ActionType.UPDATE
12 | field: string
13 | value: any
14 | }
15 |
16 | export type Action = UpdateAction
17 |
18 | export const initState: State = {
19 | displayNavigation: true,
20 | themeMode: "light"
21 | }
22 |
23 | export function reducer(state: State, action: Action) {
24 | switch (action.type) {
25 | case ActionType.UPDATE:
26 | return { ...state, [action.field]: action.value }
27 | default: throw new Error()
28 | }
29 | }
--------------------------------------------------------------------------------
/07/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "chatgpt-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint"
10 | },
11 | "dependencies": {
12 | "@types/node": "20.4.5",
13 | "@types/react": "18.2.17",
14 | "@types/react-dom": "18.2.7",
15 | "autoprefixer": "10.4.14",
16 | "eslint": "8.45.0",
17 | "eslint-config-next": "13.4.12",
18 | "next": "13.4.12",
19 | "postcss": "8.4.27",
20 | "react": "18.2.0",
21 | "react-dom": "18.2.0",
22 | "react-icons": "^4.10.1",
23 | "tailwindcss": "3.3.3",
24 | "typescript": "5.1.6"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/07/reducers/AppReducer.ts:
--------------------------------------------------------------------------------
1 | export type State = {
2 | displayNavigation: boolean
3 | themeMode: "dark" | "light"
4 | }
5 |
6 | export enum ActionType {
7 | UPDATE = "UPDATE"
8 | }
9 |
10 | type UpdateAction = {
11 | type: ActionType.UPDATE
12 | field: string
13 | value: any
14 | }
15 |
16 | export type Action = UpdateAction
17 |
18 | export const initState: State = {
19 | displayNavigation: true,
20 | themeMode: "light"
21 | }
22 |
23 | export function reducer(state: State, action: Action) {
24 | switch (action.type) {
25 | case ActionType.UPDATE:
26 | return { ...state, [action.field]: action.value }
27 | default: throw new Error()
28 | }
29 | }
--------------------------------------------------------------------------------
/08/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "chatgpt-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint"
10 | },
11 | "dependencies": {
12 | "@types/node": "20.4.5",
13 | "@types/react": "18.2.17",
14 | "@types/react-dom": "18.2.7",
15 | "autoprefixer": "10.4.14",
16 | "eslint": "8.45.0",
17 | "eslint-config-next": "13.4.12",
18 | "next": "13.4.12",
19 | "postcss": "8.4.27",
20 | "react": "18.2.0",
21 | "react-dom": "18.2.0",
22 | "react-icons": "^4.10.1",
23 | "tailwindcss": "3.3.3",
24 | "typescript": "5.1.6"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/08/reducers/AppReducer.ts:
--------------------------------------------------------------------------------
1 | export type State = {
2 | displayNavigation: boolean
3 | themeMode: "dark" | "light"
4 | }
5 |
6 | export enum ActionType {
7 | UPDATE = "UPDATE"
8 | }
9 |
10 | type UpdateAction = {
11 | type: ActionType.UPDATE
12 | field: string
13 | value: any
14 | }
15 |
16 | export type Action = UpdateAction
17 |
18 | export const initState: State = {
19 | displayNavigation: true,
20 | themeMode: "light"
21 | }
22 |
23 | export function reducer(state: State, action: Action) {
24 | switch (action.type) {
25 | case ActionType.UPDATE:
26 | return { ...state, [action.field]: action.value }
27 | default: throw new Error()
28 | }
29 | }
--------------------------------------------------------------------------------
/09/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "chatgpt-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint"
10 | },
11 | "dependencies": {
12 | "@types/node": "20.4.5",
13 | "@types/react": "18.2.17",
14 | "@types/react-dom": "18.2.7",
15 | "autoprefixer": "10.4.14",
16 | "eslint": "8.45.0",
17 | "eslint-config-next": "13.4.12",
18 | "next": "13.4.12",
19 | "postcss": "8.4.27",
20 | "react": "18.2.0",
21 | "react-dom": "18.2.0",
22 | "react-icons": "^4.10.1",
23 | "tailwindcss": "3.3.3",
24 | "typescript": "5.1.6"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/07/components/home/Navigation/index.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import { useAppContext } from "@/components/AppContext"
4 | import Menubar from "./Menubar"
5 | import Toolbar from "./Toolbar"
6 | import ChatList from "./ChatList"
7 |
8 | export default function Navigation() {
9 | const {
10 | state: { displayNavigation }
11 | } = useAppContext()
12 | return (
13 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/08/components/home/Navigation/index.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import { useAppContext } from "@/components/AppContext"
4 | import Menubar from "./Menubar"
5 | import Toolbar from "./Toolbar"
6 | import ChatList from "./ChatList"
7 |
8 | export default function Navigation() {
9 | const {
10 | state: { displayNavigation }
11 | } = useAppContext()
12 | return (
13 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/09/components/home/Navigation/index.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import { useAppContext } from "@/components/AppContext"
4 | import Menubar from "./Menubar"
5 | import Toolbar from "./Toolbar"
6 | import ChatList from "./ChatList"
7 |
8 | export default function Navigation() {
9 | const {
10 | state: { displayNavigation }
11 | } = useAppContext()
12 | return (
13 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/10/components/home/Navigation/index.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import { useAppContext } from "@/components/AppContext"
4 | import Menubar from "./Menubar"
5 | import Toolbar from "./Toolbar"
6 | import ChatList from "./ChatList"
7 |
8 | export default function Navigation() {
9 | const {
10 | state: { displayNavigation }
11 | } = useAppContext()
12 | return (
13 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/11/components/home/Navigation/index.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import { useAppContext } from "@/components/AppContext"
4 | import Menubar from "./Menubar"
5 | import Toolbar from "./Toolbar"
6 | import ChatList from "./ChatList"
7 |
8 | export default function Navigation() {
9 | const {
10 | state: { displayNavigation }
11 | } = useAppContext()
12 | return (
13 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/12/components/home/Navigation/index.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import { useAppContext } from "@/components/AppContext"
4 | import Menubar from "./Menubar"
5 | import Toolbar from "./Toolbar"
6 | import ChatList from "./ChatList"
7 |
8 | export default function Navigation() {
9 | const {
10 | state: { displayNavigation }
11 | } = useAppContext()
12 | return (
13 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/13/components/home/Navigation/index.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import { useAppContext } from "@/components/AppContext"
4 | import Menubar from "./Menubar"
5 | import Toolbar from "./Toolbar"
6 | import ChatList from "./ChatList"
7 |
8 | export default function Navigation() {
9 | const {
10 | state: { displayNavigation }
11 | } = useAppContext()
12 | return (
13 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/14/components/home/Navigation/index.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import { useAppContext } from "@/components/AppContext"
4 | import Menubar from "./Menubar"
5 | import Toolbar from "./Toolbar"
6 | import ChatList from "./ChatList"
7 |
8 | export default function Navigation() {
9 | const {
10 | state: { displayNavigation }
11 | } = useAppContext()
12 | return (
13 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/15/components/home/Navigation/index.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import { useAppContext } from "@/components/AppContext"
4 | import Menubar from "./Menubar"
5 | import Toolbar from "./Toolbar"
6 | import ChatList from "./ChatList"
7 |
8 | export default function Navigation() {
9 | const {
10 | state: { displayNavigation }
11 | } = useAppContext()
12 | return (
13 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/16/components/home/Navigation/index.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import { useAppContext } from "@/components/AppContext"
4 | import Menubar from "./Menubar"
5 | import Toolbar from "./Toolbar"
6 | import ChatList from "./ChatList"
7 |
8 | export default function Navigation() {
9 | const {
10 | state: { displayNavigation }
11 | } = useAppContext()
12 | return (
13 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/17/components/home/Navigation/index.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import { useAppContext } from "@/components/AppContext"
4 | import Menubar from "./Menubar"
5 | import Toolbar from "./Toolbar"
6 | import ChatList from "./ChatList"
7 |
8 | export default function Navigation() {
9 | const {
10 | state: { displayNavigation }
11 | } = useAppContext()
12 | return (
13 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/18/components/home/Navigation/index.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import { useAppContext } from "@/components/AppContext"
4 | import Menubar from "./Menubar"
5 | import Toolbar from "./Toolbar"
6 | import ChatList from "./ChatList"
7 |
8 | export default function Navigation() {
9 | const {
10 | state: { displayNavigation }
11 | } = useAppContext()
12 | return (
13 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/19/components/home/Navigation/index.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import { useAppContext } from "@/components/AppContext"
4 | import Menubar from "./Menubar"
5 | import Toolbar from "./Toolbar"
6 | import ChatList from "./ChatList"
7 |
8 | export default function Navigation() {
9 | const {
10 | state: { displayNavigation }
11 | } = useAppContext()
12 | return (
13 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/20/components/home/Navigation/index.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import { useAppContext } from "@/components/AppContext"
4 | import Menubar from "./Menubar"
5 | import Toolbar from "./Toolbar"
6 | import ChatList from "./ChatList"
7 |
8 | export default function Navigation() {
9 | const {
10 | state: { displayNavigation }
11 | } = useAppContext()
12 | return (
13 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/21/components/home/Navigation/index.tsx:
--------------------------------------------------------------------------------
1 | "use client"
2 |
3 | import { useAppContext } from "@/components/AppContext"
4 | import Menubar from "./Menubar"
5 | import Toolbar from "./Toolbar"
6 | import ChatList from "./ChatList"
7 |
8 | export default function Navigation() {
9 | const {
10 | state: { displayNavigation }
11 | } = useAppContext()
12 | return (
13 |
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/15/app/api/message/update/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function POST(request: NextRequest) {
5 | const body = await request.json()
6 | const { id, ...data } = body
7 | if (!data.chatId) {
8 | const chat = await prisma.chat.create({
9 | data: {
10 | title: "新对话"
11 | }
12 | })
13 | data.chatId = chat.id
14 | }
15 | const message = await prisma.message.upsert({
16 | create: data,
17 | update: data,
18 | where: {
19 | id
20 | }
21 | })
22 | return NextResponse.json({ code: 0, data: { message } })
23 | }
--------------------------------------------------------------------------------
/16/app/api/message/update/route.ts:
--------------------------------------------------------------------------------
1 | import prisma from "@/lib/prisma";
2 | import { NextRequest, NextResponse } from "next/server";
3 |
4 | export async function POST(request: NextRequest) {
5 | const body = await request.json()
6 | const { id, ...data } = body
7 | if (!data.chatId) {
8 | const chat = await prisma.chat.create({
9 | data: {
10 | title: "新对话"
11 | }
12 | })
13 | data.chatId = chat.id
14 | }
15 | const message = await prisma.message.upsert({
16 | create: data,
17 | update: data,
18 | where: {
19 | id
20 | }
21 | })
22 | return NextResponse.json({ code: 0, data: { message } })
23 | }
--------------------------------------------------------------------------------
/15/prisma/schema.prisma:
--------------------------------------------------------------------------------
1 | // This is your Prisma schema file,
2 | // learn more about it in the docs: https://pris.ly/d/prisma-schema
3 |
4 | model Chat {
5 | id String @id @default(uuid())
6 | title String
7 | updateTime DateTime @updatedAt
8 | Message Message[]
9 | }
10 |
11 | model Message {
12 | id String @id @default(uuid())
13 | content String
14 | role String
15 | createTime DateTime @default(now())
16 | chatId String
17 | chat Chat @relation(fields: [chatId], references: [id])
18 | }
19 |
20 | generator client {
21 | provider = "prisma-client-js"
22 | }
23 |
24 | datasource db {
25 | provider = "sqlite"
26 | url = "file:./chatgpt-app.sqlite"
27 | }
28 |
--------------------------------------------------------------------------------
/16/prisma/schema.prisma:
--------------------------------------------------------------------------------
1 | // This is your Prisma schema file,
2 | // learn more about it in the docs: https://pris.ly/d/prisma-schema
3 |
4 | model Chat {
5 | id String @id @default(uuid())
6 | title String
7 | updateTime DateTime @updatedAt
8 | Message Message[]
9 | }
10 |
11 | model Message {
12 | id String @id @default(uuid())
13 | content String
14 | role String
15 | createTime DateTime @default(now())
16 | chatId String
17 | chat Chat @relation(fields: [chatId], references: [id])
18 | }
19 |
20 | generator client {
21 | provider = "prisma-client-js"
22 | }
23 |
24 | datasource db {
25 | provider = "sqlite"
26 | url = "file:./chatgpt-app.sqlite"
27 | }
28 |
--------------------------------------------------------------------------------
/17/prisma/schema.prisma:
--------------------------------------------------------------------------------
1 | // This is your Prisma schema file,
2 | // learn more about it in the docs: https://pris.ly/d/prisma-schema
3 |
4 | model Chat {
5 | id String @id @default(uuid())
6 | title String
7 | updateTime DateTime @updatedAt
8 | Message Message[]
9 | }
10 |
11 | model Message {
12 | id String @id @default(uuid())
13 | content String
14 | role String
15 | createTime DateTime @default(now())
16 | chatId String
17 | chat Chat @relation(fields: [chatId], references: [id])
18 | }
19 |
20 | generator client {
21 | provider = "prisma-client-js"
22 | }
23 |
24 | datasource db {
25 | provider = "sqlite"
26 | url = "file:./chatgpt-app.sqlite"
27 | }
28 |
--------------------------------------------------------------------------------
/18/prisma/schema.prisma:
--------------------------------------------------------------------------------
1 | // This is your Prisma schema file,
2 | // learn more about it in the docs: https://pris.ly/d/prisma-schema
3 |
4 | model Chat {
5 | id String @id @default(uuid())
6 | title String
7 | updateTime DateTime @updatedAt
8 | Message Message[]
9 | }
10 |
11 | model Message {
12 | id String @id @default(uuid())
13 | content String
14 | role String
15 | createTime DateTime @default(now())
16 | chatId String
17 | chat Chat @relation(fields: [chatId], references: [id])
18 | }
19 |
20 | generator client {
21 | provider = "prisma-client-js"
22 | }
23 |
24 | datasource db {
25 | provider = "sqlite"
26 | url = "file:./chatgpt-app.sqlite"
27 | }
28 |
--------------------------------------------------------------------------------
/19/prisma/schema.prisma:
--------------------------------------------------------------------------------
1 | // This is your Prisma schema file,
2 | // learn more about it in the docs: https://pris.ly/d/prisma-schema
3 |
4 | model Chat {
5 | id String @id @default(uuid())
6 | title String
7 | updateTime DateTime @updatedAt
8 | Message Message[]
9 | }
10 |
11 | model Message {
12 | id String @id @default(uuid())
13 | content String
14 | role String
15 | createTime DateTime @default(now())
16 | chatId String
17 | chat Chat @relation(fields: [chatId], references: [id])
18 | }
19 |
20 | generator client {
21 | provider = "prisma-client-js"
22 | }
23 |
24 | datasource db {
25 | provider = "sqlite"
26 | url = "file:./chatgpt-app.sqlite"
27 | }
28 |
--------------------------------------------------------------------------------
/20/prisma/schema.prisma:
--------------------------------------------------------------------------------
1 | // This is your Prisma schema file,
2 | // learn more about it in the docs: https://pris.ly/d/prisma-schema
3 |
4 | model Chat {
5 | id String @id @default(uuid())
6 | title String
7 | updateTime DateTime @updatedAt
8 | Message Message[]
9 | }
10 |
11 | model Message {
12 | id String @id @default(uuid())
13 | content String
14 | role String
15 | createTime DateTime @default(now())
16 | chatId String
17 | chat Chat @relation(fields: [chatId], references: [id])
18 | }
19 |
20 | generator client {
21 | provider = "prisma-client-js"
22 | }
23 |
24 | datasource db {
25 | provider = "sqlite"
26 | url = "file:./chatgpt-app.sqlite"
27 | }
28 |
--------------------------------------------------------------------------------
/21/prisma/schema.prisma:
--------------------------------------------------------------------------------
1 | // This is your Prisma schema file,
2 | // learn more about it in the docs: https://pris.ly/d/prisma-schema
3 |
4 | model Chat {
5 | id String @id @default(uuid())
6 | title String
7 | updateTime DateTime @updatedAt
8 | Message Message[]
9 | }
10 |
11 | model Message {
12 | id String @id @default(uuid())
13 | content String
14 | role String
15 | createTime DateTime @default(now())
16 | chatId String
17 | chat Chat @relation(fields: [chatId], references: [id])
18 | }
19 |
20 | generator client {
21 | provider = "prisma-client-js"
22 | }
23 |
24 | datasource db {
25 | provider = "sqlite"
26 | url = "file:./chatgpt-app.sqlite"
27 | }
28 |
--------------------------------------------------------------------------------
/10/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "chatgpt-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint"
10 | },
11 | "dependencies": {
12 | "@types/node": "20.4.5",
13 | "@types/react": "18.2.17",
14 | "@types/react-dom": "18.2.7",
15 | "autoprefixer": "10.4.14",
16 | "eslint": "8.45.0",
17 | "eslint-config-next": "13.4.12",
18 | "next": "13.4.12",
19 | "postcss": "8.4.27",
20 | "react": "18.2.0",
21 | "react-dom": "18.2.0",
22 | "react-icons": "^4.10.1",
23 | "react-textarea-autosize": "^8.5.2",
24 | "tailwindcss": "3.3.3",
25 | "typescript": "5.1.6"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/01/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/02/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/03/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/04/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/05/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/06/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/07/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/08/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/09/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/10/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/11/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/12/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/13/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/14/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/15/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/16/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/17/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/18/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/19/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/20/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/21/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "bundler",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true,
17 | "plugins": [
18 | {
19 | "name": "next"
20 | }
21 | ],
22 | "paths": {
23 | "@/*": ["./*"]
24 | }
25 | },
26 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27 | "exclude": ["node_modules"]
28 | }
29 |
--------------------------------------------------------------------------------
/09/reducers/AppReducer.ts:
--------------------------------------------------------------------------------
1 | export type State = {
2 | displayNavigation: boolean
3 | themeMode: "dark" | "light"
4 | currentModel: string
5 | }
6 |
7 | export enum ActionType {
8 | UPDATE = "UPDATE"
9 | }
10 |
11 | type UpdateAction = {
12 | type: ActionType.UPDATE
13 | field: string
14 | value: any
15 | }
16 |
17 | export type Action = UpdateAction
18 |
19 | export const initState: State = {
20 | displayNavigation: true,
21 | themeMode: "light",
22 | currentModel: "gpt-3.5-turbo"
23 | }
24 |
25 | export function reducer(state: State, action: Action) {
26 | switch (action.type) {
27 | case ActionType.UPDATE:
28 | return { ...state, [action.field]: action.value }
29 | default: throw new Error()
30 | }
31 | }
--------------------------------------------------------------------------------
/10/reducers/AppReducer.ts:
--------------------------------------------------------------------------------
1 | export type State = {
2 | displayNavigation: boolean
3 | themeMode: "dark" | "light"
4 | currentModel: string
5 | }
6 |
7 | export enum ActionType {
8 | UPDATE = "UPDATE"
9 | }
10 |
11 | type UpdateAction = {
12 | type: ActionType.UPDATE
13 | field: string
14 | value: any
15 | }
16 |
17 | export type Action = UpdateAction
18 |
19 | export const initState: State = {
20 | displayNavigation: true,
21 | themeMode: "light",
22 | currentModel: "gpt-3.5-turbo"
23 | }
24 |
25 | export function reducer(state: State, action: Action) {
26 | switch (action.type) {
27 | case ActionType.UPDATE:
28 | return { ...state, [action.field]: action.value }
29 | default: throw new Error()
30 | }
31 | }
--------------------------------------------------------------------------------
/11/reducers/AppReducer.ts:
--------------------------------------------------------------------------------
1 | export type State = {
2 | displayNavigation: boolean
3 | themeMode: "dark" | "light"
4 | currentModel: string
5 | }
6 |
7 | export enum ActionType {
8 | UPDATE = "UPDATE"
9 | }
10 |
11 | type UpdateAction = {
12 | type: ActionType.UPDATE
13 | field: string
14 | value: any
15 | }
16 |
17 | export type Action = UpdateAction
18 |
19 | export const initState: State = {
20 | displayNavigation: true,
21 | themeMode: "light",
22 | currentModel: "gpt-3.5-turbo"
23 | }
24 |
25 | export function reducer(state: State, action: Action) {
26 | switch (action.type) {
27 | case ActionType.UPDATE:
28 | return { ...state, [action.field]: action.value }
29 | default: throw new Error()
30 | }
31 | }
--------------------------------------------------------------------------------