diff --git a/AI-chatbot/chatbot.py b/AI-chatbot/chatbot.py index 1a6f1ca..253439d 100644 --- a/AI-chatbot/chatbot.py +++ b/AI-chatbot/chatbot.py @@ -461,6 +461,16 @@ def health_check(): def handle_chatbot_request(data): data = data or {} user_message = str(data.get("message", "")).strip() + lang = data.get("lang", "en") + + try: + if lang and lang != "en": + from deep_translator import GoogleTranslator + user_message = GoogleTranslator(source=lang, target='en').translate(user_message) + except Exception as e: + print("Chatbot translation error (input):", e) + pass + context = data.get('context') # will be None if no analysis has been run yet context_summary = "" @@ -540,6 +550,14 @@ def level(val): if response is None: response = generate_response(user_message, context_summary) + try: + if lang and lang != "en": + from deep_translator import GoogleTranslator + response = GoogleTranslator(source='en', target=lang).translate(response) + except Exception as e: + print("Chatbot translation error (response):", e) + pass + return { "success": True, "response": response diff --git a/Frontend/Analysis/analysis.html b/Frontend/Analysis/analysis.html index f1b0098..325c59d 100644 --- a/Frontend/Analysis/analysis.html +++ b/Frontend/Analysis/analysis.html @@ -12,7 +12,13 @@ + + + + + + 🌍 Climate Shield - Live climate risk analysis + Live climate risk analysis +
+ +
-Analyze now +Analyze now
- Weather analysis workspace -

Check flood and heat risk for any location in seconds.

-

+ Weather analysis workspace +

Check flood and heat risk for any location in seconds.

+

Enter a city, state, and country to pull live weather data, summarize risk, and surface alerts in a clean, readable format.

- Live - Weather fetch + Live + Weather fetch
- Fast - Risk scoring + Fast + Risk scoring
- Clear - Alert feedback + Clear + Alert feedback
@@ -97,25 +116,25 @@

Check flood and heat risk for any location in seconds.

- Analysis workflow -

One focused workspace for live weather, risk summaries, and alerts.

-

+ Analysis workflow +

One focused workspace for live weather, risk summaries, and alerts.

+

Use the form below to generate the report. The results panel appears beneath it so the flow reads like a clean report.

- Live fetch - Backend weather response + Live fetch + Backend weather response
- Risk view - Flood and heat signals + Risk view + Flood and heat signals
- Alerts - Clear output for action + Alerts + Clear output for action
@@ -124,8 +143,8 @@

One focused workspace for live weather, risk summaries, and alerts.

-

Climate Risk Analyzer

-

Search a location to generate the live weather and risk summary.

+

Climate Risk Analyzer

+

Search a location to generate the live weather and risk summary.

@@ -133,10 +152,11 @@

Climate Risk Analyzer

Location parameter fields
- + Climate Risk Analyzer
- +
- +
@@ -162,19 +184,19 @@

Climate Risk Analyzer

- - -
-