initial files
0 parents
Showing
23 changed files
with
1121 additions
and
0 deletions
client/.gitignore
0 → 100644
| 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 | # production | ||
| 12 | /build | ||
| 13 | |||
| 14 | # misc | ||
| 15 | .DS_Store | ||
| 16 | .env.local | ||
| 17 | .env.development.local | ||
| 18 | .env.test.local | ||
| 19 | .env.production.local | ||
| 20 | |||
| 21 | npm-debug.log* | ||
| 22 | yarn-debug.log* | ||
| 23 | yarn-error.log* |
client/README.md
0 → 100644
| 1 | # Getting Started with Create React App | ||
| 2 | |||
| 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). | ||
| 4 | |||
| 5 | ## Available Scripts | ||
| 6 | |||
| 7 | In the project directory, you can run: | ||
| 8 | |||
| 9 | ### `npm start` | ||
| 10 | |||
| 11 | Runs the app in the development mode.\ | ||
| 12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser. | ||
| 13 | |||
| 14 | The page will reload when you make changes.\ | ||
| 15 | You may also see any lint errors in the console. | ||
| 16 | |||
| 17 | ### `npm test` | ||
| 18 | |||
| 19 | Launches the test runner in the interactive watch mode.\ | ||
| 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. | ||
| 21 | |||
| 22 | ### `npm run build` | ||
| 23 | |||
| 24 | Builds the app for production to the `build` folder.\ | ||
| 25 | It correctly bundles React in production mode and optimizes the build for the best performance. | ||
| 26 | |||
| 27 | The build is minified and the filenames include the hashes.\ | ||
| 28 | Your app is ready to be deployed! | ||
| 29 | |||
| 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. | ||
| 31 | |||
| 32 | ### `npm run eject` | ||
| 33 | |||
| 34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!** | ||
| 35 | |||
| 36 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. | ||
| 37 | |||
| 38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. | ||
| 39 | |||
| 40 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. | ||
| 41 | |||
| 42 | ## Learn More | ||
| 43 | |||
| 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). | ||
| 45 | |||
| 46 | To learn React, check out the [React documentation](https://reactjs.org/). | ||
| 47 | |||
| 48 | ### Code Splitting | ||
| 49 | |||
| 50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) | ||
| 51 | |||
| 52 | ### Analyzing the Bundle Size | ||
| 53 | |||
| 54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) | ||
| 55 | |||
| 56 | ### Making a Progressive Web App | ||
| 57 | |||
| 58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) | ||
| 59 | |||
| 60 | ### Advanced Configuration | ||
| 61 | |||
| 62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) | ||
| 63 | |||
| 64 | ### Deployment | ||
| 65 | |||
| 66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) | ||
| 67 | |||
| 68 | ### `npm run build` fails to minify | ||
| 69 | |||
| 70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) |
client/package.json
0 → 100644
| 1 | { | ||
| 2 | "name": "chatgpt-client", | ||
| 3 | "version": "0.1.0", | ||
| 4 | "private": true, | ||
| 5 | "dependencies": { | ||
| 6 | "@testing-library/jest-dom": "^5.16.5", | ||
| 7 | "@testing-library/react": "^13.4.0", | ||
| 8 | "@testing-library/user-event": "^13.5.0", | ||
| 9 | "react": "^18.2.0", | ||
| 10 | "react-dom": "^18.2.0", | ||
| 11 | "react-scripts": "5.0.1", | ||
| 12 | "web-vitals": "^2.1.4" | ||
| 13 | }, | ||
| 14 | "scripts": { | ||
| 15 | "start": "react-scripts start", | ||
| 16 | "build": "react-scripts build", | ||
| 17 | "test": "react-scripts test", | ||
| 18 | "eject": "react-scripts eject" | ||
| 19 | }, | ||
| 20 | "eslintConfig": { | ||
| 21 | "extends": [ | ||
| 22 | "react-app", | ||
| 23 | "react-app/jest" | ||
| 24 | ] | ||
| 25 | }, | ||
| 26 | "browserslist": { | ||
| 27 | "production": [ | ||
| 28 | ">0.2%", | ||
| 29 | "not dead", | ||
| 30 | "not op_mini all" | ||
| 31 | ], | ||
| 32 | "development": [ | ||
| 33 | "last 1 chrome version", | ||
| 34 | "last 1 firefox version", | ||
| 35 | "last 1 safari version" | ||
| 36 | ] | ||
| 37 | }, | ||
| 38 | "devDependencies": { | ||
| 39 | "autoprefixer": "^10.4.13", | ||
| 40 | "postcss": "^8.4.20" | ||
| 41 | } | ||
| 42 | } |
client/public/favicon.ico
0 → 100644
No preview for this file type
client/public/index.html
0 → 100644
| 1 | <!DOCTYPE html> | ||
| 2 | <html lang="en"> | ||
| 3 | <head> | ||
| 4 | <meta charset="utf-8" /> | ||
| 5 | <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> | ||
| 6 | <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
| 7 | <meta name="theme-color" content="#000000" /> | ||
| 8 | <meta | ||
| 9 | name="description" | ||
| 10 | content="Web site created using create-react-app" | ||
| 11 | /> | ||
| 12 | <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> | ||
| 13 | <!-- | ||
| 14 | manifest.json provides metadata used when your web app is installed on a | ||
| 15 | user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ | ||
| 16 | --> | ||
| 17 | <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> | ||
| 18 | <!-- | ||
| 19 | Notice the use of %PUBLIC_URL% in the tags above. | ||
| 20 | It will be replaced with the URL of the `public` folder during the build. | ||
| 21 | Only files inside the `public` folder can be referenced from the HTML. | ||
| 22 | |||
| 23 | Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
| 24 | work correctly both with client-side routing and a non-root public URL. | ||
| 25 | Learn how to configure a non-root public URL by running `npm run build`. | ||
| 26 | --> | ||
| 27 | <title>AI-Pro ChatGPT</title> | ||
| 28 | </head> | ||
| 29 | <body> | ||
| 30 | <noscript>You need to enable JavaScript to run this app.</noscript> | ||
| 31 | <div id="root"></div> | ||
| 32 | <!-- | ||
| 33 | This HTML file is a template. | ||
| 34 | If you open it directly in the browser, you will see an empty page. | ||
| 35 | |||
| 36 | You can add webfonts, meta tags, or analytics to this file. | ||
| 37 | The build step will place the bundled scripts into the <body> tag. | ||
| 38 | |||
| 39 | To begin the development, run `npm start` or `yarn start`. | ||
| 40 | To create a production bundle, use `npm run build` or `yarn build`. | ||
| 41 | --> | ||
| 42 | </body> | ||
| 43 | </html> |
client/public/logo192.png
0 → 100644
5.22 KB
client/public/logo512.png
0 → 100644
9.44 KB
client/public/manifest.json
0 → 100644
| 1 | { | ||
| 2 | "short_name": "React App", | ||
| 3 | "name": "Create React App Sample", | ||
| 4 | "icons": [ | ||
| 5 | { | ||
| 6 | "src": "favicon.ico", | ||
| 7 | "sizes": "64x64 32x32 24x24 16x16", | ||
| 8 | "type": "image/x-icon" | ||
| 9 | }, | ||
| 10 | { | ||
| 11 | "src": "logo192.png", | ||
| 12 | "type": "image/png", | ||
| 13 | "sizes": "192x192" | ||
| 14 | }, | ||
| 15 | { | ||
| 16 | "src": "logo512.png", | ||
| 17 | "type": "image/png", | ||
| 18 | "sizes": "512x512" | ||
| 19 | } | ||
| 20 | ], | ||
| 21 | "start_url": ".", | ||
| 22 | "display": "standalone", | ||
| 23 | "theme_color": "#000000", | ||
| 24 | "background_color": "#ffffff" | ||
| 25 | } |
client/public/robots.txt
0 → 100644
client/src/App.css
0 → 100644
| 1 | .App { | ||
| 2 | display:flex; | ||
| 3 | background-color: #282c34; | ||
| 4 | color:white; | ||
| 5 | position:absolute; | ||
| 6 | top:0;bottom:0;right:0;left:0; | ||
| 7 | } | ||
| 8 | |||
| 9 | .sidemenu { | ||
| 10 | width:260px; | ||
| 11 | padding:10px; | ||
| 12 | background-color:#202123; | ||
| 13 | } | ||
| 14 | /* under 640px do this */ | ||
| 15 | @media (max-width: 640px) { | ||
| 16 | .sidemenu { | ||
| 17 | display:none; | ||
| 18 | } | ||
| 19 | } | ||
| 20 | |||
| 21 | .side-menu-button { | ||
| 22 | padding:12px; | ||
| 23 | border:1px solid white; | ||
| 24 | border-radius:5px; | ||
| 25 | text-align: left; | ||
| 26 | transition:ease 0.25s all; | ||
| 27 | cursor:pointer; | ||
| 28 | } | ||
| 29 | .side-menu-button:hover { | ||
| 30 | background-color:rgba(255,255,255,0.1); | ||
| 31 | } | ||
| 32 | .side-menu-button span { | ||
| 33 | padding-left:6px; | ||
| 34 | padding-right:12px; | ||
| 35 | } | ||
| 36 | |||
| 37 | .chatbox { | ||
| 38 | flex:1; | ||
| 39 | background-color:#343541; | ||
| 40 | position:relative; | ||
| 41 | overflow-y:scroll; | ||
| 42 | padding-bottom:95px; | ||
| 43 | } | ||
| 44 | |||
| 45 | .App-logo { | ||
| 46 | height: 40vmin; | ||
| 47 | pointer-events: none; | ||
| 48 | } | ||
| 49 | |||
| 50 | @media (prefers-reduced-motion: no-preference) { | ||
| 51 | .App-logo { | ||
| 52 | animation: App-logo-spin infinite 20s linear; | ||
| 53 | } | ||
| 54 | } | ||
| 55 | |||
| 56 | .chat-input-holder { | ||
| 57 | padding:24px; | ||
| 58 | position:absolute; | ||
| 59 | bottom:0; | ||
| 60 | left:0;right:0; | ||
| 61 | } | ||
| 62 | .chat-input-textarea { | ||
| 63 | background-color:#40414f; | ||
| 64 | width:90%; | ||
| 65 | padding:12px; | ||
| 66 | border-radius:5px; | ||
| 67 | color:white; | ||
| 68 | font-size:1.25em; | ||
| 69 | border:none; | ||
| 70 | outline:none; | ||
| 71 | box-shadow: 0 0 8px 0 rgba(0,0,0,0.25); | ||
| 72 | } | ||
| 73 | |||
| 74 | .App-header { | ||
| 75 | background-color: #282c34; | ||
| 76 | min-height: 100vh; | ||
| 77 | display: flex; | ||
| 78 | flex-direction: column; | ||
| 79 | align-items: center; | ||
| 80 | justify-content: center; | ||
| 81 | font-size: calc(10px + 2vmin); | ||
| 82 | color: white; | ||
| 83 | } | ||
| 84 | |||
| 85 | .App-link { | ||
| 86 | color: #61dafb; | ||
| 87 | } | ||
| 88 | |||
| 89 | .chat-log { | ||
| 90 | position: absolute; | ||
| 91 | top:0;right:0;bottom:89px;left:0; | ||
| 92 | overflow-y:scroll; | ||
| 93 | text-align:left; | ||
| 94 | } | ||
| 95 | |||
| 96 | .chat-message.chatgpt { | ||
| 97 | background-color:#444654; | ||
| 98 | } | ||
| 99 | .chat-message-center { | ||
| 100 | max-width:640px; | ||
| 101 | margin-left:auto; | ||
| 102 | margin-right:auto; | ||
| 103 | display:flex; | ||
| 104 | padding:12px; | ||
| 105 | padding-left: 24px; | ||
| 106 | padding-right: 24px; | ||
| 107 | |||
| 108 | } | ||
| 109 | .avatar { | ||
| 110 | background:white; | ||
| 111 | border-radius:50%; | ||
| 112 | width: 40px; | ||
| 113 | height: 40px; | ||
| 114 | display:flex; | ||
| 115 | align-items:center; | ||
| 116 | justify-content:center; | ||
| 117 | padding:5px; | ||
| 118 | font-size:14px; | ||
| 119 | color:#444654; | ||
| 120 | } | ||
| 121 | .avatar.chatgpt { | ||
| 122 | background:#0da37f; | ||
| 123 | border-radius:50%; | ||
| 124 | min-width: 40px; | ||
| 125 | min-height: 40px; | ||
| 126 | padding:5px; | ||
| 127 | color:white; | ||
| 128 | } | ||
| 129 | .message { | ||
| 130 | padding-left: 40px; | ||
| 131 | padding-right: 40px; | ||
| 132 | } | ||
| 133 | |||
| 134 | @keyframes App-logo-spin { | ||
| 135 | from { | ||
| 136 | transform: rotate(0deg); | ||
| 137 | } | ||
| 138 | to { | ||
| 139 | transform: rotate(360deg); | ||
| 140 | } | ||
| 141 | } | ||
| 142 | |||
| 143 | .select-models { | ||
| 144 | border: 1px solid white; | ||
| 145 | padding:12px; | ||
| 146 | border-radius:5px; | ||
| 147 | color:white; | ||
| 148 | background:transparent; | ||
| 149 | outline:none; | ||
| 150 | cursor:pointer; | ||
| 151 | max-width:100%; | ||
| 152 | min-width:100%; | ||
| 153 | } | ||
| 154 | .select-models option { | ||
| 155 | background:black; | ||
| 156 | color:white; | ||
| 157 | } | ||
| 158 | |||
| 159 | .button-picker { | ||
| 160 | border:none; | ||
| 161 | padding:6px 12px ; | ||
| 162 | border-radius:5px; | ||
| 163 | color:white; | ||
| 164 | background:#444654; | ||
| 165 | margin-top:6px; | ||
| 166 | cursor: pointer; | ||
| 167 | } | ||
| 168 | .button-picker:hover { | ||
| 169 | background:#626473; | ||
| 170 | } | ||
| 171 | |||
| 172 | .info { | ||
| 173 | opacity:0.66; | ||
| 174 | font-size:0.8em; | ||
| 175 | margin-top:6px; | ||
| 176 | } | ||
| 177 | |||
| 178 | .side-label { | ||
| 179 | font-size:0.9em; | ||
| 180 | margin-top:1em; | ||
| 181 | margin-bottom:0.5em; | ||
| 182 | padding-bottom:0em; | ||
| 183 | display:block; | ||
| 184 | } | ||
| 185 | |||
| 186 | .form { | ||
| 187 | display:flex; | ||
| 188 | gap:6px; | ||
| 189 | } | ||
| 190 | |||
| 191 | .submit { | ||
| 192 | background: none; | ||
| 193 | color: inherit; | ||
| 194 | border: none; | ||
| 195 | padding: 0; | ||
| 196 | font: inherit; | ||
| 197 | cursor: pointer; | ||
| 198 | outline: inherit; | ||
| 199 | background:#0da37f; | ||
| 200 | display:flex; | ||
| 201 | align-items:center; | ||
| 202 | justify-content:center; | ||
| 203 | padding:5px 12px; | ||
| 204 | font-size:14px; | ||
| 205 | color:white; | ||
| 206 | border-radius:5px; | ||
| 207 | cursor: pointer; | ||
| 208 | } | ||
| 209 | .submit:hover { | ||
| 210 | background:#066d55; | ||
| 211 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
client/src/App.js
0 → 100644
| 1 | import './normal.css'; | ||
| 2 | import './App.css'; | ||
| 3 | import { useState, useEffect } from 'react'; | ||
| 4 | import SideMenu from './SideMenu' | ||
| 5 | import ChatBox from './ChatBox' | ||
| 6 | |||
| 7 | function App() { | ||
| 8 | |||
| 9 | useEffect(() => { | ||
| 10 | getEngines(); | ||
| 11 | }, []) | ||
| 12 | |||
| 13 | const [chatInput, setChatInput] = useState(""); | ||
| 14 | const [models, setModels] = useState([]); | ||
| 15 | const [temperature, setTemperature] = useState(0.5); | ||
| 16 | const [currentModel, setCurrentModel] = useState("text-davinci-003"); | ||
| 17 | const [chatLog, setChatLog] = useState([{ | ||
| 18 | user: "gpt", | ||
| 19 | message: "Welcome to AI-PRO... How can I help you?" | ||
| 20 | }]); | ||
| 21 | |||
| 22 | // clear chats | ||
| 23 | function clearChat(){ | ||
| 24 | setChatLog([]); | ||
| 25 | } | ||
| 26 | |||
| 27 | function getEngines(){ | ||
| 28 | fetch("http://localhost:3080/models") | ||
| 29 | .then(res => res.json()) | ||
| 30 | .then(data => { | ||
| 31 | console.log(data.models.data) | ||
| 32 | // set models in order alpahbetically | ||
| 33 | data.models.data.sort((a, b) => { | ||
| 34 | if(a.id < b.id) { return -1; } | ||
| 35 | if(a.id > b.id) { return 1; } | ||
| 36 | return 0; | ||
| 37 | }) | ||
| 38 | setModels(data.models.data) | ||
| 39 | }) | ||
| 40 | } | ||
| 41 | |||
| 42 | async function handleSubmit(e){ | ||
| 43 | e.preventDefault(); | ||
| 44 | let chatLogNew = [...chatLog, { user: "me", message: `${chatInput}`} ] | ||
| 45 | setChatInput(""); | ||
| 46 | setChatLog(chatLogNew) | ||
| 47 | // fetch response to the api combining the chat log array of messages and seinding it as a message to localhost:3000 as a post | ||
| 48 | const messages = chatLogNew.map((message) => message.message).join("\n") | ||
| 49 | |||
| 50 | const response = await fetch("http://localhost:3080/", { | ||
| 51 | method: "POST", | ||
| 52 | headers: { | ||
| 53 | "Content-Type": "application/json" | ||
| 54 | }, | ||
| 55 | body: JSON.stringify({ | ||
| 56 | message: messages, | ||
| 57 | currentModel, | ||
| 58 | }) | ||
| 59 | }); | ||
| 60 | const data = await response.json(); | ||
| 61 | setChatLog([...chatLogNew, { user: "gpt", message: `${data.message}`} ]) | ||
| 62 | var scrollToTheBottomChatLog = document.getElementsByClassName("chat-log")[0]; | ||
| 63 | scrollToTheBottomChatLog.scrollTop = scrollToTheBottomChatLog.scrollHeight; | ||
| 64 | } | ||
| 65 | |||
| 66 | function handleTemp(temp) { | ||
| 67 | if(temp > 1){ | ||
| 68 | setTemperature(1) | ||
| 69 | } else if (temp < 0){ | ||
| 70 | setTemperature(0) | ||
| 71 | } else { | ||
| 72 | setTemperature(temp) | ||
| 73 | } | ||
| 74 | |||
| 75 | } | ||
| 76 | |||
| 77 | return ( | ||
| 78 | <div className="App"> | ||
| 79 | <SideMenu | ||
| 80 | currentModel={currentModel} | ||
| 81 | setCurrentModel={setCurrentModel} | ||
| 82 | models={models} | ||
| 83 | setTemperature={handleTemp} | ||
| 84 | temperature={temperature} | ||
| 85 | clearChat={clearChat} | ||
| 86 | /> | ||
| 87 | <ChatBox | ||
| 88 | chatInput={chatInput} | ||
| 89 | chatLog={chatLog} | ||
| 90 | setChatInput={setChatInput} | ||
| 91 | handleSubmit={handleSubmit} /> | ||
| 92 | </div> | ||
| 93 | ); | ||
| 94 | } | ||
| 95 | |||
| 96 | |||
| 97 | export default App; |
client/src/App.test.js
0 → 100644
client/src/ChatBox.js
0 → 100644
| 1 | import OpenAISVGLogo from './OpenAISVGLogo' | ||
| 2 | |||
| 3 | // Primary Chat Window | ||
| 4 | const ChatBox = ({chatLog, setChatInput, handleSubmit, chatInput}) => | ||
| 5 | <section className="chatbox"> | ||
| 6 | <div className="chat-log"> | ||
| 7 | {chatLog.map((message, index) => ( | ||
| 8 | <ChatMessage key={index} message={message} /> | ||
| 9 | ))} | ||
| 10 | </div> | ||
| 11 | <div className="chat-input-holder"> | ||
| 12 | <form className="form" onSubmit={handleSubmit}> | ||
| 13 | <input | ||
| 14 | rows="1" | ||
| 15 | value={chatInput} | ||
| 16 | onChange={(e)=> setChatInput(e.target.value)} | ||
| 17 | className="chat-input-textarea" ></input> | ||
| 18 | <button className="submit" type="submit">Submit</button> | ||
| 19 | </form> | ||
| 20 | </div> | ||
| 21 | </section> | ||
| 22 | |||
| 23 | // Individual Chat Message | ||
| 24 | const ChatMessage = ({ message }) => { | ||
| 25 | return ( | ||
| 26 | <div className={`chat-message ${message.user === "gpt" && "chatgpt"}`}> | ||
| 27 | <div className="chat-message-center"> | ||
| 28 | <div className={`avatar ${message.user === "gpt" && "chatgpt"}`}> | ||
| 29 | {message.user === "gpt" ? <OpenAISVGLogo /> : <div>You</div>} | ||
| 30 | </div> | ||
| 31 | <div className="message"> | ||
| 32 | {message.message} | ||
| 33 | </div> | ||
| 34 | </div> | ||
| 35 | </div> | ||
| 36 | ) | ||
| 37 | } | ||
| 38 | |||
| 39 | export default ChatBox | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
client/src/OpenAISVGLogo.js
0 → 100644
| 1 | // OpenAI SVG Logo | ||
| 2 | const OpenAISVGLogo = () => | ||
| 3 | <svg | ||
| 4 | fill="none" | ||
| 5 | xmlns="http://www.w3.org/2000/svg" | ||
| 6 | strokeWidth={1.5} | ||
| 7 | viewBox="0 0 40 40" | ||
| 8 | > | ||
| 9 | <path | ||
| 10 | d="M37.532 16.87a9.963 9.963 0 0 0-.856-8.184 10.078 10.078 0 0 0-10.855-4.835A9.964 9.964 0 0 0 18.306.5a10.079 10.079 0 0 0-9.614 6.977 9.967 9.967 0 0 0-6.664 4.834 10.08 10.08 0 0 0 1.24 11.817 9.965 9.965 0 0 0 .856 8.185 10.079 10.079 0 0 0 10.855 4.835 9.965 9.965 0 0 0 7.516 3.35 10.078 10.078 0 0 0 9.617-6.981 9.967 9.967 0 0 0 6.663-4.834 10.079 10.079 0 0 0-1.243-11.813ZM22.498 37.886a7.474 7.474 0 0 1-4.799-1.735c.061-.033.168-.091.237-.134l7.964-4.6a1.294 1.294 0 0 0 .655-1.134V19.054l3.366 1.944a.12.12 0 0 1 .066.092v9.299a7.505 7.505 0 0 1-7.49 7.496ZM6.392 31.006a7.471 7.471 0 0 1-.894-5.023c.06.036.162.099.237.141l7.964 4.6a1.297 1.297 0 0 0 1.308 0l9.724-5.614v3.888a.12.12 0 0 1-.048.103l-8.051 4.649a7.504 7.504 0 0 1-10.24-2.744ZM4.297 13.62A7.469 7.469 0 0 1 8.2 10.333c0 .068-.004.19-.004.274v9.201a1.294 1.294 0 0 0 .654 1.132l9.723 5.614-3.366 1.944a.12.12 0 0 1-.114.01L7.04 23.856a7.504 7.504 0 0 1-2.743-10.237Zm27.658 6.437-9.724-5.615 3.367-1.943a.121.121 0 0 1 .113-.01l8.052 4.648a7.498 7.498 0 0 1-1.158 13.528v-9.476a1.293 1.293 0 0 0-.65-1.132Zm3.35-5.043c-.059-.037-.162-.099-.236-.141l-7.965-4.6a1.298 1.298 0 0 0-1.308 0l-9.723 5.614v-3.888a.12.12 0 0 1 .048-.103l8.05-4.645a7.497 7.497 0 0 1 11.135 7.763Zm-21.063 6.929-3.367-1.944a.12.12 0 0 1-.065-.092v-9.299a7.497 7.497 0 0 1 12.293-5.756 6.94 6.94 0 0 0-.236.134l-7.965 4.6a1.294 1.294 0 0 0-.654 1.132l-.006 11.225Zm1.829-3.943 4.33-2.501 4.332 2.5v5l-4.331 2.5-4.331-2.5V18Z" | ||
| 11 | fill="currentColor" | ||
| 12 | /> | ||
| 13 | </svg> | ||
| 14 | |||
| 15 | export default OpenAISVGLogo | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
client/src/SideMenu.js
0 → 100644
| 1 | const SideMenu = ({ clearChat, currentModel, setCurrentModel, models, setTemperature, temperature }) => | ||
| 2 | <aside className="sidemenu"> | ||
| 3 | <div className="side-menu-button" onClick={clearChat}> | ||
| 4 | <span>+</span> | ||
| 5 | New Chat | ||
| 6 | </div> | ||
| 7 | <div className="models"> | ||
| 8 | <label className="side-label">Model</label> | ||
| 9 | <select | ||
| 10 | // active if model is select is currentModel | ||
| 11 | value={currentModel} | ||
| 12 | className="select-models" | ||
| 13 | onChange={(e)=>{ | ||
| 14 | setCurrentModel(e.target.value) | ||
| 15 | }}> | ||
| 16 | {models && models.length ? models.map((model, index) => ( | ||
| 17 | <option | ||
| 18 | key={model.id} | ||
| 19 | value={model.id}>{model.id}</option> | ||
| 20 | )) : <option | ||
| 21 | key={"text-davinci-003"} | ||
| 22 | value={"text-davinci-003"}>{"text-davinci-003"}</option>} | ||
| 23 | </select> | ||
| 24 | |||
| 25 | <Button | ||
| 26 | text="Smart - Davinci" | ||
| 27 | onClick={()=>setCurrentModel("text-davinci-003")} /> | ||
| 28 | <Button | ||
| 29 | text="Code - Crushman" | ||
| 30 | onClick={()=>setCurrentModel("code-cushman-001")} /> | ||
| 31 | <span className="info"> | ||
| 32 | The model parameter controls the engine used to generate the response. Davinci produces best results. | ||
| 33 | </span> | ||
| 34 | <label className="side-label" >Temperature</label> | ||
| 35 | <input | ||
| 36 | className="select-models" | ||
| 37 | type="number" | ||
| 38 | onChange={(e)=> setTemperature(e.target.value)} | ||
| 39 | min="0" | ||
| 40 | max="1" | ||
| 41 | step="0.1" | ||
| 42 | value={temperature} | ||
| 43 | /> | ||
| 44 | <Button | ||
| 45 | text="0 - Logical" | ||
| 46 | onClick={()=>setTemperature(0)} /> | ||
| 47 | <Button | ||
| 48 | text="0.5 - Balanced" | ||
| 49 | onClick={()=>setTemperature(0.5)} /> | ||
| 50 | <Button | ||
| 51 | text="1 - Creative" | ||
| 52 | onClick={()=>setTemperature(1)} /> | ||
| 53 | <span className="info"> | ||
| 54 | The temperature parameter controls the randomness of the model. 0 is the most logical, 1 is the most creative. | ||
| 55 | </span> | ||
| 56 | </div> | ||
| 57 | </aside> | ||
| 58 | |||
| 59 | const Button = ({ onClick, text }) => | ||
| 60 | <div | ||
| 61 | className="button-picker" | ||
| 62 | onClick={onClick}> | ||
| 63 | {text} | ||
| 64 | </div> | ||
| 65 | |||
| 66 | export default SideMenu | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
client/src/index.css
0 → 100644
| 1 | body { | ||
| 2 | margin: 0; | ||
| 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', | ||
| 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', | ||
| 5 | sans-serif; | ||
| 6 | -webkit-font-smoothing: antialiased; | ||
| 7 | -moz-osx-font-smoothing: grayscale; | ||
| 8 | } | ||
| 9 | |||
| 10 | code { | ||
| 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', | ||
| 12 | monospace; | ||
| 13 | } |
client/src/index.js
0 → 100644
| 1 | import React from 'react'; | ||
| 2 | import ReactDOM from 'react-dom/client'; | ||
| 3 | import './index.css'; | ||
| 4 | import App from './App'; | ||
| 5 | import reportWebVitals from './reportWebVitals'; | ||
| 6 | |||
| 7 | const root = ReactDOM.createRoot(document.getElementById('root')); | ||
| 8 | root.render( | ||
| 9 | <React.StrictMode> | ||
| 10 | <App /> | ||
| 11 | </React.StrictMode> | ||
| 12 | ); | ||
| 13 | |||
| 14 | // If you want to start measuring performance in your app, pass a function | ||
| 15 | // to log results (for example: reportWebVitals(console.log)) | ||
| 16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals | ||
| 17 | reportWebVitals(); |
client/src/logo.svg
0 → 100644
| 1 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
client/src/normal.css
0 → 100644
| 1 | /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ | ||
| 2 | |||
| 3 | /* Document | ||
| 4 | ========================================================================== */ | ||
| 5 | |||
| 6 | /** | ||
| 7 | * 1. Correct the line height in all browsers. | ||
| 8 | * 2. Prevent adjustments of font size after orientation changes in iOS. | ||
| 9 | */ | ||
| 10 | |||
| 11 | html { | ||
| 12 | line-height: 1.15; /* 1 */ | ||
| 13 | -webkit-text-size-adjust: 100%; /* 2 */ | ||
| 14 | } | ||
| 15 | |||
| 16 | /* Sections | ||
| 17 | ========================================================================== */ | ||
| 18 | |||
| 19 | /** | ||
| 20 | * Remove the margin in all browsers. | ||
| 21 | */ | ||
| 22 | |||
| 23 | body { | ||
| 24 | margin: 0; | ||
| 25 | } | ||
| 26 | |||
| 27 | html { | ||
| 28 | -webkit-box-sizing: border-box; | ||
| 29 | -moz-box-sizing: border-box; | ||
| 30 | box-sizing: border-box; | ||
| 31 | } | ||
| 32 | |||
| 33 | *, | ||
| 34 | *::before, | ||
| 35 | *::after { | ||
| 36 | -webkit-box-sizing: inherit; | ||
| 37 | -moz-box-sizing: inherit; | ||
| 38 | box-sizing: inherit; | ||
| 39 | } | ||
| 40 | |||
| 41 | /** | ||
| 42 | * Render the `main` element consistently in IE. | ||
| 43 | */ | ||
| 44 | |||
| 45 | main { | ||
| 46 | display: block; | ||
| 47 | } | ||
| 48 | |||
| 49 | /** | ||
| 50 | * Correct the font size and margin on `h1` elements within `section` and | ||
| 51 | * `article` contexts in Chrome, Firefox, and Safari. | ||
| 52 | */ | ||
| 53 | |||
| 54 | h1 { | ||
| 55 | font-size: 2em; | ||
| 56 | margin: 0.67em 0; | ||
| 57 | } | ||
| 58 | |||
| 59 | /* Grouping content | ||
| 60 | ========================================================================== */ | ||
| 61 | |||
| 62 | /** | ||
| 63 | * 1. Add the correct box sizing in Firefox. | ||
| 64 | * 2. Show the overflow in Edge and IE. | ||
| 65 | */ | ||
| 66 | |||
| 67 | hr { | ||
| 68 | box-sizing: content-box; /* 1 */ | ||
| 69 | height: 0; /* 1 */ | ||
| 70 | overflow: visible; /* 2 */ | ||
| 71 | } | ||
| 72 | |||
| 73 | /** | ||
| 74 | * 1. Correct the inheritance and scaling of font size in all browsers. | ||
| 75 | * 2. Correct the odd `em` font sizing in all browsers. | ||
| 76 | */ | ||
| 77 | |||
| 78 | pre { | ||
| 79 | font-family: monospace, monospace; /* 1 */ | ||
| 80 | font-size: 1em; /* 2 */ | ||
| 81 | } | ||
| 82 | |||
| 83 | /* Text-level semantics | ||
| 84 | ========================================================================== */ | ||
| 85 | |||
| 86 | /** | ||
| 87 | * Remove the gray background on active links in IE 10. | ||
| 88 | */ | ||
| 89 | |||
| 90 | a { | ||
| 91 | background-color: transparent; | ||
| 92 | } | ||
| 93 | |||
| 94 | /** | ||
| 95 | * 1. Remove the bottom border in Chrome 57- | ||
| 96 | * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. | ||
| 97 | */ | ||
| 98 | |||
| 99 | abbr[title] { | ||
| 100 | border-bottom: none; /* 1 */ | ||
| 101 | text-decoration: underline; /* 2 */ | ||
| 102 | text-decoration: underline dotted; /* 2 */ | ||
| 103 | } | ||
| 104 | |||
| 105 | /** | ||
| 106 | * Add the correct font weight in Chrome, Edge, and Safari. | ||
| 107 | */ | ||
| 108 | |||
| 109 | b, | ||
| 110 | strong { | ||
| 111 | font-weight: bolder; | ||
| 112 | } | ||
| 113 | |||
| 114 | /** | ||
| 115 | * 1. Correct the inheritance and scaling of font size in all browsers. | ||
| 116 | * 2. Correct the odd `em` font sizing in all browsers. | ||
| 117 | */ | ||
| 118 | |||
| 119 | code, | ||
| 120 | kbd, | ||
| 121 | samp { | ||
| 122 | font-family: monospace, monospace; /* 1 */ | ||
| 123 | font-size: 1em; /* 2 */ | ||
| 124 | } | ||
| 125 | |||
| 126 | /** | ||
| 127 | * Add the correct font size in all browsers. | ||
| 128 | */ | ||
| 129 | |||
| 130 | small { | ||
| 131 | font-size: 80%; | ||
| 132 | } | ||
| 133 | |||
| 134 | /** | ||
| 135 | * Prevent `sub` and `sup` elements from affecting the line height in | ||
| 136 | * all browsers. | ||
| 137 | */ | ||
| 138 | |||
| 139 | sub, | ||
| 140 | sup { | ||
| 141 | font-size: 75%; | ||
| 142 | line-height: 0; | ||
| 143 | position: relative; | ||
| 144 | vertical-align: baseline; | ||
| 145 | } | ||
| 146 | |||
| 147 | sub { | ||
| 148 | bottom: -0.25em; | ||
| 149 | } | ||
| 150 | |||
| 151 | sup { | ||
| 152 | top: -0.5em; | ||
| 153 | } | ||
| 154 | |||
| 155 | /* Embedded content | ||
| 156 | ========================================================================== */ | ||
| 157 | |||
| 158 | /** | ||
| 159 | * Remove the border on images inside links in IE 10. | ||
| 160 | */ | ||
| 161 | |||
| 162 | img { | ||
| 163 | border-style: none; | ||
| 164 | } | ||
| 165 | |||
| 166 | /* Forms | ||
| 167 | ========================================================================== */ | ||
| 168 | |||
| 169 | /** | ||
| 170 | * 1. Change the font styles in all browsers. | ||
| 171 | * 2. Remove the margin in Firefox and Safari. | ||
| 172 | */ | ||
| 173 | |||
| 174 | button, | ||
| 175 | input, | ||
| 176 | optgroup, | ||
| 177 | select, | ||
| 178 | textarea { | ||
| 179 | font-family: inherit; /* 1 */ | ||
| 180 | font-size: 100%; /* 1 */ | ||
| 181 | line-height: 1.15; /* 1 */ | ||
| 182 | margin: 0; /* 2 */ | ||
| 183 | } | ||
| 184 | |||
| 185 | /** | ||
| 186 | * Show the overflow in IE. | ||
| 187 | * 1. Show the overflow in Edge. | ||
| 188 | */ | ||
| 189 | |||
| 190 | button, | ||
| 191 | input { /* 1 */ | ||
| 192 | overflow: visible; | ||
| 193 | } | ||
| 194 | |||
| 195 | /** | ||
| 196 | * Remove the inheritance of text transform in Edge, Firefox, and IE. | ||
| 197 | * 1. Remove the inheritance of text transform in Firefox. | ||
| 198 | */ | ||
| 199 | |||
| 200 | button, | ||
| 201 | select { /* 1 */ | ||
| 202 | text-transform: none; | ||
| 203 | } | ||
| 204 | |||
| 205 | /** | ||
| 206 | * Correct the inability to style clickable types in iOS and Safari. | ||
| 207 | */ | ||
| 208 | |||
| 209 | button, | ||
| 210 | [type="button"], | ||
| 211 | [type="reset"], | ||
| 212 | [type="submit"] { | ||
| 213 | -webkit-appearance: button; | ||
| 214 | } | ||
| 215 | |||
| 216 | /** | ||
| 217 | * Remove the inner border and padding in Firefox. | ||
| 218 | */ | ||
| 219 | |||
| 220 | button::-moz-focus-inner, | ||
| 221 | [type="button"]::-moz-focus-inner, | ||
| 222 | [type="reset"]::-moz-focus-inner, | ||
| 223 | [type="submit"]::-moz-focus-inner { | ||
| 224 | border-style: none; | ||
| 225 | padding: 0; | ||
| 226 | } | ||
| 227 | |||
| 228 | /** | ||
| 229 | * Restore the focus styles unset by the previous rule. | ||
| 230 | */ | ||
| 231 | |||
| 232 | button:-moz-focusring, | ||
| 233 | [type="button"]:-moz-focusring, | ||
| 234 | [type="reset"]:-moz-focusring, | ||
| 235 | [type="submit"]:-moz-focusring { | ||
| 236 | outline: 1px dotted ButtonText; | ||
| 237 | } | ||
| 238 | |||
| 239 | /** | ||
| 240 | * Correct the padding in Firefox. | ||
| 241 | */ | ||
| 242 | |||
| 243 | fieldset { | ||
| 244 | padding: 0.35em 0.75em 0.625em; | ||
| 245 | } | ||
| 246 | |||
| 247 | /** | ||
| 248 | * 1. Correct the text wrapping in Edge and IE. | ||
| 249 | * 2. Correct the color inheritance from `fieldset` elements in IE. | ||
| 250 | * 3. Remove the padding so developers are not caught out when they zero out | ||
| 251 | * `fieldset` elements in all browsers. | ||
| 252 | */ | ||
| 253 | |||
| 254 | legend { | ||
| 255 | box-sizing: border-box; /* 1 */ | ||
| 256 | color: inherit; /* 2 */ | ||
| 257 | display: table; /* 1 */ | ||
| 258 | max-width: 100%; /* 1 */ | ||
| 259 | padding: 0; /* 3 */ | ||
| 260 | white-space: normal; /* 1 */ | ||
| 261 | } | ||
| 262 | |||
| 263 | /** | ||
| 264 | * Add the correct vertical alignment in Chrome, Firefox, and Opera. | ||
| 265 | */ | ||
| 266 | |||
| 267 | progress { | ||
| 268 | vertical-align: baseline; | ||
| 269 | } | ||
| 270 | |||
| 271 | /** | ||
| 272 | * Remove the default vertical scrollbar in IE 10+. | ||
| 273 | */ | ||
| 274 | |||
| 275 | textarea { | ||
| 276 | overflow: auto; | ||
| 277 | } | ||
| 278 | |||
| 279 | /** | ||
| 280 | * 1. Add the correct box sizing in IE 10. | ||
| 281 | * 2. Remove the padding in IE 10. | ||
| 282 | */ | ||
| 283 | |||
| 284 | [type="checkbox"], | ||
| 285 | [type="radio"] { | ||
| 286 | box-sizing: border-box; /* 1 */ | ||
| 287 | padding: 0; /* 2 */ | ||
| 288 | } | ||
| 289 | |||
| 290 | /** | ||
| 291 | * Correct the cursor style of increment and decrement buttons in Chrome. | ||
| 292 | */ | ||
| 293 | |||
| 294 | [type="number"]::-webkit-inner-spin-button, | ||
| 295 | [type="number"]::-webkit-outer-spin-button { | ||
| 296 | height: auto; | ||
| 297 | } | ||
| 298 | |||
| 299 | /** | ||
| 300 | * 1. Correct the odd appearance in Chrome and Safari. | ||
| 301 | * 2. Correct the outline style in Safari. | ||
| 302 | */ | ||
| 303 | |||
| 304 | [type="search"] { | ||
| 305 | -webkit-appearance: textfield; /* 1 */ | ||
| 306 | outline-offset: -2px; /* 2 */ | ||
| 307 | } | ||
| 308 | |||
| 309 | /** | ||
| 310 | * Remove the inner padding in Chrome and Safari on macOS. | ||
| 311 | */ | ||
| 312 | |||
| 313 | [type="search"]::-webkit-search-decoration { | ||
| 314 | -webkit-appearance: none; | ||
| 315 | } | ||
| 316 | |||
| 317 | /** | ||
| 318 | * 1. Correct the inability to style clickable types in iOS and Safari. | ||
| 319 | * 2. Change font properties to `inherit` in Safari. | ||
| 320 | */ | ||
| 321 | |||
| 322 | ::-webkit-file-upload-button { | ||
| 323 | -webkit-appearance: button; /* 1 */ | ||
| 324 | font: inherit; /* 2 */ | ||
| 325 | } | ||
| 326 | |||
| 327 | /* Interactive | ||
| 328 | ========================================================================== */ | ||
| 329 | |||
| 330 | /* | ||
| 331 | * Add the correct display in Edge, IE 10+, and Firefox. | ||
| 332 | */ | ||
| 333 | |||
| 334 | details { | ||
| 335 | display: block; | ||
| 336 | } | ||
| 337 | |||
| 338 | /* | ||
| 339 | * Add the correct display in all browsers. | ||
| 340 | */ | ||
| 341 | |||
| 342 | summary { | ||
| 343 | display: list-item; | ||
| 344 | } | ||
| 345 | |||
| 346 | /* Misc | ||
| 347 | ========================================================================== */ | ||
| 348 | |||
| 349 | /** | ||
| 350 | * Add the correct display in IE 10+. | ||
| 351 | */ | ||
| 352 | |||
| 353 | template { | ||
| 354 | display: none; | ||
| 355 | } | ||
| 356 | |||
| 357 | /** | ||
| 358 | * Add the correct display in IE 10. | ||
| 359 | */ | ||
| 360 | |||
| 361 | [hidden] { | ||
| 362 | display: none; | ||
| 363 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
client/src/reportWebVitals.js
0 → 100644
| 1 | const reportWebVitals = onPerfEntry => { | ||
| 2 | if (onPerfEntry && onPerfEntry instanceof Function) { | ||
| 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { | ||
| 4 | getCLS(onPerfEntry); | ||
| 5 | getFID(onPerfEntry); | ||
| 6 | getFCP(onPerfEntry); | ||
| 7 | getLCP(onPerfEntry); | ||
| 8 | getTTFB(onPerfEntry); | ||
| 9 | }); | ||
| 10 | } | ||
| 11 | }; | ||
| 12 | |||
| 13 | export default reportWebVitals; |
client/src/setupTests.js
0 → 100644
index.js
0 → 100644
| 1 | const { Configuration, OpenAIApi } = require("openai"); | ||
| 2 | const express = require('express') | ||
| 3 | const bodyParser = require('body-parser') | ||
| 4 | const cors = require('cors') | ||
| 5 | |||
| 6 | // Open AI Configuration | ||
| 7 | const configuration = new Configuration({ | ||
| 8 | organization: "org-organization", | ||
| 9 | apiKey: "sk-apiKey", | ||
| 10 | }); | ||
| 11 | const openai = new OpenAIApi(configuration); | ||
| 12 | |||
| 13 | // Express Configuration | ||
| 14 | const app = express() | ||
| 15 | const port = 3080 | ||
| 16 | |||
| 17 | app.use(bodyParser.json()) | ||
| 18 | app.use(cors()) | ||
| 19 | app.use(require('morgan')('dev')) | ||
| 20 | |||
| 21 | |||
| 22 | // Routing | ||
| 23 | |||
| 24 | // Primary Open AI Route | ||
| 25 | app.post('/', async (req, res) => { | ||
| 26 | const { message, currentModel, temperature } = req.body; | ||
| 27 | const response = await openai.createCompletion({ | ||
| 28 | model: `${currentModel}`,// "text-davinci-003", | ||
| 29 | prompt: `${message}`, | ||
| 30 | max_tokens: 100, | ||
| 31 | temperature, | ||
| 32 | }); | ||
| 33 | res.json({ | ||
| 34 | message: response.data.choices[0].text, | ||
| 35 | }) | ||
| 36 | }); | ||
| 37 | |||
| 38 | // Get Models Route | ||
| 39 | app.get('/models', async (req, res) => { | ||
| 40 | const response = await openai.listEngines(); | ||
| 41 | res.json({ | ||
| 42 | models: response.data | ||
| 43 | }) | ||
| 44 | }); | ||
| 45 | |||
| 46 | // Start the server | ||
| 47 | app.listen(port, () => { | ||
| 48 | console.log(`Example app listening at http://localhost:${port}`) | ||
| 49 | }); | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
package.json
0 → 100644
| 1 | { | ||
| 2 | "name": "chatgpt-server", | ||
| 3 | "version": "1.0.0", | ||
| 4 | "description": "", | ||
| 5 | "main": "index.js", | ||
| 6 | "scripts": { | ||
| 7 | "test": "echo \"Error: no test specified\" && exit 1" | ||
| 8 | }, | ||
| 9 | "author": "", | ||
| 10 | "license": "ISC", | ||
| 11 | "dependencies": { | ||
| 12 | "body-parser": "^1.20.1", | ||
| 13 | "cors": "^2.8.5", | ||
| 14 | "express": "^4.18.2", | ||
| 15 | "morgan": "^1.10.0", | ||
| 16 | "openai": "^3.1.0" | ||
| 17 | } | ||
| 18 | } |
-
Please register or sign in to post a comment