Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new “AI Toolkit” private page and adds a backend OpenWeather proxy endpoint to support location-based weather display, alongside dependency and auth redirect updates.
Changes:
- Add
/api/openweather/:lat/:lonendpoint and wire it into the server. - Add new
client/private/AI-Toolkit/page (HTML/CSS/JS) using TFJS + geolocation + weather/map UI. - Update Clerk sign-in/sign-up redirects to land on the private dashboard; replace
axioswithnode-fetch.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| server/index.js | Imports and registers the new OpenWeather API route. |
| server/aiSearch.js | Adds OpenWeather handler and exports it alongside existing Gemini handlers. |
| package.json | Removes axios and adds node-fetch dependency. |
| package-lock.json | Lockfile updates reflecting dependency swap to node-fetch. |
| client/public/Accounts/signup.html | Updates post-signup redirect to private dashboard. |
| client/public/Accounts/signin.html | Updates post-signin redirect to private dashboard. |
| client/private/AI-Toolkit/toolkit.js | Implements TFJS model loading, image upload prediction, and weather/map fetching via new API route. |
| client/private/AI-Toolkit/toolkit.html | Adds the AI Toolkit UI page structure. |
| client/private/AI-Toolkit/toolkit.css | Adds styles for the AI Toolkit UI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+27
to
+39
| async function endpoint_openWeatherAPI(req, res) | ||
| { | ||
| const { lat, lon } = req.params; | ||
| const wres = await fetch(`https://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${lon}&appid=${process.env.OPENWEATHER_API_KEY}&units=metric`); | ||
| const data = await wres.json(); | ||
| res.json({ | ||
| name: data.name, | ||
| weather: data.weather[0].description, | ||
| temp: data.main.temp, | ||
| humidity: data.main.humidity, | ||
| wind: data.wind.speed | ||
| }); | ||
| } |
| app.get('/api/gemini/youtube', endpoint_geminiYoutubeSearch); | ||
| app.post('/api/gemini/chat', express.json(), geminiChatBot.endpoint_chatbot.bind(geminiChatBot)); | ||
|
|
||
| app.get('/api/openweather/:lat/:lon', endpoint_openWeatherAPI); |
Comment on lines
+49
to
+58
| <script src="script.js"></script> | ||
|
|
||
| </body> | ||
|
|
||
| </html> | ||
|
|
||
| <script src="../AI-Toolkit/toolkit.js"></script> | ||
| </body> | ||
|
|
||
| </html> No newline at end of file |
Comment on lines
+35
to
+36
| <iframe id="gmaps" style="border:0" loading="lazy" allowfullscreen | ||
| src="https://maps.google.com/maps?q=0,0&z=15&output=embed"> |
Comment on lines
+93
to
+111
| upload.addEventListener('change', async (e) => { | ||
| const file = e.target.files[0]; | ||
| img.src = URL.createObjectURL(file); | ||
|
|
||
| img.onload = async () => { | ||
| const tensor = tf.browser.fromPixels(img) | ||
| .resizeNearestNeighbor([224, 224]) | ||
| .toFloat() | ||
| .expandDims(); | ||
|
|
||
| const predictions = await model.predict(tensor).data(); | ||
|
|
||
| const topIdx = predictions.indexOf(Math.max(...predictions)); | ||
|
|
||
| getLocationAndStart(); | ||
|
|
||
| predictionText.innerHTML = `Predicted: ${topIdx}`; | ||
| } | ||
| }); No newline at end of file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets Fix This Shit