# Project export: SkyScraper

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: UC Berkeley AI Hackathon 2025
- Tagline: SkyScraper is an AI-powered aviation operations and safety platform that provides real-time flight risk assessments, weather impact analysis, ATC coordination insights, and smart rescheduling.
- Devpost: https://devpost.com/software/skyscraper
- GitHub: https://github.com/TheClassicTechno/SkyScraper
- Demo: https://www.loom.com/share/f35e6ae5d0c6421e8d92533539d3061f?sid=c39ad051-8bdb-421d-ae8f-2fd3cefd2faf
- Team: 3 GitHub contributor(s) — David Aror (47 commits), Julia (Juli) Huang (17 commits), Christopher-Anandaraj (12 commits)

## Devpost submission (written by the team)

No Devpost description available.

## README (from the GitHub repository)

# SkyScraper

by berk ai hack team

 Enhanced Flight Communication System
A real-time speech translation system powered by Google Gemini AI for aviation communication.

 AI-Powered Translation

Google Gemini AI: Context-aware translations with 95% accuracy
Aviation Context: Specialized terminology for flight communication
Multi-level Fallback: Google Translate → Basic Translate → Error handling



# ✈️ SkyScraper: Enhanced Flight Communication System

**by berk ai hack team**

---

## Overview

SkyScraper is a real-time speech and text translation system designed for aviation communication. Powered by Google Gemini AI and Google Translate, it provides context-aware, accurate translations for pilots, crew, and travelers, supporting both manual and voice input. The system is built with a modern React/Next.js frontend and a robust Flask/Python backend, communicating via REST API and Socket.IO for real-time features.

---

## Features

- **AI-Powered Translation**
  - **Google Gemini AI**: Context-aware translations with up to 95% accuracy.
  - **Aviation Context**: Specialized terminology for flight, ATC, and emergency communication.
  - **Multi-level Fallback**: Google Translate → Gemini AI → Error handling.

- **Speech Recognition**
  - Real-time voice-to-text using Google Speech Recognition.
  - Adjustable sensitivity for noisy environments (e.g., cockpits).

- **Manual Text Translation**
  - Translate typed text between 15+ languages.
  - Language auto-detection and confidence scoring.

- **User Interface**
  - Modern React/Next.js frontend.
  - Floating language assistant popup for instant access.
  - Responsive design for desktop and tablet.

- **Backend**
  - Flask API for translation, language/context info, and status.
  - Socket.IO for real-time speech events.
  - CORS enabled for seamless frontend-backend integration.

---

## Supported Languages

- English, Spanish, French, German, Italian, Portuguese, Russian, Chinese, Japanese, Korean, Arabic, Hindi, Thai, Vietnamese, Dutch, and more.

---

## Aviation Contexts

- General, ATC (Air Traffic Control), Pilot, Ground, Emergency, Weather, Navigation, etc.

---

## Quick Start

### 1. Clone the Repository

