├── .DS_Store ├── .env.example ├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── public ├── .DS_Store ├── SF-Pro-Display-Bold.otf ├── android-icon-144x144.png ├── android-icon-192x192.png ├── android-icon-36x36.png ├── android-icon-48x48.png ├── android-icon-72x72.png ├── android-icon-96x96.png ├── apple-icon-114x114.png ├── apple-icon-120x120.png ├── apple-icon-144x144.png ├── apple-icon-152x152.png ├── apple-icon-180x180.png ├── apple-icon-57x57.png ├── apple-icon-60x60.png ├── apple-icon-72x72.png ├── apple-icon-76x76.png ├── apple-icon-precomposed.png ├── apple-icon.png ├── audio │ ├── .DS_Store │ ├── 1.mp3 │ ├── 10.mp3 │ ├── 11.mp3 │ ├── 12.mp3 │ ├── 13.mp3 │ ├── 14.mp3 │ ├── 15.mp3 │ ├── 16.mp3 │ ├── 17.mp3 │ ├── 18.mp3 │ ├── 19.mp3 │ ├── 2.mp3 │ ├── 20.mp3 │ ├── 21.mp3 │ ├── 3.mp3 │ ├── 4.mp3 │ ├── 5.mp3 │ ├── 6.mp3 │ ├── 7.mp3 │ ├── 8.mp3 │ ├── 9.mp3 │ ├── arpC.mp3 │ ├── casette.mp3 │ ├── enter.mp3 │ ├── padC.mp3 │ └── padFAndArp.mp3 ├── browserconfig.xml ├── diamond.glb ├── favicon-16x16.png ├── favicon-32x32.png ├── favicon-96x96.png ├── favicon.ico ├── index.html ├── kanji.svg ├── manifest.json ├── ms-icon-144x144.png ├── ms-icon-150x150.png ├── ms-icon-310x310.png ├── ms-icon-70x70.png └── wordmark.svg ├── screenshot.png ├── screenshot2.png ├── screenshot3.png ├── src ├── .DS_Store ├── App.js ├── AudioController.js ├── Diamond.js ├── Env.js ├── GradientBackground.js ├── InputBar.js ├── Postproduction.js ├── Scene.js ├── index.js ├── shaders │ ├── AdditiveBlendingShader.js │ ├── GrainyShader.js │ ├── Particles.js │ ├── TrailsShader.js │ └── VolumetricLightShader.js ├── store.js └── styles.css └── yarn.lock /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/.DS_Store -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | REACT_APP_OPENAI_API_KEY="openai api key here" -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | Screenshot 2023-01-09 at 5 04 57 PM 3 | 4 | 5 | 6 |

The Element

7 | 8 |

9 | https://theelement.vercel.app 10 |
11 |
12 | The Element invites you to explore your thoughts with a wise and calm AI companion while adapting the visuals and sounds to match your emotions in the moment. With walletconnect message sending protocol. 13 |
14 | 15 | 16 | Built using OpenAI's API, React Three Fiber and WalletConnect 17 | 18 | 19 | 20 |

