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

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

async function runNGOFlow() {
  console.log(chalk.blue('\n=== Starting NGO Worker Flow Demo ===\n'));

  // NGO worker login
  console.log(chalk.yellow('1. NGO Worker Login'));
  await sleep(1000);
  console.log(chalk.green('✓ Logged in as Sarah Smith'));

  // Look up user by phone
  console.log(chalk.yellow('\n2. Looking up User'));
  await sleep(1500);
  console.log('Phone Number:', chalk.white('+1234567890'));
  await sleep(2000);
  console.log(chalk.green('✓ User found: John Doe'));
  console.log('Cases:', chalk.white('2 active, 1 resolved'));
  console.log('Recent Questions:', chalk.white('3 in the last week'));

  // Review case history
  console.log(chalk.yellow('\n3. Reviewing Case History'));
  await sleep(1500);
  console.log('Active Case:', chalk.white('Tenant Rights - Security Deposit Dispute'));
  console.log('Status:', chalk.white('In Progress'));
  await sleep(2000);
  console.log(chalk.green('✓ Case details retrieved'));

  // Add follow-up question
  console.log(chalk.yellow('\n4. Adding Follow-up Question'));
  await sleep(1500);
  console.log('Question:', chalk.white('Have you received any written communication about the damages?'));
  await sleep(2000);
  console.log(chalk.green('✓ Follow-up question added'));

  // Assign case to advocate
  console.log(chalk.yellow('\n5. Assigning Case'));
  await sleep(1500);
  console.log('Advocate:', chalk.white('Michael Johnson'));
  console.log('Specialization:', chalk.white('Tenant Rights'));
  await sleep(2000);
  console.log(chalk.green('✓ Case assigned successfully'));

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

runNGOFlow().catch(console.error);