From 474533beb3957a19b12d2539cef2137b186b6b96 Mon Sep 17 00:00:00 2001 From: Dan Zulla <114028070+zdanl@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:28:46 +0100 Subject: [PATCH 1/7] GUI Readme --- README.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 127078bb61..790d69745d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# GPT Engineer +# GPT Engineer + Browser GUI 🚀 [![Discord Follow](https://dcbadge.vercel.app/api/server/8tcDQ89Ej2?style=flat)](https://discord.gg/8tcDQ89Ej2) [![GitHub Repo stars](https://img.shields.io/github/stars/AntonOsika/gpt-engineer?style=social)](https://github.com/AntonOsika/gpt-engineer) @@ -8,6 +8,12 @@ GPT Engineer is made to be easy to adapt, extend, and make your agent learn how you want your code to look. It generates an entire codebase based on a prompt. +** +It now comes with a real-time websocket interface between an optimized fast-loading ReactJS web app running on localhost and the Python3 agent. ** + +Screenshot 2023-11-22 at 20 09 29 + + - [Demo](https://twitter.com/antonosika/status/1667641038104674306) ## Project philosophy @@ -34,6 +40,13 @@ For **development**: - `python -m pip install -e .` - (or: `make install && source venv/bin/activate` for a venv) +For **GUI** release: + +- `cd /app` +- `npm run build` +- `npm install` + + **API Key** Choose **one** of: @@ -77,7 +90,7 @@ You can specify the "identity" of the AI agent by editing the files in the `prep Editing the `preprompts`, and evolving how you write the project prompt, is how you make the agent remember things between projects. -You can also automatically copy all `preprompts` files into your project folder using the cli parameter `--use-custom-prepompts`. This way you can have custom preprompts for all of your projects without the need to edit the main files. If you don't want to use the project specific prepromt files, simply delete them or run `gpt-engineer` without the cli param. +You can also automatically copy all `preprompts` files into your project folder using the cli parameter `--use-custom-prepompts`. This way you can have custom preprompts for all of your projects without the need to edit the main files. Each step in `steps.py` will have its communication history with GPT4 stored in the logs folder, and can be rerun with `scripts/rerun_edited_message_logs.py`. From e6b999db9befea137dad547f6abcc1b41d0424f1 Mon Sep 17 00:00:00 2001 From: z Date: Wed, 22 Nov 2023 20:30:48 +0100 Subject: [PATCH 2/7] newest ReactJS + README for GUI, websocket support --- gpt_engineer/app/CHANGELOG.md | 7 + gpt_engineer/app/LICENSE | 21 + gpt_engineer/app/README.md | 17 + gpt_engineer/app/next-env.d.ts | 5 + gpt_engineer/app/next.config.js | 19 + gpt_engineer/app/package.json | 66 +++ gpt_engineer/app/pages/_app.tsx | 76 ++++ gpt_engineer/app/pages/_document.tsx | 16 + gpt_engineer/app/pages/api/chatAPI.ts | 32 ++ gpt_engineer/app/pages/index.tsx | 404 +++++++++++++++++ gpt_engineer/app/prettier.config.js | 4 + gpt_engineer/app/public/favicon.ico | Bin 0 -> 4286 bytes .../app/public/fonts/dm-sans/DMSans-Bold.ttf | Bin 0 -> 71852 bytes .../fonts/dm-sans/DMSans-BoldItalic.ttf | Bin 0 -> 73392 bytes .../public/fonts/dm-sans/DMSans-Italic.ttf | Bin 0 -> 73576 bytes .../public/fonts/dm-sans/DMSans-Medium.ttf | Bin 0 -> 71764 bytes .../fonts/dm-sans/DMSans-MediumItalic.ttf | Bin 0 -> 73288 bytes .../public/fonts/dm-sans/DMSans-Regular.ttf | Bin 0 -> 72000 bytes gpt_engineer/app/public/fonts/dm-sans/OFL.txt | 93 ++++ .../app/public/img/avatars/avatar1.png | Bin 0 -> 67692 bytes .../app/public/img/avatars/avatar10.png | Bin 0 -> 74250 bytes .../app/public/img/avatars/avatar2.png | Bin 0 -> 83572 bytes .../app/public/img/avatars/avatar3.png | Bin 0 -> 70393 bytes .../app/public/img/avatars/avatar4.png | Bin 0 -> 52805 bytes .../app/public/img/avatars/avatar5.png | Bin 0 -> 63633 bytes .../app/public/img/avatars/avatar6.png | Bin 0 -> 68088 bytes .../app/public/img/avatars/avatar7.png | Bin 0 -> 75190 bytes .../app/public/img/avatars/avatar8.png | Bin 0 -> 58228 bytes .../app/public/img/avatars/avatar9.png | Bin 0 -> 79329 bytes .../app/public/img/avatars/avatarSimmmple.png | Bin 0 -> 13686 bytes gpt_engineer/app/public/img/chat/bg-image.png | Bin 0 -> 1226186 bytes gpt_engineer/app/public/img/layout/Navbar.png | Bin 0 -> 55066 bytes gpt_engineer/app/public/img/layout/logo.png | Bin 0 -> 1226186 bytes .../app/public/img/plan/InvoiceBg.png | Bin 0 -> 204867 bytes gpt_engineer/app/public/manifest.json | 15 + gpt_engineer/app/public/robots.txt | 3 + gpt_engineer/app/src/_app.js | 44 ++ gpt_engineer/app/src/components/CodeBlock.tsx | 52 +++ .../app/src/components/MarkdownBlock.tsx | 42 ++ .../app/src/components/MessageBox.tsx | 24 + .../app/src/components/apiModal/index.tsx | 253 +++++++++++ gpt_engineer/app/src/components/card/Card.tsx | 11 + .../app/src/components/fields/InputField.tsx | 64 +++ .../app/src/components/footer/FooterAdmin.tsx | 102 +++++ .../app/src/components/icons/IconBox.tsx | 17 + .../app/src/components/icons/Icons.tsx | 187 ++++++++ .../app/src/components/image/Avatar.tsx | 41 ++ .../app/src/components/image/Image.tsx | 38 ++ gpt_engineer/app/src/components/link/Link.tsx | 19 + .../app/src/components/link/LinkButton.tsx | 20 + .../app/src/components/link/NavLink.tsx | 31 ++ .../app/src/components/navbar/NavbarAdmin.tsx | 154 +++++++ .../components/navbar/NavbarLinksAdmin.tsx | 96 ++++ .../components/navbar/searchBar/SearchBar.tsx | 61 +++ .../src/components/scrollbar/Scrollbar.tsx | 36 ++ .../app/src/components/search/index.tsx | 77 ++++ .../src/components/separator/Separator.tsx | 16 + .../app/src/components/sidebar/Sidebar.tsx | 145 ++++++ .../components/sidebar/components/Brand.tsx | 22 + .../components/sidebar/components/Content.tsx | 81 ++++ .../components/sidebar/components/Links.tsx | 360 +++++++++++++++ .../sidebar/components/SidebarCard.tsx | 79 ++++ .../src/components/sidebar/components/test.md | 9 + .../app/src/contexts/SidebarContext.ts | 9 + gpt_engineer/app/src/lib/chakra.tsx | 3 + gpt_engineer/app/src/routes.tsx | 28 ++ gpt_engineer/app/src/socket.js | 6 + gpt_engineer/app/src/styles/App.css | 9 + gpt_engineer/app/src/styles/Contact.css | 3 + gpt_engineer/app/src/styles/MiniCalendar.css | 156 +++++++ gpt_engineer/app/src/styles/Plugins.css | 154 +++++++ .../app/src/theme/additions/card/card.ts | 25 ++ .../app/src/theme/components/badge.ts | 32 ++ .../app/src/theme/components/button.ts | 412 ++++++++++++++++++ .../app/src/theme/components/input.ts | 207 +++++++++ gpt_engineer/app/src/theme/components/link.ts | 24 + .../app/src/theme/components/progress.ts | 43 ++ .../app/src/theme/components/switch.ts | 36 ++ .../app/src/theme/components/textarea.ts | 55 +++ gpt_engineer/app/src/theme/styles.ts | 108 +++++ gpt_engineer/app/src/theme/theme.tsx | 24 + gpt_engineer/app/src/types/hui-types.d.ts | 74 ++++ gpt_engineer/app/src/types/images.d.ts | 4 + gpt_engineer/app/src/types/navigation.d.ts | 16 + .../app/src/types/react-table-config.d.ts | 148 +++++++ gpt_engineer/app/src/types/stylis.d.ts | 4 + gpt_engineer/app/src/types/types.ts | 7 + gpt_engineer/app/src/utils/chatStream.ts | 85 ++++ gpt_engineer/app/src/utils/navigation.tsx | 39 ++ gpt_engineer/app/tsconfig.json | 35 ++ 90 files changed, 4605 insertions(+) create mode 100644 gpt_engineer/app/CHANGELOG.md create mode 100644 gpt_engineer/app/LICENSE create mode 100644 gpt_engineer/app/README.md create mode 100644 gpt_engineer/app/next-env.d.ts create mode 100644 gpt_engineer/app/next.config.js create mode 100644 gpt_engineer/app/package.json create mode 100644 gpt_engineer/app/pages/_app.tsx create mode 100644 gpt_engineer/app/pages/_document.tsx create mode 100644 gpt_engineer/app/pages/api/chatAPI.ts create mode 100644 gpt_engineer/app/pages/index.tsx create mode 100644 gpt_engineer/app/prettier.config.js create mode 100644 gpt_engineer/app/public/favicon.ico create mode 100644 gpt_engineer/app/public/fonts/dm-sans/DMSans-Bold.ttf create mode 100644 gpt_engineer/app/public/fonts/dm-sans/DMSans-BoldItalic.ttf create mode 100644 gpt_engineer/app/public/fonts/dm-sans/DMSans-Italic.ttf create mode 100644 gpt_engineer/app/public/fonts/dm-sans/DMSans-Medium.ttf create mode 100644 gpt_engineer/app/public/fonts/dm-sans/DMSans-MediumItalic.ttf create mode 100644 gpt_engineer/app/public/fonts/dm-sans/DMSans-Regular.ttf create mode 100644 gpt_engineer/app/public/fonts/dm-sans/OFL.txt create mode 100644 gpt_engineer/app/public/img/avatars/avatar1.png create mode 100644 gpt_engineer/app/public/img/avatars/avatar10.png create mode 100644 gpt_engineer/app/public/img/avatars/avatar2.png create mode 100644 gpt_engineer/app/public/img/avatars/avatar3.png create mode 100644 gpt_engineer/app/public/img/avatars/avatar4.png create mode 100644 gpt_engineer/app/public/img/avatars/avatar5.png create mode 100644 gpt_engineer/app/public/img/avatars/avatar6.png create mode 100644 gpt_engineer/app/public/img/avatars/avatar7.png create mode 100644 gpt_engineer/app/public/img/avatars/avatar8.png create mode 100644 gpt_engineer/app/public/img/avatars/avatar9.png create mode 100644 gpt_engineer/app/public/img/avatars/avatarSimmmple.png create mode 100644 gpt_engineer/app/public/img/chat/bg-image.png create mode 100644 gpt_engineer/app/public/img/layout/Navbar.png create mode 100644 gpt_engineer/app/public/img/layout/logo.png create mode 100644 gpt_engineer/app/public/img/plan/InvoiceBg.png create mode 100644 gpt_engineer/app/public/manifest.json create mode 100644 gpt_engineer/app/public/robots.txt create mode 100644 gpt_engineer/app/src/_app.js create mode 100644 gpt_engineer/app/src/components/CodeBlock.tsx create mode 100644 gpt_engineer/app/src/components/MarkdownBlock.tsx create mode 100644 gpt_engineer/app/src/components/MessageBox.tsx create mode 100644 gpt_engineer/app/src/components/apiModal/index.tsx create mode 100644 gpt_engineer/app/src/components/card/Card.tsx create mode 100644 gpt_engineer/app/src/components/fields/InputField.tsx create mode 100644 gpt_engineer/app/src/components/footer/FooterAdmin.tsx create mode 100644 gpt_engineer/app/src/components/icons/IconBox.tsx create mode 100644 gpt_engineer/app/src/components/icons/Icons.tsx create mode 100644 gpt_engineer/app/src/components/image/Avatar.tsx create mode 100644 gpt_engineer/app/src/components/image/Image.tsx create mode 100644 gpt_engineer/app/src/components/link/Link.tsx create mode 100644 gpt_engineer/app/src/components/link/LinkButton.tsx create mode 100644 gpt_engineer/app/src/components/link/NavLink.tsx create mode 100644 gpt_engineer/app/src/components/navbar/NavbarAdmin.tsx create mode 100644 gpt_engineer/app/src/components/navbar/NavbarLinksAdmin.tsx create mode 100644 gpt_engineer/app/src/components/navbar/searchBar/SearchBar.tsx create mode 100644 gpt_engineer/app/src/components/scrollbar/Scrollbar.tsx create mode 100644 gpt_engineer/app/src/components/search/index.tsx create mode 100644 gpt_engineer/app/src/components/separator/Separator.tsx create mode 100644 gpt_engineer/app/src/components/sidebar/Sidebar.tsx create mode 100644 gpt_engineer/app/src/components/sidebar/components/Brand.tsx create mode 100644 gpt_engineer/app/src/components/sidebar/components/Content.tsx create mode 100644 gpt_engineer/app/src/components/sidebar/components/Links.tsx create mode 100644 gpt_engineer/app/src/components/sidebar/components/SidebarCard.tsx create mode 100644 gpt_engineer/app/src/components/sidebar/components/test.md create mode 100644 gpt_engineer/app/src/contexts/SidebarContext.ts create mode 100644 gpt_engineer/app/src/lib/chakra.tsx create mode 100644 gpt_engineer/app/src/routes.tsx create mode 100644 gpt_engineer/app/src/socket.js create mode 100644 gpt_engineer/app/src/styles/App.css create mode 100644 gpt_engineer/app/src/styles/Contact.css create mode 100644 gpt_engineer/app/src/styles/MiniCalendar.css create mode 100644 gpt_engineer/app/src/styles/Plugins.css create mode 100644 gpt_engineer/app/src/theme/additions/card/card.ts create mode 100644 gpt_engineer/app/src/theme/components/badge.ts create mode 100644 gpt_engineer/app/src/theme/components/button.ts create mode 100644 gpt_engineer/app/src/theme/components/input.ts create mode 100644 gpt_engineer/app/src/theme/components/link.ts create mode 100644 gpt_engineer/app/src/theme/components/progress.ts create mode 100644 gpt_engineer/app/src/theme/components/switch.ts create mode 100644 gpt_engineer/app/src/theme/components/textarea.ts create mode 100644 gpt_engineer/app/src/theme/styles.ts create mode 100644 gpt_engineer/app/src/theme/theme.tsx create mode 100644 gpt_engineer/app/src/types/hui-types.d.ts create mode 100644 gpt_engineer/app/src/types/images.d.ts create mode 100644 gpt_engineer/app/src/types/navigation.d.ts create mode 100644 gpt_engineer/app/src/types/react-table-config.d.ts create mode 100644 gpt_engineer/app/src/types/stylis.d.ts create mode 100644 gpt_engineer/app/src/types/types.ts create mode 100644 gpt_engineer/app/src/utils/chatStream.ts create mode 100644 gpt_engineer/app/src/utils/navigation.tsx create mode 100644 gpt_engineer/app/tsconfig.json diff --git a/gpt_engineer/app/CHANGELOG.md b/gpt_engineer/app/CHANGELOG.md new file mode 100644 index 0000000000..d2a5ebd898 --- /dev/null +++ b/gpt_engineer/app/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog + +## [1.0.0] 2023-06-20 + +### Official Release + +Added TypeScript & NextJS diff --git a/gpt_engineer/app/LICENSE b/gpt_engineer/app/LICENSE new file mode 100644 index 0000000000..131359ab51 --- /dev/null +++ b/gpt_engineer/app/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Horizon UI + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/gpt_engineer/app/README.md b/gpt_engineer/app/README.md new file mode 100644 index 0000000000..de4c574691 --- /dev/null +++ b/gpt_engineer/app/README.md @@ -0,0 +1,17 @@ +# GPT-Engineer App + + + +## Community + +Connect with the community! Feel free to ask questions, report issues, and meet new people that already use Horizon AI Template! + +[Join the #HorizonUI Discord Community!](https://discord.gg/f6tEKFBd4m) + +## Authors +* @zdanl https://github.com/zdanl + +## Copyright and license + +[Copyright 2023 GPT-Engineer](https://github.com/AntonOsika/gpt-engineer) +[Copyright 2023 Horizon UI](https://www.horizon-ui.com/?ref=readme-horizon-ai-template-free) diff --git a/gpt_engineer/app/next-env.d.ts b/gpt_engineer/app/next-env.d.ts new file mode 100644 index 0000000000..4f11a03dc6 --- /dev/null +++ b/gpt_engineer/app/next-env.d.ts @@ -0,0 +1,5 @@ +/// +/// + +// NOTE: This file should not be edited +// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/gpt_engineer/app/next.config.js b/gpt_engineer/app/next.config.js new file mode 100644 index 0000000000..2543a77d60 --- /dev/null +++ b/gpt_engineer/app/next.config.js @@ -0,0 +1,19 @@ +/** @type {import('next').NextConfig} */ + +const nextConfig = { + reactStrictMode: false, + swcMinify: true, + basePath: process.env.NEXT_PUBLIC_BASE_PATH, + assetPrefix: process.env.NEXT_PUBLIC_BASE_PATH, + images: { + domains: [ + 'images.unsplash.com', + 'i.ibb.co', + 'scontent.fotp8-1.fna.fbcdn.net', + ], + // Make ENV + unoptimized: true, + }, +}; + +module.exports = nextConfig; diff --git a/gpt_engineer/app/package.json b/gpt_engineer/app/package.json new file mode 100644 index 0000000000..ee58aaf05a --- /dev/null +++ b/gpt_engineer/app/package.json @@ -0,0 +1,66 @@ +{ + "name": "gpt-engineer", + "version": "1.0.0", + "private": true, + "scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start", + "lint": "next lint" + }, + "dependencies": { + "@chakra-ui/icons": "^1.1.5", + "@chakra-ui/react": "1.8.9", + "@chakra-ui/system": "^1.12.1", + "@chakra-ui/theme-tools": "^1.3.6", + "@codemirror/legacy-modes": "^6.3.2", + "@emotion/react": "^11.4.1", + "@emotion/styled": "^11.3.0", + "@heroicons/react": "^2.0.17", + "@material-tailwind/react": "^1.4.2", + "@tanstack/react-table": "^8.5.15", + "@testing-library/jest-dom": "^5.14.1", + "@testing-library/react": "^11.2.7", + "@testing-library/user-event": "^12.8.3", + "@uiw/codemirror-theme-tokyo-night": "^4.19.11", + "@uiw/react-codemirror": "^4.19.11", + "babel-cli": "^6.26.0", + "babel-preset-es2015": "^6.24.1", + "babel-preset-react": "^6.24.1", + "babel-register": "^6.26.0", + "endent": "^2.1.0", + "eventsource-parser": "^1.0.0", + "framer-motion": "^4.1.17", + "next": "13.2.4", + "react": "18.2.0", + "react-build-sitemap": "^0.2.2", + "react-custom-scrollbars-2": "^4.2.1", + "react-dom": "18.2.0", + "react-icons": "^4.9.0", + "react-is": "^18.0.0", + "react-markdown": "^8.0.6", + "react-router-dom": "^5.3.0", + "react-scripts": "5.0.0", + "remark-gfm": "^3.0.1", + "sharp": "^0.32.6", + "socket.io": "^4.7.2", + "typescript": "4.9.5", + "web-vitals": "^1.1.2" + }, + "devDependencies": { + "@types/node": "18.15.11", + "@types/react": "18.0.31", + "@types/react-dom": "18.0.11", + "autoprefixer": "^10.4.14", + "eslint": "8.37.0", + "eslint-config-next": "13.2.4", + "eventsource": "^2.0.2", + "postcss": "^8.4.21", + "prettier-plugin-tailwindcss": "^0.2.6", + "tailwindcss": "^3.3.1" + }, + "resolutions": { + "@types/react": "18.0.31", + "@types/react-dom": "18.0.11" + } +} diff --git a/gpt_engineer/app/pages/_app.tsx b/gpt_engineer/app/pages/_app.tsx new file mode 100644 index 0000000000..8539071faf --- /dev/null +++ b/gpt_engineer/app/pages/_app.tsx @@ -0,0 +1,76 @@ +'use client'; +import type { AppProps } from 'next/app'; +import { ChakraProvider, Box, Portal, useDisclosure } from '@chakra-ui/react'; +import theme from '@/theme/theme'; +import routes from '@/routes'; +import Sidebar from '@/components/sidebar/Sidebar'; +import Footer from '@/components/footer/FooterAdmin'; +import Navbar from '@/components/navbar/NavbarAdmin'; +import { getActiveRoute, getActiveNavbar } from '@/utils/navigation'; +import { usePathname } from 'next/navigation'; +import { useEffect, useState } from 'react'; +import '@/styles/App.css'; +import '@/styles/Contact.css'; +import '@/styles/Plugins.css'; +import '@/styles/MiniCalendar.css'; + +function App({ Component, pageProps }: AppProps<{}>) { + const pathname = usePathname(); + const [apiKey, setApiKey] = useState(''); + const { isOpen, onOpen, onClose } = useDisclosure(); + useEffect(() => { + const initialKey = localStorage.getItem('apiKey'); + if (initialKey?.includes('sk-') && apiKey !== initialKey) { + setApiKey(initialKey); + } + }, [apiKey]); + + return ( + + + + + + + + + + + + + +