-
Notifications
You must be signed in to change notification settings - Fork 40
Directions Instructions refined and received in console; enhanced UX in drawer component and map rendering #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
94e935b
0ac9609
ee098d7
e1b3501
2371bd5
05bc0eb
9240d1e
e354c2b
ddc7215
a0d6cef
3297df4
7a6e2f7
9a4fb09
74d03ec
cd98e35
d67ea50
aef89d8
8c4696b
eb3a8c0
1f79913
d95aa49
26fb754
5974e0c
6f03183
91486f4
40a12eb
061808f
b09355b
367d13d
cbaf2e6
6fdadd7
1a43720
3f33d74
bc75639
f8131c4
15b2c26
7369536
b4bbb3e
b6bb112
0cb165a
6b78b58
00421f8
2ce9341
efd1ca0
4938cd7
5c0373b
74b1838
645fc72
4d6a5a2
f39b829
c1f12c0
edc79e6
0e0b900
47406ca
eebe29a
4a209dc
978cf89
b3260cb
e7084e1
fe3c788
004456e
88192ee
e4524dd
566eaf4
0b73ce8
ce6f946
902edec
eb07174
7e0ead7
3872e06
e289cb2
f34ba60
b8c0767
0e2e77b
2ebee31
aa8a89a
26461ee
3d691f8
be13110
1bdd9d4
302e6c9
9156e6f
99f35cc
53d296d
8f4f47e
d441d55
713cd49
faefff1
55e2b08
c41cd9d
78eec1b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <title>ChatGPT Demo</title> | ||
| </head> | ||
| <body> | ||
| <div id="chat-container"> | ||
| <div id="chat-log"></div> | ||
| <input type="text" id="user-input" placeholder="Type a message..." /> | ||
| <button onclick="sendMessage()">Send</button> | ||
| </div> | ||
|
|
||
| <script> | ||
| async function sendMessage() { | ||
| const userInput = document.getElementById("user-input").value; | ||
| const chatLog = document.getElementById("chat-log"); | ||
|
|
||
| // Display user message in the chat log | ||
| chatLog.innerHTML += `<div>User: ${userInput}</div>`; | ||
|
|
||
| // Send user input to the server | ||
| const response = await fetch("/send-message", { | ||
| method: "POST", | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| }, | ||
| body: JSON.stringify({ message: userInput }), | ||
| }); | ||
|
|
||
| const data = await response.json(); | ||
|
|
||
| // Display AI's response in the chat log | ||
| chatLog.innerHTML += `<div>AI: ${data.message}</div>`; | ||
| } | ||
| </script> | ||
|
Comment on lines
+14
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Were you not able to define this within the App.js context? It is JS after all and rendering something. Usually we do not touch the index.html. Also, why is there a public1 folder alongside the public folder? |
||
| </body> | ||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| const express = require("express"); | ||
| const { config } = require("dotenv"); | ||
| const { OpenAI } = require("openai"); | ||
| const cors = require("cors"); | ||
| const path = require("path"); | ||
|
|
||
| config(); | ||
|
|
||
| const app = express(); | ||
| const port = 3002; | ||
|
|
||
| const openai = new OpenAI({ | ||
| apiKey: process.env.API_KEY, | ||
| }); | ||
|
|
||
| // app.use(cors({ origin: "http://localhost:3001" })); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove comments like such |
||
| app.use(cors()); | ||
| app.use(express.static("public1")); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay public1 makes sense now, but you should have a separate project folder altogether if you run a backend for your frontend |
||
| app.use(express.json()); | ||
|
|
||
| app.post("/send-message", async (req, res) => { | ||
| const userMessage = req.body.message; | ||
|
|
||
| try { | ||
| const response = await openai.chat.completions.create({ | ||
| model: "gpt-3.5-turbo", | ||
| messages: [{ role: "user", content: userMessage }], | ||
| }); | ||
|
|
||
| const aiResponse = response.choices[0].message.content; | ||
| res.json({ message: aiResponse }); | ||
| } catch (error) { | ||
| console.error("Error processing the message:", error); | ||
| res.status(500).json({ error: "Error processing the message" }); | ||
| } | ||
| }); | ||
|
|
||
| app.listen(port, () => { | ||
| console.log(`Server running at http://localhost:${port}`); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,29 @@ | ||
| .App { | ||
| text-align: center; | ||
| /* .App { | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| } */ | ||
|
|
||
|
Comment on lines
+1
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove |
||
| @media all and (max-width: 500px) { | ||
| .app-container { | ||
| width: 10%; | ||
| } | ||
|
|
||
| .link-container, | ||
| .pills-landmarks { | ||
| display: none; | ||
| font-family: "Roboto"; | ||
| } | ||
| } | ||
|
|
||
| @media all and (min-width: 501px) { | ||
| .drawer-links { | ||
| display: none; | ||
| } | ||
|
|
||
| .pills-landmarks { | ||
| display: flex; | ||
| } | ||
| } | ||
|
|
||
| .App-logo { | ||
|
|
@@ -17,3 +41,42 @@ | |
| font-size: calc(10px + 2vmin); | ||
| color: white; | ||
| } | ||
|
|
||
| @keyframes fadeIn { | ||
| from { | ||
| opacity: 0; | ||
| } | ||
| to { | ||
| opacity: 1; | ||
| } | ||
| } | ||
|
|
||
| .ai-response { | ||
| animation: fadeIn 0.5s ease; | ||
| } | ||
|
|
||
| @keyframes fadeIn { | ||
| from { | ||
| opacity: 0; | ||
| } | ||
| to { | ||
| opacity: 1; | ||
| } | ||
| } | ||
|
|
||
| .ai-response { | ||
| animation: fadeIn 0.5s ease; | ||
| } | ||
|
|
||
| .overlay { | ||
| position: fixed; | ||
| top: 0; | ||
| left: 0; | ||
| width: 100%; | ||
| height: 100%; | ||
| backdrop-filter: blur(8px); /* Adjust the blur strength */ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comment is redundant |
||
| z-index: 1000; /* Ensure it's above other elements */ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comment is redundant |
||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please give your PRs a fitting title