```sh
git clone https://github.com/yourusername/skyscraper.git
cd skyscraper


## Detected evidence (automated analysis)

Indexed codebase: 65 recognized source files, 564 KB.
- Anthropic (technology) — detected in the code
- CSS (language) — detected in the code
- Flask (technology) — detected in the code
- HTML (language) — detected in the code
- JavaScript (language) — detected in the code
- Next.js (technology) — detected in the code
- OpenAI (technology) — detected in the code
- Python (language) — detected in the code
- React (technology) — detected in the code
- Tailwind CSS (technology) — detected in the code
- TypeScript (language) — detected in the code
- Vercel AI SDK (technology) — detected in the code
- AI coding agent: Cursor — evidence: config files committed to the repository

## Codebase structure (from repository index)

### Files (74 of 74)

```
audio.py
back.py
flight-log/.cursor/rules/flight-log-rules.mdc
flight-log/.env
flight-log/.env.local
flight-log/.gitignore
flight-log/AI_DEMO.md
flight-log/API_SETUP.md
flight-log/app/api/ai-recommendations/route.ts
flight-log/app/api/aviation-chat/route.ts
flight-log/app/api/aviation-request/route.ts
flight-log/app/api/flight-risk/route.ts
flight-log/app/api/letta-context/route.ts
flight-log/app/api/letta-memory/route.ts
flight-log/app/api/letta-profile/route.ts
flight-log/app/components/ai-chat-agent.tsx
flight-log/app/components/ai-translate.jsx
flight-log/app/components/apple-timeline.tsx
flight-log/app/components/aviation-dashboard.tsx
flight-log/app/components/flight-booking-modal.tsx
flight-log/app/components/flight-map.tsx
flight-log/app/components/flight-risk-assessment.tsx
flight-log/app/components/flight-search.tsx
flight-log/app/components/letta-memory-dashboard.tsx
flight-log/app/components/letta-profile-settings.tsx
flight-log/app/components/main-page.tsx
flight-log/app/components/radar-overlay.tsx
flight-log/app/components/radar-time-slider.tsx
flight-log/app/components/vapid-chat-agent.jsx
flight-log/app/components/wind-field-loader.tsx
flight-log/app/components/wind-field-overlay.tsx
flight-log/app/error/page.tsx
flight-log/app/flight-score/page.tsx
flight-log/app/globals.css
flight-log/app/layout.tsx
flight-log/app/page.tsx
flight-log/components.json
flight-log/components/ai-recommendations-panel.tsx
flight-log/components/ui/badge.tsx
flight-log/components/ui/button.tsx
flight-log/components/ui/card.tsx
flight-log/components/ui/checkbox.tsx
flight-log/components/ui/dialog.tsx
flight-log/components/ui/input.tsx
flight-log/components/ui/progress.tsx
flight-log/components/ui/scroll-area.tsx
flight-log/components/ui/select.tsx
flight-log/components/ui/separator.tsx
flight-log/components/ui/slider.tsx
flight-log/lib/advanced-risk-assessment.ts
flight-log/lib/ai-flight-recommendations.ts
flight-log/lib/aviation-apis.ts
flight-log/lib/flight-booking.ts
flight-log/lib/flight-risk-assessment.ts
flight-log/lib/letta-agent.ts
flight-log/lib/turbulence-data.ts
flight-log/lib/utils.ts
flight-log/lib/vapi-client.ts
flight-log/next.config.ts
flight-log/package.json
flight-log/postcss.config.mjs
flight-log/README.md
flight-log/tailwind.config.ts
flight-log/tsconfig.json
gemini.py
gemini2.py
gemini3.py
hi.py
install.py
README.md
requirements.txt
templates/index.html
templates/indexOLD.html
test.py
```

### Dependencies

- flight-log/package.json: @ai-sdk/anthropic@^1.2.12, @ai-sdk/openai@^1.3.22, @radix-ui/react-dialog@^1.1.14, @radix-ui/react-progress@^1.1.7, @radix-ui/react-scroll-area@^1.2.9, @radix-ui/react-select@^2.2.5, @radix-ui/react-separator@^1.1.7, @radix-ui/react-slot@^1.2.3, @tailwindcss/postcss@^4, @types/leaflet@^1.9.18, @types/node@^20, @types/react@^19, @types/react-dom@^19, @vapi-ai/web@^2.3.6, ai@^4.3.16, axios@^1.10.0, class-variance-authority@^0.7.1, clsx@^2.1.1, leaflet@^1.9.4, lucide-react@^0.522.0, next@^15.3.4, openai@^5.6.0, react@^19.1.0, react-dom@^19.1.0, react-leaflet@^5.0.0, tailwind-merge@^3.3.1, tailwindcss@^4, tailwindcss-animate@^1.0.7, tw-animate-css@^1.3.4, typescript@^5
- requirements.txt: asyncio-mqtt@>=0.11.0, black@>=23.0.0, deep-translator@==1.11.4, eventlet@==0.33.3, flake8@>=6.0.0, flask@==2.3.3, Flask@==2.3.3, flask-socketio@==5.3.6, Flask-SocketIO@==5.3.6, google-generativeai@>=0.3.0, pyaudio@>=0.2.11, pytest@>=7.0.0, python-dotenv@>=1.0.0, python-engineio@==4.7.1, python-socketio@==5.8.0, requests@>=2.28.0, SpeechRecognition@==3.10.0, translate@==3.6.1

### Recent commits (newest first)

- Bug Fixes
- Merge remote-tracking branch 'refs/remotes/origin/main'
- Fix hella bugs
- Added lots of UI fixes
- Added lots of UI fixes
- Merge remote-tracking branch 'refs/remotes/origin/main'
- Final-fixes
- Added Letta for memory management of user's personal risk score, airline prefs, and flight times
- Added Letta for memory management of user's personal risk score, airline prefs, and flight times
- Sweet sweet yummy changes
- Adding english as a target language
- Dynamic Stuff with ElevenLabs
- Update README.md
- made readme
- fixed bugs related to pop up translator
- changed window size, ui, format of pop up translator
- made popup version of my translation website
- Merge branch 'main' of https://github.com/TheClassicTechno/SkyScraper
- updated goo goo gaa gaa
- Merge remote-tracking branch 'refs/remotes/origin/main'

## Key source files (fetched from GitHub, selected and truncated for size)

### flight-log/AI_DEMO.md

```markdown
# AI Flight Recommendations Demo

