feat: ai samples implenting text generation/chat samples#1070
feat: ai samples implenting text generation/chat samples#1070sedanah-m wants to merge 8 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a modular React and Vite-based application showcasing Firebase AI capabilities, including text generation and multi-turn chat. Feedback on the changes highlights several critical issues: an invalid model name ('gemini-3.5-flash') is used across multiple service files, which will cause runtime failures; the Chat view lacks error handling during initialization, potentially leading to application crashes; Firebase configuration values are hardcoded instead of using environment variables; and a deprecated @types/react-router-dom dependency is present, risking type conflicts with React Router v7.
75197b1 to
0b9284c
Compare
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
hsubox76
left a comment
There was a problem hiding this comment.
Apps look good so far.
Can you add instructions in the README.md about how to install and run the samples, and the different options? Cover
- how to put your project config in
- npm install
- how to run full app or individual samples
- where to go in the browser
- Can cut and paste code out of service.ts file for platform agnostic use
Also, add App Check debug initialization as we discussed (I guess just in firebaseAIService.ts).
| measurementId: import.meta.env.VITE_FIREBASE_MEASUREMENT_ID || "YOUR_MEASUREMENT_ID" | ||
| }; | ||
|
|
||
| const app = !getApps().length ? initializeApp(firebaseConfig) : getApp(); |
There was a problem hiding this comment.
Do we still need to do this check? initializeApp should be idempotent. Are there any errors when we don't do this check first?
There was a problem hiding this comment.
Yes, so when I was testing it out without this check, I was getting a "Firebase App named [DEFAULT] already exists" error. I looked it up and this is coming from the Vite Hot Module replacement which is causing the files to repeatedly reexecute in the browser as the user saves their changes during development. Without the check, every time they hit save, Vite attempts to re-initialize the app, and firebase throws that error. Thus, with this check, if the app is already sitting in the memory during the reload, it should grab the exisiting version of getApp. LMK your thoughts on this.
…lude app check logic in firebaseAIService
…om/firebase/quickstart-js into feat/ai-samples-impl-text-gen/chat
Implement text-generation and chat samples.
Add decoupled logic so that user can run script to start either sample.
Updates to the README file and adds AppCheck debug intialization.