perplexity-hackathon-LawMitra / perplexity_hackathon / demo / scripts / scenarios / user-flow.ts
user-flow.ts
Raw
import chalk from 'chalk';

const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));

async function runUserFlow() {
  console.log(chalk.blue('\n=== Starting User Flow Demo ===\n'));

  // Simulate user login
  console.log(chalk.yellow('1. User Login'));
  await sleep(1000);
  console.log(chalk.green('✓ Logged in as John Doe'));

  // Ask legal question
  console.log(chalk.yellow('\n2. Asking Legal Question'));
  await sleep(1500);
  console.log('Question:', chalk.white('What are my rights as a tenant if my landlord wants to evict me without notice?'));
  await sleep(2000);
  console.log(chalk.green('✓ Response received'));

  // Send voice message in Spanish
  console.log(chalk.yellow('\n3. Sending Voice Message (Spanish)'));
  await sleep(1500);
  console.log('Voice Message:', chalk.white('¿Qué debo hacer si sufro discriminación en el trabajo por mi embarazo?'));
  await sleep(2000);
  console.log(chalk.green('✓ Voice message processed'));
  console.log(chalk.green('✓ Response generated with audio'));

  // Generate document
  console.log(chalk.yellow('\n4. Requesting Document Generation'));
  await sleep(1500);
  console.log('Document Type:', chalk.white('Security Deposit Claim Form'));
  await sleep(2000);
  console.log(chalk.green('✓ Document generated'));

  // Create case
  console.log(chalk.yellow('\n5. Opening New Case'));
  await sleep(1500);
  console.log('Case Type:', chalk.white('Consumer Protection'));
  console.log('Description:', chalk.white('Defective product causing injury, manufacturer refusing responsibility'));
  await sleep(2000);
  console.log(chalk.green('✓ Case created successfully'));

  console.log(chalk.blue('\n=== User Flow Demo Completed ===\n'));
}

runUserFlow().catch(console.error);