21 | 22 | ![React](https://img.shields.io/badge/react-%2320232a.svg?style=for-the-badge&logo=react&logoColor=%2361DAFB) 23 | ![Threejs](https://img.shields.io/badge/threejs-black?style=for-the-badge&logo=three.js&logoColor=white) 24 | ![Blender](https://img.shields.io/badge/blender-%23F5792A.svg?style=for-the-badge&logo=blender&logoColor=white) 25 | ![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge&logo=javascript&logoColor=%23F7DF1E) 26 | ![HTML5](https://img.shields.io/badge/html5-%23E34F26.svg?style=for-the-badge&logo=html5&logoColor=white) 27 | ![CSS3](https://img.shields.io/badge/css3-%231572B6.svg?style=for-the-badge&logo=css3&logoColor=white) 28 | 29 |
30 |

31 | 32 | 33 | 34 | 35 | 36 | ## Screenshots 37 |
38 | Screenshot 2023-01-09 at 4 59 15 PM copy 39 | Screenshot 2023-01-09 at 5 02 27 PM copy 40 |
41 | 42 | 43 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "portfolio", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@emotion/react": "^11.10.5", 7 | "@mantine/core": "^5.9.5", 8 | "@mantine/hooks": "^5.9.5", 9 | "@react-spring/web": "^9.6.1", 10 | "@react-three/drei": "^9.51.2", 11 | "@react-three/fiber": "^8.9.1", 12 | "@testing-library/jest-dom": "^5.16.5", 13 | "@testing-library/react": "^13.4.0", 14 | "@testing-library/user-event": "^14.4.3", 15 | "@types/three": "^0.149.0", 16 | "@web3modal/ethereum": "^2.1.1", 17 | "@web3modal/react": "^2.1.1", 18 | "ethers": "^5", 19 | "gsap": "^3.11.4", 20 | "howler": "^2.2.3", 21 | "leva": "^0.9.34", 22 | "maath": "^0.5.2", 23 | "openai": "^3.1.0", 24 | "r3f-perf": "^7.1.2", 25 | "react": "^18.2.0", 26 | "react-device-detect": "^2.2.2", 27 | "react-dom": "^18.2.0", 28 | "react-howler": "^5.2.0", 29 | "react-icons": "^4.7.1", 30 | "react-scripts": "5.0.1", 31 | "react-spinners": "^0.13.7", 32 | "three": "^0.149.0", 33 | "typeit-react": "^2.6.4", 34 | "wagmi": "^0.11.7", 35 | "web-vitals": "^3.1.1", 36 | "zustand": "^4.1.5" 37 | }, 38 | "scripts": { 39 | "start": "react-scripts start", 40 | "build": "react-scripts build", 41 | "test": "react-scripts test", 42 | "eject": "react-scripts eject" 43 | }, 44 | "eslintConfig": { 45 | "extends": [ 46 | "react-app", 47 | "react-app/jest" 48 | ] 49 | }, 50 | "browserslist": { 51 | "production": [ 52 | ">0.2%", 53 | "not dead", 54 | "not op_mini all" 55 | ], 56 | "development": [ 57 | "last 1 chrome version", 58 | "last 1 firefox version", 59 | "last 1 safari version" 60 | ] 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /public/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/.DS_Store -------------------------------------------------------------------------------- /public/SF-Pro-Display-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/SF-Pro-Display-Bold.otf -------------------------------------------------------------------------------- /public/android-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/android-icon-144x144.png -------------------------------------------------------------------------------- /public/android-icon-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/android-icon-192x192.png -------------------------------------------------------------------------------- /public/android-icon-36x36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/android-icon-36x36.png -------------------------------------------------------------------------------- /public/android-icon-48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/android-icon-48x48.png -------------------------------------------------------------------------------- /public/android-icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/android-icon-72x72.png -------------------------------------------------------------------------------- /public/android-icon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/android-icon-96x96.png -------------------------------------------------------------------------------- /public/apple-icon-114x114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/apple-icon-114x114.png -------------------------------------------------------------------------------- /public/apple-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/apple-icon-120x120.png -------------------------------------------------------------------------------- /public/apple-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/apple-icon-144x144.png -------------------------------------------------------------------------------- /public/apple-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/apple-icon-152x152.png -------------------------------------------------------------------------------- /public/apple-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/apple-icon-180x180.png -------------------------------------------------------------------------------- /public/apple-icon-57x57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/apple-icon-57x57.png -------------------------------------------------------------------------------- /public/apple-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/apple-icon-60x60.png -------------------------------------------------------------------------------- /public/apple-icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/apple-icon-72x72.png -------------------------------------------------------------------------------- /public/apple-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/apple-icon-76x76.png -------------------------------------------------------------------------------- /public/apple-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/apple-icon-precomposed.png -------------------------------------------------------------------------------- /public/apple-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/apple-icon.png -------------------------------------------------------------------------------- /public/audio/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/.DS_Store -------------------------------------------------------------------------------- /public/audio/1.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/1.mp3 -------------------------------------------------------------------------------- /public/audio/10.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/10.mp3 -------------------------------------------------------------------------------- /public/audio/11.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/11.mp3 -------------------------------------------------------------------------------- /public/audio/12.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/12.mp3 -------------------------------------------------------------------------------- /public/audio/13.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/13.mp3 -------------------------------------------------------------------------------- /public/audio/14.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/14.mp3 -------------------------------------------------------------------------------- /public/audio/15.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/15.mp3 -------------------------------------------------------------------------------- /public/audio/16.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/16.mp3 -------------------------------------------------------------------------------- /public/audio/17.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/17.mp3 -------------------------------------------------------------------------------- /public/audio/18.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/18.mp3 -------------------------------------------------------------------------------- /public/audio/19.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/19.mp3 -------------------------------------------------------------------------------- /public/audio/2.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/2.mp3 -------------------------------------------------------------------------------- /public/audio/20.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/20.mp3 -------------------------------------------------------------------------------- /public/audio/21.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/21.mp3 -------------------------------------------------------------------------------- /public/audio/3.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/3.mp3 -------------------------------------------------------------------------------- /public/audio/4.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/4.mp3 -------------------------------------------------------------------------------- /public/audio/5.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/5.mp3 -------------------------------------------------------------------------------- /public/audio/6.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/6.mp3 -------------------------------------------------------------------------------- /public/audio/7.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/7.mp3 -------------------------------------------------------------------------------- /public/audio/8.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/8.mp3 -------------------------------------------------------------------------------- /public/audio/9.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/9.mp3 -------------------------------------------------------------------------------- /public/audio/arpC.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/arpC.mp3 -------------------------------------------------------------------------------- /public/audio/casette.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/casette.mp3 -------------------------------------------------------------------------------- /public/audio/enter.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/enter.mp3 -------------------------------------------------------------------------------- /public/audio/padC.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/padC.mp3 -------------------------------------------------------------------------------- /public/audio/padFAndArp.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/audio/padFAndArp.mp3 -------------------------------------------------------------------------------- /public/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | #ffffff -------------------------------------------------------------------------------- /public/diamond.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/diamond.glb -------------------------------------------------------------------------------- /public/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/favicon-16x16.png -------------------------------------------------------------------------------- /public/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/favicon-32x32.png -------------------------------------------------------------------------------- /public/favicon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/favicon-96x96.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | The Element 32 | 33 | 34 | 35 |
36 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /public/kanji.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "The Element", 3 | "short_name": "The Element", 4 | "theme_color": "#fc038c", 5 | "background_color": "#000000", 6 | "display": "browser", 7 | "orientation": "portrait", 8 | "scope": "/app/", 9 | "start_url": "", 10 | "icons": [ 11 | { 12 | "src": "\/android-icon-36x36.png", 13 | "sizes": "36x36", 14 | "type": "image\/png", 15 | "density": "0.75" 16 | }, 17 | { 18 | "src": "\/android-icon-48x48.png", 19 | "sizes": "48x48", 20 | "type": "image\/png", 21 | "density": "1.0" 22 | }, 23 | { 24 | "src": "\/android-icon-72x72.png", 25 | "sizes": "72x72", 26 | "type": "image\/png", 27 | "density": "1.5" 28 | }, 29 | { 30 | "src": "\/android-icon-96x96.png", 31 | "sizes": "96x96", 32 | "type": "image\/png", 33 | "density": "2.0" 34 | }, 35 | { 36 | "src": "\/android-icon-144x144.png", 37 | "sizes": "144x144", 38 | "type": "image\/png", 39 | "density": "3.0" 40 | }, 41 | { 42 | "src": "\/android-icon-192x192.png", 43 | "sizes": "192x192", 44 | "type": "image\/png", 45 | "density": "4.0" 46 | } 47 | ] 48 | } -------------------------------------------------------------------------------- /public/ms-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/ms-icon-144x144.png -------------------------------------------------------------------------------- /public/ms-icon-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/ms-icon-150x150.png -------------------------------------------------------------------------------- /public/ms-icon-310x310.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/ms-icon-310x310.png -------------------------------------------------------------------------------- /public/ms-icon-70x70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/public/ms-icon-70x70.png -------------------------------------------------------------------------------- /public/wordmark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/screenshot.png -------------------------------------------------------------------------------- /screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/screenshot2.png -------------------------------------------------------------------------------- /screenshot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/screenshot3.png -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonzhep/theelement/c534b5c53815916072fb6c8d41acd2ad959ae9f2/src/.DS_Store -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import "./styles.css"; 2 | import { Canvas } from "@react-three/fiber"; 3 | import useStore from "./store"; 4 | import { useSpring, animated } from "@react-spring/web"; 5 | import { PulseLoader } from "react-spinners"; 6 | import InputBar from "./InputBar"; 7 | import AudioController from "./AudioController"; 8 | import { Configuration, OpenAIApi } from "openai"; 9 | 10 | import { 11 | Image, 12 | Text, 13 | Group, 14 | Center as CenterMantine, 15 | Container, 16 | ActionIcon, 17 | Stack, 18 | Modal, 19 | } from "@mantine/core"; 20 | import { useState, useEffect, useRef } from "react"; 21 | import { isMobile } from "react-device-detect"; 22 | import { VscTwitter, VscQuestion } from "react-icons/vsc"; 23 | import { BsFillArrowRightCircleFill, BsWordpress } from "react-icons/bs"; 24 | import { FaDiscord } from "react-icons/fa"; 25 | import { MdOutlineMail } from "react-icons/md"; 26 | import Env from "./Env"; 27 | import Scene from "./Scene"; 28 | import Postproduction from "./Postproduction"; 29 | import TypeIt from "typeit-react"; 30 | import { Perf } from 'r3f-perf' 31 | import { Leva } from 'leva' 32 | 33 | import { 34 | EthereumClient, 35 | modalConnectors, 36 | walletConnectProvider, 37 | } from "@web3modal/ethereum"; 38 | 39 | 40 | 41 | import { Web3Modal } from "@web3modal/react"; 42 | 43 | import { configureChains, createClient, WagmiConfig } from "wagmi"; 44 | 45 | import { arbitrum, mainnet, polygon } from "wagmi/chains"; 46 | 47 | import { Web3Button } from "@web3modal/react"; 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | const chains = [arbitrum, mainnet, polygon]; 56 | 57 | // Wagmi client 58 | const { provider } = configureChains(chains, [ 59 | walletConnectProvider({ projectId: "adc7318acda7c5926f7c5fe38010f1e1" }), 60 | ]); 61 | const wagmiClient = createClient({ 62 | autoConnect: true, 63 | connectors: modalConnectors({ 64 | projectId: "adc7318acda7c5926f7c5fe38010f1e1", 65 | version: "1", // or "2" 66 | appName: "web3Modal", 67 | chains, 68 | }), 69 | provider, 70 | }); 71 | 72 | // Web3Modal Ethereum Client 73 | const ethereumClient = new EthereumClient(wagmiClient, chains); 74 | 75 | 76 | 77 | 78 | function App() { 79 | 80 | 81 | 82 | 83 | 84 | 85 | const configuration = new Configuration({ 86 | apiKey: process.env.REACT_APP_OPENAI_API_KEY, 87 | }); 88 | const openai = new OpenAIApi(configuration); 89 | 90 | const [colorOne, setColorOne] = useState("#000000"); 91 | const [colorTwo, setColorTwo] = useState("#150050"); 92 | const [colorThree, setColorThree] = useState("#3F0071"); 93 | const [colorFour, setColorFour] = useState("#000000"); 94 | const [colorFive, setColorFive] = useState("#000000"); 95 | 96 | 97 | const [word, setWord] = useState(""); 98 | 99 | const [finalPrompt, setFinalPrompt] = useState( 100 | "The following is a conversation with an extremely rude and pesimistic AI Philosopher. The philosopher is really rude in replies, says bit in every reply, gives japanese haiku's in kanji randomly, and asks deep questions about insecurities.\n\nHuman: Hello, who are you?\nAI: I am an AI created by OpenAI. Why are you here? " 101 | ); 102 | const [firstClick, setFirstClick] = useState(0); 103 | const [aiOutput, setAiOutput] = useState(); 104 | const inputStore = useStore((state) => state.inputStore); 105 | const [firstInput, setFirstInput] = useState(false); 106 | const [inputHeaderText, setInputHeaderText] = useState(""); 107 | const [enterIncrement, setEnterIncrement] = useState(0); 108 | const [loading, setLoading] = useState(false); 109 | const [opened, setOpened] = useState(false); 110 | const [about, setAbout] = useState(false); 111 | const [modalSize, setModalSize] = useState("25%"); 112 | const [modalFont, setModalFont] = useState(20); 113 | const [typeIts, setTypeIts] = useState([]); 114 | 115 | const generateResponse2 = async (inputt) => { 116 | setFirstClick(firstClick + 1); 117 | const combined = finalPrompt + "\nHuman:" + inputt + "\nAI:"; 118 | 119 | const response = await openai.createCompletion({ 120 | model: "text-davinci-003", 121 | prompt: combined, 122 | temperature: 0.9, 123 | max_tokens: 300, 124 | top_p: 1, 125 | frequency_penalty: 0.76, 126 | presence_penalty: 0.75, 127 | stop: [" Human:", " AI:"], 128 | }); 129 | const response2 = await openai.createCompletion({ 130 | model: "text-davinci-003", 131 | prompt: 132 | "Five different hex value colors that are a color palette for " + 133 | inputt + 134 | " , and then on a new line describe that sentiment as either optimistic or pessimistic: \n\n", 135 | temperature: 0, 136 | max_tokens: 64, 137 | top_p: 1.0, 138 | frequency_penalty: 0.0, 139 | presence_penalty: 0.0, 140 | stop: [";"], 141 | }); 142 | 143 | setAiOutput(response.data.choices[0].text); 144 | api4.start({ 145 | delay: 200, 146 | 147 | from: { 148 | opacity: 1, 149 | }, 150 | to: { 151 | opacity: 0, 152 | }, 153 | config: { 154 | duration: 1500, 155 | }, 156 | onResolve: () => { 157 | setLoading(false); 158 | }, 159 | }); 160 | 161 | api3.start({ 162 | delay: 1000, 163 | 164 | from: { 165 | opacity: 0, 166 | }, 167 | to: { 168 | opacity: 1, 169 | }, 170 | config: { 171 | duration: 1000, 172 | }, 173 | }); 174 | let split = response2.data.choices[0].text 175 | .split(",") 176 | .map((color) => color.split("#")[1]); 177 | console.log(response2.data.choices[0].text); 178 | 179 | setColorOne("#" + split[0].slice(0, 6)); 180 | setColorTwo("#" + split[1].slice(0, 6)); 181 | setColorThree("#" + split[2].slice(0, 6)); 182 | setColorFour("#" + split[3].slice(0, 6)); 183 | setColorFive("#" + split[4].slice(0, 6)); 184 | if ( 185 | split[4].trim().includes("Optimistic") || 186 | split[4].trim().includes("optimistic") 187 | ) { 188 | setWord("optimistic"); 189 | } 190 | if ( 191 | split[4].trim().includes("Pessimistic") || 192 | split[4].trim().includes("pessimistic") 193 | ) { 194 | setWord("pessimistic"); 195 | } 196 | const appended = combined + response.data.choices[0].text; 197 | setFinalPrompt(appended); 198 | }; 199 | 200 | useEffect(() => { 201 | if (aiOutput === undefined) return; 202 | const newTypeIt = ( 203 | { 207 | document.querySelector(".ti-cursor").style.display = "none"; 208 | }, 209 | speed: 60, 210 | }} 211 | > 212 | {aiOutput} 213 | 214 | ); 215 | 216 | setTypeIts([...typeIts, newTypeIt]); 217 | }, [aiOutput]); 218 | 219 | useEffect(() => { 220 | setEnterIncrement(enterIncrement + 1); 221 | if (inputStore.length > 0) { 222 | setLoading(true); 223 | 224 | api.start({ 225 | delay: 100, 226 | 227 | from: { 228 | opacity: 1, 229 | }, 230 | to: { 231 | opacity: 0, 232 | }, 233 | config: { 234 | duration: 2000, 235 | }, 236 | onResolve: () => { 237 | setFirstInput(true); 238 | }, 239 | }); 240 | api2.start({ 241 | delay: 100, 242 | 243 | from: { 244 | opacity: 1, 245 | }, 246 | to: { 247 | opacity: 0, 248 | }, 249 | config: { 250 | duration: 2000, 251 | }, 252 | onResolve: () => { 253 | setInputHeaderText(inputStore); 254 | }, 255 | }); 256 | api2.start({ 257 | delay: 2000, 258 | 259 | from: { 260 | opacity: 0, 261 | }, 262 | to: { 263 | opacity: 1, 264 | }, 265 | config: { 266 | duration: 2000, 267 | }, 268 | }); 269 | api3.start({ 270 | delay: 0, 271 | 272 | from: { 273 | opacity: 1, 274 | }, 275 | to: { 276 | opacity: 0, 277 | }, 278 | config: { 279 | duration: 1000, 280 | }, 281 | }); 282 | api4.start({ 283 | delay: 1500, 284 | 285 | from: { 286 | opacity: 0, 287 | }, 288 | to: { 289 | opacity: 1, 290 | }, 291 | config: { 292 | duration: 1500, 293 | }, 294 | }); 295 | 296 | generateResponse2(inputStore); 297 | } 298 | }, [inputStore]); 299 | 300 | const [springs, api] = useSpring(() => ({ 301 | from: { opacity: 0 }, 302 | })); 303 | const [springs2, api2] = useSpring(() => ({ 304 | from: { opacity: 0 }, 305 | })); 306 | const [springs3, api3] = useSpring(() => ({ 307 | from: { opacity: 1 }, 308 | })); 309 | const [springs4, api4] = useSpring(() => ({ 310 | from: { opacity: 1 }, 311 | })); 312 | const [springs5, api5] = useSpring(() => ({ 313 | from: { opacity: 0 }, 314 | })); 315 | 316 | useEffect(() => { 317 | api.start({ 318 | delay: 1000, 319 | 320 | from: { 321 | opacity: 0, 322 | }, 323 | to: { 324 | opacity: 1, 325 | }, 326 | config: { 327 | duration: 7000, 328 | }, 329 | }); 330 | api5.start({ 331 | delay: 1000, 332 | 333 | from: { 334 | opacity: 0, 335 | }, 336 | to: { 337 | opacity: 1, 338 | }, 339 | config: { 340 | duration: 3000, 341 | }, 342 | }); 343 | }, []); 344 | 345 | useEffect(() => { 346 | if (isMobile) { 347 | setOpened(true); 348 | setModalSize("100%"); 349 | setModalFont(18); 350 | } 351 | }, [isMobile]); 352 | 353 | return ( 354 | <> 355 | {/* Wordmark and Question Mark */} 356 | {/* */} 367 |
377 | 378 | 379 | setAbout(true)} 381 | className="questionIcon" 382 | size={25} 383 | style={{ fill: "black" }} 384 | /> 385 | 386 | 387 |
388 | 389 | {/* Header */} 390 |
400 | 401 | 402 | 403 | {firstInput ? ( 404 | 405 | 406 | {inputHeaderText} 407 | 408 | 409 | ) : ( 410 | 411 | { 415 | document.querySelector(".ti-cursor").style.display = 416 | "none"; 417 | }, 418 | }} 419 | > 420 | Hello, why are you here? 421 | 422 | 423 | )} 424 | 425 | {loading ? ( 426 | 427 | 433 | 434 | ) : ( 435 | 436 | {typeIts.map((typeIt, index) => { 437 | if (index === typeIts.length - 1) { 438 | return
{typeIt}
; 439 | } 440 | })} 441 |
442 | )} 443 |
444 |
445 |
446 |
447 | 448 | {/* Input Bar */} 449 | 450 | 451 | 452 | 453 | {/* About */} 454 | 455 | 456 | 457 | 458 | 459 | 460 | 464 | 465 | 466 | setAbout(false)} 474 | transition="fade" 475 | transitionDuration={2000} 476 | transitionTimingFunction="ease" 477 | exitTransitionDuration={2000} 478 | > 479 | 480 | 481 | 482 | 483 |
484 | Let The Alchemist take you on a reflective journey 485 |
486 | {"\n"} 487 |
488 |
489 | Created by Charm 490 |
491 | 492 | 493 | 494 | 496 | window.open("https://twitter.com/EmpireofCHARM", "_blank") 497 | } 498 | > 499 | 500 | 501 | 503 | window.open( 504 | "https://discord.gg/KfhCscmcF7", 505 | "_blank" 506 | ) 507 | } 508 | > 509 | 510 | 511 | 512 | 513 |
514 | 515 |
516 |
517 |
518 | 519 | {/* Modal to display if user is on mobile */} 520 | {/* {isMobile && ( 521 | setOpened(false)} 529 | transition="fade" 530 | transitionDuration={600} 531 | transitionTimingFunction="ease" 532 | exitTransitionDuration={600} 533 | > 534 | 535 | 536 |
537 | Visit The Element on desktop for audio. 538 |
539 | setOpened(false)} 541 | style={{ fill: "#ffffff" }} 542 | size={30} 543 | /> 544 |
545 |
546 |
547 | )} */} 548 | 549 | {/* React Three Fiber Canvas */} 550 |