## Overview
The AI Flight Recommendations system provides intelligent route optimization based on real-time weather data, aircraft capabilities, and multiple safety factors. This system analyzes alternative routes and provides detailed explanations for each recommendation.

## Features

### 🤖 AI-Powered Analysis
- **Multi-factor scoring**: Safety, efficiency, and comfort scores
- **Aircraft-specific optimization**: Different recommendations for different aircraft types
- **Real-time weather integration**: Uses actual turbulence and weather data
- **Confidence scoring**: Each recommendation includes a confidence level

### 🎯 Priority-Based Recommendations
- **Safety First**: Prioritizes turbulence avoidance and weather hazards
- **Fuel Efficiency**: Optimizes for fuel savings and route efficiency
- **Passenger Comfort**: Minimizes passenger discomfort and turbulence exposure
- **Balanced**: Combines all factors for optimal overall performance

### 📊 Detailed Explanations
Each recommendation includes:
- Safety improvement percentage
- Time penalty vs. fuel savings
- Weather hazards avoided
- Confidence level in the recommendation

## How to Use

### 1. Access the AI Recommendations Panel
- Navigate to the Aviation Dashboard
- Scroll down to the "AI Flight Recommendations" section
- The panel will automatically load with sample data

### 2. Configure Your Preferences
- **Aircraft Type**: Select your aircraft (B737, B777, A320, A350, CRJ)
- **Priority**: Choose your optimization priority
- **Generate**: Click "Generate Recommendations" to analyze routes

### 3. Review Recommendations
- Each recommendation shows safety, efficiency, and comfort scores
- Click on any recommendation to see detailed explanations
- Use the "Use This Route" button to select a recommended route

## Sample Data

The demo uses a sample flight route:
- **Origin**: JFK (New York)
- **Destination**: LAX (Los Angeles)
- **Current Position**: Mid-flight over Kansas
- **Aircraft**: Boeing 737

## API Endpoint

The AI recommendations are powered by the `/api/ai-recommendations` endpoint:

```bash
POST /api/ai-recommendations
{
  "route": {
    "origin": { "lat": 40.7128, "lng": -74.0060, "name": "JFK", "icao": "KJFK" },
    "destination": { "lat": 34.0522, "lng": -118.2437, "name": "LAX", "icao": "KLAX" },
    "currentPosition": { "lat": 37.0902, "lng": -95.7129, "altitude": 35000, "timestamp": 1234567890 }
  },
  "aircraftType": "B737",
  "priority": "balanced",
  "includeTurbulenceData": true
}
```

## Technical Implementation

