Skip to content

feat: ai samples impl text gen/chat#1070

Open
sedanah-m wants to merge 5 commits into
feat/ai-samplesfrom
feat/ai-samples-impl-text-gen/chat
Open

feat: ai samples impl text gen/chat#1070
sedanah-m wants to merge 5 commits into
feat/ai-samplesfrom
feat/ai-samples-impl-text-gen/chat

Conversation

@sedanah-m

Copy link
Copy Markdown
Contributor

Implement text-generation and chat samples. Add decoupled logic so that user can run script to start either sample.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread ai/ai-samples/src/services/firebaseAIService.ts
Comment thread ai/ai-samples/src/features/chat/service.ts
Comment thread ai/ai-samples/src/features/text-generation/service.ts
Comment thread ai/ai-samples/src/features/text-generation/service.ts
Comment thread ai/ai-samples/src/features/text-generation/service.ts
Comment on lines +25 to +30
const handleResetChat = () => {
chatSessionRef.current = startNewChat();
setMessages([]);
setError(null);
setInput('');
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

If Firebase is not configured or fails to initialize, startNewChat() will throw an unhandled exception on mount inside useEffect, causing the entire React application to crash with a white screen. Wrapping this initialization in a try/catch block and setting the error state allows the UI to gracefully display the error.

  const handleResetChat = () => {
    try {
      chatSessionRef.current = startNewChat();
      setError(null);
    } catch (err: any) {
      setError(err.message || 'Failed to initialize chat session. Please check your Firebase configuration.');
    }
    setMessages([]);
    setInput('');
  };

Comment thread ai/ai-samples/src/services/firebaseAIService.ts
Comment thread ai/ai-samples/package.json
@sedanah-m sedanah-m changed the title Feat/ai samples impl text gen/chat feat: ai samples impl text gen/chat Jun 23, 2026
@sedanah-m sedanah-m marked this pull request as ready for review June 23, 2026 21:20
@sedanah-m sedanah-m changed the base branch from master to feat/ai-samples June 23, 2026 21:24
@sedanah-m sedanah-m force-pushed the feat/ai-samples-impl-text-gen/chat branch from 75197b1 to 0b9284c Compare June 23, 2026 21:28
sedanah-m and others added 2 commits June 23, 2026 14:39
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant