Skip to content

augustos0204/PuterLab-AI-Laboratory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ§ͺ PuterLab - AI Laboratory

An experimental project to test and evaluate the capabilities of the Puter.JS SDK by developing a complete AI assistant as a practical use case.

PuterLab Interface Responsive Puter.JS

🎯 Project Purpose

PuterLab was developed as a testing laboratory to evaluate the functionalities of the Puter.JS SDK in a real application scenario. The project uses a conversational AI assistant as a use case to test:

  • βœ… Authentication System
  • βœ… LLM Chat API
  • βœ… Image Generation (txt2img)
  • βœ… Text-to-Speech (TTS)
  • βœ… Frontend Integration

πŸ”¬ Implemented Features

πŸ’¬ Smart Chat

  • Real-time conversation with GPT-4.1-nano model
  • WhatsApp-like interface
  • "Typing" indicator during processing
  • Message history with timestamps
  • Auto-scroll for new messages

πŸ” Integrated Authentication

  • Login via Puter.auth without additional configuration
  • Automatic authentication state verification
  • Personalized welcome message
  • Disabled states when not authenticated

🎨 Image Generation

  • Dedicated button for text β†’ image conversion
  • Direct display in chat
  • Processing via puter.ai.txt2img()

πŸ”Š Text-to-Speech

  • Audio playback of AI messages
  • Audio button on each received message
  • Configuration for Brazilian Portuguese
  • Puter's generative engine

πŸ“± Responsive Design

  • Adaptive layout for all devices
  • Use of 100dvh for mobile (eliminates unwanted scroll)
  • Media queries for different breakpoints
  • Touch-friendly elements for mobile devices

πŸ› οΈ Technologies Used

  • Frontend: HTML5, CSS3, JavaScript (Vanilla)
  • SDK: Puter.JS v2
  • Icons: Lucide Icons
  • Design: Mobile-first, Flexbox
  • Hosting: Compatible with any static server

βš™οΈ How to Use

1. Clone and Setup

git clone [repository-url]
cd test-puter

2. Run

# Serve files via HTTP (required for Puter.JS)
python -m http.server 8000
# or
npx serve .

3. Access

  • Open http://localhost:8000
  • Login when prompted
  • Test chat and generation features

πŸ“Š Test Results

βœ… Text LLM - EXCELLENT

puter.ai.chat(message, { model: "gpt-4.1-nano" })

Rating: ⭐⭐⭐⭐⭐

  • Response quality: Very high
  • Speed: Fast and consistent
  • Reliability: Stable during tests
  • Integration: Simple and effective
  • Recommendation: Ideal for production

❌ Image Generation - POOR

puter.ai.txt2img(message)

Rating: ⭐⭐

  • Visual quality: Below expectations
  • Processing time: Very slow
  • Consistency: Inconsistent results
  • Limitations: Model seems basic
  • Recommendation: Use specialized APIs (DALL-E, Midjourney, Stable Diffusion)

❌ Text-to-Speech - POOR

puter.ai.txt2speech(message, { language: "pt-BR", engine: "generative" })

Rating: ⭐⭐

  • Voice quality: Robotic and artificial
  • Portuguese pronunciation: Frequent issues
  • Latency: High processing delays
  • Audio quality: Low fidelity
  • Recommendation: Use specialized services (ElevenLabs, Google TTS, AWS Polly)

πŸ“ˆ Test Conclusions

🎯 Recommended Use Cases for Puter.JS

  • βœ… Chatbots and text assistants
  • βœ… Q&A Systems
  • βœ… Rapid prototyping of AI apps
  • βœ… Applications that need integrated LLM
  • βœ… MVPs with chat functionalities

⚠️ Not Recommended

  • ❌ Applications that depend on high-quality images
  • ❌ Professional audio systems
  • ❌ Applications that need quality TTS

πŸš€ Suggested Hybrid Strategy

For a production project:

βœ… Keep: Puter.JS for chat and authentication
⚠️ Replace: Specialized API for images (OpenAI DALL-E)
⚠️ Replace: Dedicated service for TTS (ElevenLabs)

πŸ—οΈ Project Architecture

test-puter/
β”œβ”€β”€ index.html          # Main structure
β”œβ”€β”€ style.css           # Responsive styles
β”œβ”€β”€ script.js           # Application logic
β”œβ”€β”€ assets/
β”‚   └── volume-2.svg    # Audio icon
└── README.md           # Documentation

πŸ“± Responsiveness

  • Mobile (≀480px): Full-screen layout with 100dvh
  • Tablet (481px-768px): Centered container
  • Desktop (β‰₯769px): Layout optimized for large screens
  • Landscape: Specific adjustments for orientation

🎨 Design System

🎨 Colors

  • Primary: #075e54 (WhatsApp Green)
  • Secondary: #128c7e (Hover Green)
  • Background: #f0f2f5 (Light Gray)
  • Messages: #dcf8c6 (Light Green - sent)
  • Received: #ffffff (White - received)

πŸ€– Visual Identity

  • Name: PuterLab
  • Icon: Robot (Lucide Icons)
  • Theme: Experimentation laboratory
  • Style: Minimalist and modern

πŸ“ Features in Detail

πŸ” Authentication System

// State verification
const isAuth = await puter.auth.isSignedIn();

// Login
await puter.auth.signIn();

// User data
const user = await puter.auth.getUser();

πŸ’¬ AI Chat

// Send message
const response = await puter.ai.chat(message, { 
    model: "gpt-4.1-nano" 
});

🎨 Image Generation

// Generate image
const imageBase64 = await puter.ai.txt2img(prompt);

πŸ”Š Text-to-Speech

// Play audio
const audio = await puter.ai.txt2speech(text, {
    language: "pt-BR",
    engine: "generative"
});
await audio.play();

πŸ“„ License

This project is experimental and was developed for testing and evaluation purposes of the Puter.JS SDK.


Developed as a testing laboratory to evaluate Puter.JS SDK capabilities πŸ§ͺ

About

An experimental project to test and evaluate the capabilities of the **Puter.JS SDK** by developing a complete AI assistant as a practical use case.

Resources

License

Stars

Watchers

Forks

Contributors