Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Chapter 8: Project Pastra - Mobile-First Multimodal AI Assistant

This chapter transforms our multimodal chat application into Project Pastra - a mobile-friendly web application deployed on Cloud Run. Inspired by Google DeepMind's Project Astra (a research prototype exploring future capabilities of universal AI assistants), our application demonstrates how to create a production-ready, mobile-first AI assistant experience.

New Features

1. Mobile-First UI Design

  • Responsive Layout: Optimized for both mobile and desktop viewing
  • Touch-Friendly Controls: Redesigned buttons and interactions for mobile use
  • Floating Action Button (FAB): Easy-to-reach microphone control
  • Status Indicators: Clear visual feedback for system state
  • Modern Material Design: Enhanced visual aesthetics and usability

2. Cloud Run Deployment

  • Containerization: Docker configuration for cloud deployment
  • HTTPS Support: Secure communication for media access
  • Environment Variables: Secure API key management
  • Cloud Build Integration: Automated deployment pipeline
  • Scalability: Automatic scaling based on demand

3. Enhanced User Experience

  • Connection Status Handler: Real-time feedback on system state
  • Loading States: Visual indicators for processing
  • Error Handling: User-friendly error messages
  • Progressive Enhancement: Graceful fallbacks for unsupported features

Technical Improvements

Docker Configuration

# Key components of our Dockerfile
FROM node:18-slim
WORKDIR /app
COPY . .
ENV PORT=8080
CMD ["node", "server.js"]

Status Management

The new status-handler.js provides real-time feedback for:

  • Connection state
  • Media permissions
  • Processing status
  • Error conditions

Building Upon Previous Chapters

Project Pastra retains and enhances all features from chapters 6 and 7:

  • Real-time audio/video chat
  • Function calling capabilities
  • System instructions
  • Weather, search, and code execution tools
  • Screen sharing and webcam support

Project Structure

  • index.html: Mobile-optimized UI implementation
  • style.css: Enhanced mobile-first styling
  • status-handler.js: Connection and state management
  • Dockerfile: Container configuration
  • shared/: Common components and utilities
    • Media handling
    • Audio processing
    • WebSocket management

Deployment Instructions

  1. Local Development:

    docker build -t project-pastra .
    docker run -p 8080:8080 project-pastra
  2. Cloud Run Deployment:

    gcloud builds submit --tag gcr.io/PROJECT_ID/project-pastra-dev-api
    gcloud run deploy project-pastra-dev-api \
      --image gcr.io/$PROJECT_ID/project-pastra-dev-api \
      --platform managed \
      --region us-central1 \
      --allow-unauthenticated

Usage

  1. Mobile Access:

    • Open the deployed URL on your mobile device
    • Grant necessary permissions (microphone, camera)
    • Tap the FAB to start interacting
  2. Desktop Access:

    • Works seamlessly on desktop browsers
    • Enhanced UI adapts to larger screens
    • Full keyboard/mouse support maintained

Design Philosophy

Project Pastra demonstrates how to transform a development prototype into a production-ready application by focusing on:

  1. Mobile-first user experience
  2. Production-grade deployment
  3. Scalable architecture
  4. Professional UI/UX design
  5. Robust error handling

The name "Pastra" (a playful nod to both Project Astra and pasta) reflects our approach: taking inspiration from advanced research prototypes while making the technology accessible and enjoyable for everyday use.