### AI Recommendation Engine
- **Route Alternatives**: Generates altitude variations, lateral deviations, and optimized waypoints
- **Scoring Algorithm**: Multi-factor analysis considering safety, efficiency, and comfort
- **Weather Integration**: Real-time turbulence data from multiple sources
- **Aircraft Database**: Comprehensive aircraft capabilities and limitations

### Key Components
1. **AIFlightRecommendationEngin
[truncated — 1495 more characters]
```

### flight-log/API_SETUP.md

```markdown
# Aviation API Setup Guide

This application integrates with free aviation APIs to provide accurate flight tracking and turbulence data.

## Required API Keys (Optional)

Create a `.env.local` file in the `flight-log` directory with the following API keys (all optional):

```env
# Vapi AI - AI-powered calling and messaging
# Get your key at: https://vapi.ai
NEXT_PUBLIC_VAPI_API_KEY=your_vapi_api_key_here

# OpenWeatherMap API (free tier available)
# Get your key at: https://openweathermap.org/api
NEXT_PUBLIC_OPENWEATHER_API_KEY=your_openweather_api_key_here

# FlightLabs API (free tier available)
# Get your key at: https://www.goflightlabs.com/
FLIGHTLABS_API_KEY=your_flightlabs_api_key_here
```

# Vapi AI Setup Guide

## Getting Started with Vapi AI

Your flight tracking app now includes **VapidAgent** - an AI-powered phone assistant that can make calls, send texts, and summarize conversations.

### 1. Get Your Free Vapi API Key

1. Visit [Vapi.ai](https://vapi.ai)
2. Sign up for a free account
3. Get your API key from the dashboard
4. Free tier includes: **100 minutes of calls per month**

### 2. Configure Your Environment

Add to your `.env.local` file:

```bash
# Vapi AI Configuration
NEXT_PUBLIC_VAPI_API_KEY=your_vapi_api_key_here
```

### 3. Features Available

✅ **AI-Powered Phone Calls**
- Natural language call initiation
- Intelligent conversation handling
- Call summaries and transcripts
- Multi-language support

✅ **Smart Text Messaging**
- AI-generated responses
- Context-aware conversations
- Message history tracking
- Automated follow-ups

✅ **Call Management**
- Call history and analytics
- Conversation summaries
- Voice-to-text transcription
- Integration with flight data

### 4. Testing Your Setup

1. Add your Vapi API key to `.env.local`
2. Restart your development server
3. Open the VapidAgent chat (green phone icon)
4. Try commands like:
   - "Call +1234567890 to check flight status"
   - "Send a text to +1234567890 about weather conditions"
   - "Summarize my last call"

### 5. Safety Features

- **Traffic Controller Mindset**: All operations prioritize user safety
- **Call Validation**: Phone numbers are validated before calls
- **Error Handling**: Graceful fallbacks when API is unavailable
- **Rate Limiting**: Respects Vapi's usage limits

### 6. Free Tier Limitations

- **100 minutes of calls per month**
- Basic AI assistant features
- Standard voice quality
- Rate limiting applies

### 7. Upgrading (Optional)

For production use, consider upgrading to paid plans:
- **Starter**: $10/month - 1,000 minutes
- **Professional**: $50/month - 5,000 minutes
- **Enterprise**: Custom pricing

### 8. Integration with Flight Data

VapidAgent can:
- Call airlines for flight status updates
- Send weather alerts to pilots
- Summarize flight-related conversations
- Schedule follow-up calls for delays

## Current Status

Your VapidAgent is now configured with:
- ✅ Real Vapi AI integration
- ✅ Safety-first design principles
- ✅ Graceful API
[truncated — 5600 more characters]
```

### requirements.txt

```
# Core requirements that work with conda
flask==2.3.3
flask-socketio==5.3.6
requests==2.31.0

# For translation - using a more reliable library
translate==3.6.1

# For speech recognition (optional - can be added later)
# speechrecognition==3.10.0
# pyaudio==0.2.14

# WebSocket support
python-socketio==5.8.0
eventlet==0.33.3


# Enhanced Flight Communication App Requirements

# Core Flask Dependencies
Flask==2.3.3
Flask-SocketIO==5.3.6
python-socketio==5.8.0
python-engineio==4.7.1

# AI Translation - Google Gemini (PRIMARY)
google-generativeai>=0.3.0
deep-translator==1.11.4

# Fallback Translation Services
#googletrans==4.0.0rc1
translate==3.6.1
requests>=2.28.0

# Speech Recognition
SpeechRecognition==3.10.0
pyaudio>=0.2.11
deep-translator==1.11.4

# Additional Dependencies
python-dotenv>=1.0.0
asyncio-mqtt>=0.11.0

# Development Dependencies (optional)
pytest>=7.0.0
black>=23.0.0
flake8>=6.0.0

# Platform-specific audio dependencies
# For Linux: python3-pyaudio, portaudio19-dev, pulseaudio
# For macOS: portaudio (via homebrew)
# For Windows: pyaudio wheel from https://www.lfd.uci.edu/~gohlke/pythonlibs/
```

### flight-log/package.json

```
{
  "name": "flight-log",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev --turbopack",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@ai-sdk/anthropic": "^1.2.12",
    "@ai-sdk/openai": "^1.3.22",
    "@radix-ui/react-dialog": "^1.1.14",
    "@radix-ui/react-progress": "^1.1.7",
    "@radix-ui/react-scroll-area": "^1.2.9",
    "@radix-ui/react-select": "^2.2.5",
    "@radix-ui/react-separator": "^1.1.7",
    "@radix-ui/react-slot": "^1.2.3",
    "@types/leaflet": "^1.9.18",
    "@vapi-ai/web": "^2.3.6",
    "ai": "^4.3.16",
    "axios": "^1.10.0",
    "class-variance-authority": "^0.7.1",
    "clsx": "^2.1.1",
    "leaflet": "^1.9.4",
    "lucide-react": "^0.522.0",
    "next": "^15.3.4",
    "openai": "^5.6.0",
    "react": "^19.1.0",
    "react-dom": "^19.1.0",
    "react-leaflet": "^5.0.0",
    "tailwind-merge": "^3.3.1",
    "tailwindcss-animate": "^1.0.7"
  },
  "devDependencies": {
    "@tailwindcss/postcss": "^4",
    "@types/node": "^20",
    "@types/react": "^19",
    "@types/react-dom": "^19",
    "tailwindcss": "^4",
    "tw-animate-css": "^1.3.4",
    "typescript": "^5"
  }
}

