diff --git a/ai/ai-samples/src/config/firebase-config.ts b/ai/ai-samples/src/config/firebase-config.ts deleted file mode 100644 index 9fe146085..000000000 --- a/ai/ai-samples/src/config/firebase-config.ts +++ /dev/null @@ -1,7 +0,0 @@ -// import { initializeApp } from "firebase/app"; - -// export const firebaseConfig = { -// // add your config here -// }; - -// export const app = initializeApp(firebaseConfig); diff --git a/ai/ai-samples/src/features/multimodal/index.tsx b/ai/ai-samples/src/features/multimodal/index.tsx index 73a48218b..74178d269 100644 --- a/ai/ai-samples/src/features/multimodal/index.tsx +++ b/ai/ai-samples/src/features/multimodal/index.tsx @@ -1,9 +1,103 @@ -import React from 'react'; +import { useState, useRef } from 'react'; +import { generateMultimodalContent } from './service'; + +export default function MultimodalView() { + const [prompt, setPrompt] = useState('Describe these files in detail.'); + const [response, setResponse] = useState(''); + const [loading, setLoading] = useState(false); + const [error, setError] = useState(null); + + const fileInputRef = useRef(null); + + const handleGenerate = async () => { + const fileArray = Array.from(fileInputRef.current?.files ?? []); + + if (fileArray.length === 0) { + setError('Please select at least one file (Image or PDF).'); + return; + } + + const cleanedPrompt = prompt.trim(); + + if (!cleanedPrompt) { + setError('Please enter a prompt.'); + return; + } + + setLoading(true); + setError(null); + setResponse(''); + + try { + const resultText = await generateMultimodalContent(cleanedPrompt, fileArray); + setResponse(resultText); + } catch (error: unknown) { + const message = error instanceof Error ? error.message : 'An error occurred during multimodal generation.'; + setError(message); + } finally { + setLoading(false); + } + }; -export default function MultimodalFeature() { return ( -
-

multimodal

+
+

Multimodal Generation

+

+ Upload images or PDFs alongside a text prompt to generate content. +

+ +
+ + +
+ +
+ +