Skip to content

Latest commit

 

History

History

reviewly-end

Reviewly - completed code

A sample web app that summarizes reviews using the PaLM API and a Firebase AI extension.

reviewly-final.mp4

To run with a real firebase project (recommended)

Run these commands in your terminal:

  1. Navigate to this web app folder and install dependencies:
cd reviewly-end
npm install
  1. Specify which project Firebase should use:
firebase use <name-of-your-project>
# For example: firebase use codelab-ai-extensions
  1. To deploy the extension used in this web app, run this command in your terminal:

Note: If you are asked Would you like to delete any other extensions, select No.

firebase deploy --only extensions
  1. Edit the js/firebase-config.js file with your Firebase configuration.

  2. Deploy the Cloud Function in the functions folder:

firebase deploy --only functions
  1. Deploy the Firestore and Cloud Storage Security Rules:
firebase deploy --only firestore:rules,storage
  1. Back in your terminal, run this command:
npm run dev
  1. And then navigate to the URL shown in your terminal, for example http://localhost:8080 or http://localhost:8000.

To run this locally with emulators (not recommended)

This has no AI functionality.

This is only useful for codelab authors, or learners who are unable to use a real Firebase project or real Google Cloud services.

  1. In your terminal, navigate to this web app folder:
cd reviewly-end
  1. Run this command to seed the Firestore emulator with some test data:
firebase emulators:start --project demo-codelab-ai-extension-reviewly --import=../firestore-export/
  1. Edit the js/firebase-config.js file with your emulator configuration.

  2. In your terminal tab, run these commands:

npm install
npm run dev
  1. In the file js/reviews.js, uncomment the connectFirestoreEmulator line:
// Uncomment these lines to use the local emulator
connectFirestoreEmulator(db, "127.0.0.1", 8080);
connectFunctionsEmulator(functions, "127.0.0.1", 5001);
  1. And then navigate to the URL shown in your terminal, for example http://localhost:8080 or http://localhost:8000.