Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Flask app from a JSON API-style endpoint to a server-rendered “results” flow, adds a dedicated results page UI, and introduces resiliency improvements in the flight/news/classifier service calls.
Changes:
- Adds
templates/results.htmland extendsstatic/style.cssto support the results UI (flight summary, category tiles, filtering). - Refactors
app.pyto serve/and handle POST/results, rendering HTML on both success and error paths. - Adds retry logic in
services/news.pyandservices/classifier.py, and improves failure handling inservices/flight.py.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| templates/results.html | New results page template with error states, flight summary, and article list/filtering. |
| static/style.css | Styling for results page components and category tiles. |
| services/news.py | Adds retry handling around the WorldNews API request. |
| services/flight.py | Adds more defensive handling for AviationStack responses. |
| services/classifier.py | Adds retry handling around Gemini classification requests. |
| app.py | Adds / route and converts the results flow to server-rendered HTML via POST /results. |
| .gitignore | Updates ignore patterns. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
94
to
+95
| if __name__ == "__main__": | ||
| app.run(debug=True) | ||
| app.run(host="0.0.0.0", port=5001, debug=True) |
Comment on lines
+27
to
+30
| try: | ||
| response = requests.get(f"{BASE_URL}/search-news", params=params) | ||
| data = response.json() | ||
| break # got valid JSON back, stop retrying |
Comment on lines
+49
to
+51
| articles = [] | ||
|
|
||
| for result in data["news"]: |
Comment on lines
+47
to
+50
| response = requests.get( | ||
| f"{BASE_URL}/flights?access_key={TOKEN}&flight_iata={flight_number}" | ||
| ) | ||
| data = response.json() |
Comment on lines
+46
to
+51
| {% elif stage == 'news' %} | ||
| {% if reason == 'no_local_articles' or reason == 'no_articles_found' %} | ||
| We found your flight, but couldn't find any local stories for your destination yet. | ||
| {% else %} | ||
| We found your flight, but couldn't load local news right now. Please try again shortly. | ||
| {% endif %} |
Comment on lines
+105
to
+106
| {% set slug = article.category|lower|replace(' ', '-') %} | ||
| <a class="news-card" data-category="{{ slug }}" href="{{ article.url }}" target="_blank" rel="noopener noreferrer"> |
Comment on lines
25
to
+27
| @import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,wght@1,500;1,600&display=swap'); | ||
| @import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap'); | ||
| @import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400&display=swap'); |
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.
No description provided.