Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
.idea/
__pycache__/
*.pyc
.env
.env
venv/
35 changes: 25 additions & 10 deletions Frontend/Analysis/analysis.css
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,15 @@ body::before {
top: calc(100% + 6px);
left: 0;
width: 100%;

display: block;

background: #1e293b;
border: 2px solid red;

background: rgba(26, 31, 46, 0.95);
backdrop-filter: blur(12px);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 12px;
max-height: 220px;

overflow-y: auto;

z-index: 999999;

box-shadow: 0 10px 25px rgba(0,0,0,0.5);
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.city-suggestions.hidden {
Expand All @@ -188,12 +183,32 @@ body::before {
.city-suggestion-item {
padding: 12px 14px;
cursor: pointer;
color: white;
color: var(--text-primary, #ffffff);
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
font-size: 0.9rem;
transition: background-color 0.2s ease, color 0.2s ease;
}

.city-suggestion-item:hover {
background: rgba(56, 189, 248, 0.15);
color: #ffffff;
}

/* Light mode styles for autocomplete suggestions */
[data-theme="light"] .city-suggestions {
background: rgba(255, 255, 255, 0.98);
border: 1px solid rgba(0, 0, 0, 0.1);
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .city-suggestion-item {
color: #0f172a;
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .city-suggestion-item:hover {
background: rgba(3, 105, 161, 0.08);
color: #0369a1;
}

.city-autocomplete {
Expand Down
2 changes: 1 addition & 1 deletion Frontend/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,7 @@ body.light-mode .navbar {
text-align: center;
justify-content: center;
}
}

/* Capability cards — same white-alpha issue */
[data-theme="light"] .capability-card {
Expand Down Expand Up @@ -1291,7 +1292,6 @@ body.light-mode .navbar {
[data-theme="light"] .footer-links a:hover {
color: #0369a1;
}
}

/* Scroll to Top Button */
#scrollTopBtn,
Expand Down
12 changes: 12 additions & 0 deletions Frontend/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,25 @@

if (!btn || !icon) return;

const updateBodyClasses = (theme) => {
if (theme === 'light') {
document.body.classList.add('light-theme', 'light-mode');
} else {
document.body.classList.remove('light-theme', 'light-mode');
}
};

// Initialize body classes on page load
updateBodyClasses(initial);

icon.textContent = initial === 'light' ? '🌙' : '☀️';

btn.addEventListener('click', function () {
const current = document.documentElement.getAttribute('data-theme');
const next = current === 'dark' ? 'light' : 'dark';

document.documentElement.setAttribute('data-theme', next);
updateBodyClasses(next);
localStorage.setItem('theme', next);
icon.textContent = next === 'light' ? '🌙' : '☀️';

Expand Down
23 changes: 16 additions & 7 deletions backend/alertsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,19 +683,28 @@ def city_suggestions():

@app.route("/chatbot", methods=["POST"])
def chatbot():
data = request.get_json(silent=True) or {}

# Attempt to proxy request to the Advanced Chatbot Server (Port 5001)
try:
chatbot_url = os.environ.get("CHATBOT_API_URL", "http://127.0.0.1:5001/chatbot")
resp = requests.post(chatbot_url, json=data, timeout=5)
if resp.status_code == 200:
return jsonify(resp.json()), resp.status_code
print(f"Chatbot server returned status code {resp.status_code}. Falling back to in-process chatbot.")
except Exception as e:
print(f"Could not connect to Chatbot Server on port 5001 ({e}). Falling back to in-process chatbot.")

# Fallback to local in-process handler
try:
data = request.get_json(silent=True) or {}
payload, status = handle_chatbot_request(data)
return jsonify(payload), status

except Exception:

except Exception as local_err:
print(f"Local chatbot error: {local_err}")
return jsonify({
"success": False,
"message":
"Chatbot unavailable."
})
"message": "Chatbot unavailable."
}), 500

# =========================================================
# LOCAL RUN
Expand Down
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Flask>=3.0.0
Flask-CORS>=4.0.0
requests>=2.31.0
python-dotenv>=1.0.0
gunicorn>=21.2.0