Skip to content

Feat/video anaylsis - #1082

Closed
sedanah-m wants to merge 8 commits into
masterfrom
feat/video-anaylsis
Closed

Feat/video anaylsis#1082
sedanah-m wants to merge 8 commits into
masterfrom
feat/video-anaylsis

Conversation

@sedanah-m

Copy link
Copy Markdown
Contributor

sedanah-m and others added 8 commits August 25, 2026 14:47
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>
… and `streamText`; remove redundant `generateWithSystemInstruction` helper function; enable system instruction input when streaming is enabled in `TextGenerationView`; renamed component to `TextGenerationView` for consistency
… Remove redundant isolated feature switch and unused component imports from `App.tsx`; ensure `automatic-function-calling` is handled in `index.tsx`; keep `App.tsx` strictly focused on layout shell and navigation
@sedanah-m
sedanah-m changed the base branch from master to feat/ai-samples-cleanup September 2, 2026 16:55
{previewUrl && (
<div style={{ marginBottom: '16px', borderRadius: '8px', overflow: 'hidden', border: '1px solid #dadce0', backgroundColor: '#000' }}>
<video
src={previewUrl}
@sedanah-m
sedanah-m changed the base branch from feat/ai-samples-cleanup to master September 2, 2026 16:55

@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 new Video Analysis feature, refactors the Text Generation feature to support system instructions and streaming, and cleans up the Chat feature. Feedback on these changes includes adding the new Video Analysis feature to the sidebar navigation and registering it in the router, fixing a typo in the folder name (video-anaylsis), correcting an inconsistent model name (gemini-3.7-flash vs gemini-3.5-flash), and implementing client-side file size validation to prevent performance issues when uploading large videos.

Comment thread ai/ai-samples/src/App.tsx
Comment on lines 10 to 12
{ path: '/image-generation', label: 'Image Generation' },

];

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

The new Video Analysis feature is missing from the sidebar navigation items. Add it to NAV_ITEMS so users can navigate to it.

Suggested change
{ path: '/image-generation', label: 'Image Generation' },
];
{ path: '/image-generation', label: 'Image Generation' },
{ path: '/video-analysis', label: 'Video Analysis' },
];

element: <App />,
children: [
// Redirect the root path to text-generation automatically
{ index: true, element: <Navigate to="/text-generation" replace /> },

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

The new VideoAnalysis feature is not registered in the router. To make it accessible, please:

  1. Import VideoAnalysis from ./features/video-analysis at the top of the file.
  2. Add the route { path: 'video-analysis', element: <VideoAnalysis /> } to the router children.
  3. Add case 'video-analysis': return <VideoAnalysis />; to the renderContent switch-case for isolated features.

): Promise<void> {
try {
const videoPart = await fileToGenerativePart(videoFile);
const model = getAiModel('gemini-3.7-flash');

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

Inconsistent model name used here (gemini-3.7-flash). Everywhere else in the codebase (including analyzeVideo in this file and text-generation/service.ts), gemini-3.5-flash is used. Please update this to maintain consistency and ensure the correct model is called.

Suggested change
const model = getAiModel('gemini-3.7-flash');
const model = getAiModel('gemini-3.5-flash');

@@ -0,0 +1,237 @@
import React, { useState, useRef, useEffect } from 'react';
import { analyzeVideo, streamVideoAnalysis } from './service';

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.

medium

There is a typo in the folder name video-anaylsis (should be video-analysis). Please rename the folder and update any import paths accordingly to maintain clean code and avoid confusion.

Comment on lines +33 to +37
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const file = e.target.files?.[0] || null;
setSelectedFile(file);
setError(null);
};

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.

medium

Since the UI notes that inline payloads are recommended to be under 20MB, it is highly recommended to enforce this limit on the client side. Reading extremely large video files into memory as Base64 can crash the browser tab or cause severe performance issues.

  const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
    const file = e.target.files?.[0] || null;
    if (file && file.size > 20 * 1024 * 1024) {
      setError('File size exceeds the 20MB limit for inline payloads.');
      setSelectedFile(null);
      if (fileInputRef.current) {
        fileInputRef.current.value = '';
      }
      return;
    }
    setSelectedFile(file);
    setError(null);
  };

@sedanah-m sedanah-m closed this Sep 2, 2026
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.

2 participants