```

### flight-log/app/page.tsx

```typescript
import MainPage from "./components/main-page";

export default function Home() {
  return (
    <MainPage />
  );
}

```

### flight-log/app/layout.tsx

```typescript
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";

const geistSans = Geist({
  variable: "--font-geist-sans",
  subsets: ["latin"],
});

const geistMono = Geist_Mono({
  variable: "--font-geist-mono",
  subsets: ["latin"],
});

export const metadata: Metadata = {
  title: "Create Next App",
  description: "Generated by create next app",
};

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en">
      <body
        className={`${geistSans.variable} ${geistMono.variable} antialiased`}
      >
        {children}

      </body>
    </html>
  );
}

```

### flight-log/app/flight-score/page.tsx

```typescript
import AviationDashboard from "../components/aviation-dashboard";

export default function Home() {
  return (
   <AviationDashboard />
  );
}

```

### flight-log/app/error/page.tsx

```typescript
"use client"
import { Search, Plane, AlertCircle, ArrowLeft, HelpCircle, RefreshCw } from "lucide-react"
import { Card, CardContent } from "@/components/ui/card"
import { Badge } from "@/components/ui/badge"


export default function Home() {
    return (
        <div className="min-h-screen bg-gradient-to-br from-blue-50 via-white to-sky-50">
      {/* Header */}
      <header className="bg-white/80 backdrop-blur-sm border-b border-blue-100 sticky top-0 z-50">
        <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
          <div className="flex items-center justify-between h-16">
            <div className="flex items-center gap-3">
              <div className="p-2 bg-blue-600 rounded-xl">
                <Plane className="h-6 w-6 text-white" />
              </div>
              <div>
                <h1 className="text-xl font-bold text-gray-900">FlightSafe</h1>
                <p className="text-xs text-gray-600">Real-time Flight Tracking</p>
              </div>
            </div>
            <div className="flex items-center gap-2">
              <Badge variant="outline" className="text-green-700 border-green-200 bg-green-50">
                <div className="w-2 h-2 bg-green-500 rounded-full mr-2"></div>
                Live Data
              </Badge>
            </div>
          </div>
        </div>
      </header>

      {/* Error Section */}
      <main className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
        <div className="text-center mb-12">
          {/* Error Icon */}
          <div className="inline-flex items-center justify-center w-20 h-20 bg-orange-100 rounded-full mb-6">
            <AlertCircle className="h-10 w-10 text-orange-600" />
            
          </div>

          <h1 className="text-4xl md:text-5xl font-bold text-gray-900 mb-4 leading-tight">Flight Not Found</h1>

          <p className="text-xl text-gray-600 mb-8 max-w-2xl mx-auto leading-relaxed">
            We couldn't find your flight in our database. This could be due to several reasons.
          </p>
        </div>

        {/* Error Details Card */}
        <Card className="max-w-2xl mx-auto shadow-xl border-0 bg-white/90 backdrop-blur-sm mb-8">
          <CardContent className="p-8">
            <div className="space-y-6">
              <div className="text-center">
                <h2 className="text-2xl font-semibold text-gray-900 mb-4">Possible Reasons</h2>
              </div>

              <div className="space-y-4">
                <div className="flex items-start gap-3 p-4 bg-orange-50 rounded-lg border border-orange-100">
                  <div className="w-2 h-2 bg-orange-500 rounded-full mt-2 flex-shrink-0"></div>
                  <div>
                    <h3 className="font-medium text-gray-900 mb-1">Flight number may be incorrect</h3>
                    <p className="text-sm text-gray-600">
                      Double-check the flight number on your ticket or booking confirmation
                    </p>
                  </div>
                </div>

                <div className="flex items-start gap-3 p-4 bg-blue-50 rounded-lg border border-blue-100">
                  <div className="w-2 h-2 bg-blue-500 rounded-full mt-2 flex-shrink-0"></div>
                  <div>
                    <h3 className="font-medium text-gray-900 mb-1">Flight may not be scheduled today</h3>
                    <p className="text-sm text-gray-600">Some flights operate on specific days of the week</p>
                  </div>
                </div>

                <div className="flex items-start gap-3 p-4 bg-purple-50 rounded-lg border border-purple-100">
                  <div className="w-2 h-2 bg-purple-500 rounded-full mt-2 flex-shrink-0"></div>
                  <div>
                    <h3 className="font-medium text-gray-900 mb-1">Flight may have been cancelled</h3>
                    <p className="text-sm text-gray-600">Check with your airline for the latest updates</p>
                  </div>
                </div>

                <div className="flex items-start gap-3 p-4 bg-green-50 rounded-lg border border-green-100">
                  <div className="w-2 h-2 bg-green-500 rounded-full mt-2 flex-shrink-0"></div>
                  <div>
                    <h3 className="font-medium text-gray-900 mb-1">Airline code might be different</h3>
                    <p className="text-sm text-gray-600">
                      Some flights are operated by partner airlines with different codes
                    </p>
                  </div>
                </div>
              </div>
            </div>
          </CardContent>
        </Card>


        {/* Tips Section */}
        <div className="mt-16 max-w-4xl mx-auto">
          <h3 className="text-2xl font-bold text-gray-900 text-center mb-8">Helpful Tips</h3>
          <div className="grid grid-cols-1 md:grid-cols-2 gap-6">
            <Card className="p-6 border-0 bg-white/60 backdrop-blur-sm">
              <div className="flex items-start gap-4">
                <div className="w-8 h-8 bg-blue-100 rounded-lg flex items-center justify-center flex-shrink-0">
                  <Search className="h-4 w-4 text-blue-600" />
                </div>
                <div>
                  <h4 className="font-semibold text-gray-900 mb-2">Check Your Booking</h4>
                  <p className="text-sm text-gray-600">
                    Look at your booking confirmation email or ticket for the exact flight number and airline code.
                  </p>
                </div>
              </div>
            </Card>

            <Card className="p-6 border-0 bg-white/60 backdrop-blur-sm">
              <div className="flex items-start gap-4">
                <div className="w-8 h-8 bg-green-100 rounded-lg flex items-center justify-center flex-shrink-0">
                  <Plane className="h-4 w-4 text-green-600" />
                </div>
                <div>
                  <h4 className="font-semibold text-gray-900 m
[truncated — 732 more characters]
```

### flight-log/app/components/main-page.tsx

```typescript
"use client"



import { useState } from "react"
import { Search, Plane, Shield} from "lucide-react"
import { Button } from "@/components/ui/button"
import { Card, CardContent } from "@/components/ui/card"
import { useRouter } from 'next/navigation';
import { Badge } from "@/components/ui/badge"
import Link from "next/link"
import { MessageCircle, Languages } from "lucide-react"; // if you want to use these icons

const MainPage = () => {

    type Flight = {
        id: string;
        departure: string;
        arrival: string;
        departureTime: string;
        arrivalTime: string;
        date: string;
        aircraft: string;
        passengers: number;
        crew: number;
        riskScore: number;
        weather: string;
        atcLoad: string;
        runway: string;
        gate: string;
      };    
      
    const router = useRouter();

    const [flightNumber, setFlightNumber] = useState("")
    const [flightData, setFlightData] = useState<Flight[]>([])
    const [loading, setLoading] = useState(false)
    const [error, setError] = useState<string | null>(null)
    const [showTranslator, setShowTranslator] = useState(false);


    return (
        <div className="min-h-screen bg-gradient-to-br from-blue-50 via-white to-sky-50 relative overflow-hidden">
            {/* Animated Clouds */}
            <div className="absolute inset-0 pointer-events-none">
                {/* Cloud 1 */}
                <div className="absolute top-4 sm:top-8 md:top-20 left-2 sm:left-6 md:left-10">
                    <div className="text-3xl sm:text-5xl md:text-6xl lg:text-8xl opacity-40">☁️</div>
                </div>
                {/* Cloud 2 */}
                <div className="absolute top-8 sm:top-12 md:top-32 right-2 sm:right-6 md:right-20">
                    <div className="text-2xl sm:text-4xl md:text-5xl lg:text-7xl opacity-35">☁️</div>
                </div>
                {/* Cloud 3 */}
                <div className="absolute top-4 sm:top-8 md:top-16 right-1/4 sm:right-1/3">
                    <div className="text-xl sm:text-3xl md:text-4xl lg:text-6xl opacity-45">☁️</div>
                </div>
                {/* Cloud 4 */}
                <div className="absolute top-12 sm:top-16 md:top-40 left-1/6 sm:left-1/4">
                    <div className="text-2xl sm:text-4xl md:text-5xl lg:text-7xl opacity-40">☁️</div>
                </div>
                {/* Cloud 5 */}
                <div className="absolute top-16 sm:top-24 md:top-60 right-1/6 sm:right-1/4">
                    <div className="text-xl sm:text-3xl md:text-4xl lg:text-6xl opacity-35">☁️</div>
                </div>
                {/* Cloud 7 */}
                <div className="absolute top-20 sm:top-32 md:top-96 right-2 sm:right-6 md:right-10">
                    <div className="text-2xl sm:text-4xl md:text-5xl lg:text-7xl opacity-35">☁️</div>
                </div>
                {/* Cloud 8 */}
                <div className="absolute top-14 sm:top-20 md:top-72 left-4 sm:left-8 md:left-16">
                    <div className="text-xl sm:text-3xl md:text-4xl lg:text-6xl opacity-45">☁️</div>
                </div>
                {/* Additional clouds for better visibility */}
                <div className="absolute top-24 sm:top-32 md:top-120 left-1/4 sm:left-1/3">
                    <div className="text-2xl sm:text-4xl md:text-5xl lg:text-7xl opacity-40">☁️</div>
                </div>
                <div className="absolute top-28 sm:top-36 md:top-140 right-1/4 sm:right-1/3">
                    <div className="text-xl sm:text-3xl md:text-4xl lg:text-6xl opacity-35">☁️</div>
                </div>
            </div>

            {/* Header */}
            <header className="bg-white/80 backdrop-blur-sm border-b border-blue-100 sticky top-0 z-50">
                <div className="max-w-7xl mx-auto px-3 sm:px-4 lg:px-8">
                    <div className="flex items-center justify-between h-12 sm:h-14 md:h-16">
                        <div className="flex items-center gap-2 sm:gap-3">
                            <div className="p-1.5 sm:p-2 bg-blue-600 rounded-lg sm:rounded-xl">
                                <Plane className="h-4 w-4 sm:h-5 sm:w-5 md:h-6 md:w-6 text-white" />
                            </div>
                            <div>
                                <h1 className="text-lg sm:text-xl font-bold text-gray-900">SkyScraper</h1>
                                <p className="text-xs text-gray-600">Real-time Flight Tracking</p>
                            </div>
                        </div>
                        <div className="flex items-center gap-2 sm:gap-4">
                            <nav className="hidden sm:flex items-center gap-4">
                                <Link href="/" className="text-sm font-medium text-gray-700 hover:text-blue-600 transition-colors">
                                    Home
                                </Link>
                                <Link href="/flight-score" className="text-sm font-medium text-gray-700 hover:text-blue-600 transition-colors">
                                    Flight Dashboard
                                </Link>
                            </nav>
                            <Badge variant="outline" className="text-green-700 border-green-200 bg-green-50 text-xs sm:text-sm">
                                <div className="w-1.5 h-1.5 sm:w-2 sm:h-2 bg-green-500 rounded-full mr-1 sm:mr-2"></div>
                                Live Data
                            </Badge>
                        </div>
                    </div>
                </div>
            </header>

            {/* Hero Section */}
            <main className="max-w-7xl mx-auto px-3 sm:px-4 lg:px-8 py-6 sm:py-8 md:py-12">
                <div className="text-center mb-8 sm:mb-10 md:mb-12">
                    <div className="inline-flex items-center gap-1.5 sm:gap-2 bg-blue-100 text-blue-800 px-3 sm:px-4 py-1.5 sm:py-2 rounded
[truncated — 4642 more characters]
```

### flight-log/app/api/letta-memory/route.ts

```typescript
import { NextRequest, NextResponse } from 'next/server';
import { lettaAgent } from '@/lib/letta-agent';

export async function POST(req: Request) {
  try {
    const { userId, flightNumber, riskScore, weather, userActions } = await req.json();

    // Store flight memory in Letta
    const memoryId = await lettaAgent.storeFlightMemory(
      userId,
      flightNumber,
      riskScore,
      weather,
      userActions || []
    );

    return NextResponse.json({
      success: true,
      memoryId,
      message: "Flight memory stored successfully"
    });

  } catch (error) {
    console.error('Error storing flight memory:', error);
    
    return NextResponse.json({
      success: false,
      error: "Failed to store flight memory",
      message: "An error occurred while storing flight memory"
    }, { status: 500 });
  }
}

export async function GET(req: NextRequest) {
  try {
    const { searchParams } = new URL(req.url);
    const userId = searchParams.get('userId') || 'demo-user';
    const query = searchParams.get('query') || '';

    // Get relevant memories
    const memories = await lettaAgent.getRelevantMemories(userId, query, 10);

    return NextResponse.json({
      success: true,
      memories,
      message: "Memories retrieved successfully"
    });

  } catch (error) {
    console.error('Error retrieving memories:', error);
    
    return NextResponse.json({
      success: false,
      error: "Failed to retrieve memories",
      message: "An error occurred while retrieving memories"
    }, { status: 500 });
  }
} 
```

[54 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]