Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Gemini AI Integration Interface #181

Merged
merged 4 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
NEXT_PUBLIC_SUPABASE_URL=your-supabase-url
GEMINI_API_KEY='Add your Gemini API Key'

# Also rename this file as .envNEXT_PUBLIC_SUPABASE_URL=your-supabase-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME=your-cloudinary-name
NEXT_PUBLIC_CLOUDINARY_API_KEY=your-cloudinary-api-key
24 changes: 23 additions & 1 deletion PROJECT_STRUCTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
│ ├── Newsletter.png
│ ├── avatar.png
│ ├── avatar1.png
│ ├── dev1.jpeg
│ ├── dev2.jpeg
│ ├── dev3.jpeg
│ ├── dev4.jpeg
│ ├── dev5.jpeg
│ ├── dev6.jpeg
│ ├── dev7.jpeg
│ ├── goal.webp
│ ├── hack1.jpg
│ ├── img1.jpg
Expand All @@ -44,6 +51,10 @@
│ │ │ │ └── page.jsx
│ │ │ ├── Hackathon/
│ │ │ │ ├── Card.jsx
│ │ │ │ ├── [id]/
│ │ │ │ │ └── page.jsx
│ │ │ │ └── page.jsx
│ │ │ ├── PrivacyPolicy/
│ │ │ │ └── page.jsx
│ │ │ ├── Projects/
│ │ │ │ ├── Card.jsx
Expand All @@ -53,6 +64,8 @@
│ │ │ │ │ └── page.jsx
│ │ │ │ ├── page.jsx
│ │ │ │ └── resources.js
│ │ │ ├── RulesAndRegulations/
│ │ │ │ └── page.jsx
│ │ │ ├── SignIn/
│ │ │ │ └── page.jsx
│ │ │ ├── SignUp/
Expand All @@ -65,8 +78,15 @@
│ │ │ ├── TeamsGallery/
│ │ │ │ ├── Teams.js
│ │ │ │ └── page.jsx
│ │ │ └── careers/
│ │ │ ├── TermsAndConditions/
│ │ │ │ └── page.jsx
│ │ │ ├── careers/
│ │ │ │ └── page.jsx
│ │ │ └── localdev/
│ │ │ └── page.jsx
│ │ ├── api/
│ │ │ └── subscribe/
│ │ │ └── route.js
│ │ ├── favicon.ico
│ │ ├── fonts/
│ │ │ ├── GeistMonoVF.woff
Expand All @@ -79,6 +99,8 @@
│ │ ├── not-found.jsx
│ │ └── page.js
│ ├── components/
│ │ ├── Chatbot.jsx
│ │ ├── GTranslateLoader.js
│ │ ├── Global/
│ │ │ ├── Footer.jsx
│ │ │ ├── Header.jsx
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
"lint": "next lint"
},
"dependencies": {
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@google/generative-ai": "^0.21.0",
"@mui/icons-material": "^6.1.5",
"@mui/material": "^6.1.5",
"@radix-ui/react-aspect-ratio": "^1.1.0",
"@radix-ui/react-collapsible": "^1.1.1",
"@radix-ui/react-dialog": "^1.1.2",
Expand Down
24 changes: 23 additions & 1 deletion repo_structure.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
│ ├── Newsletter.png
│ ├── avatar.png
│ ├── avatar1.png
│ ├── dev1.jpeg
│ ├── dev2.jpeg
│ ├── dev3.jpeg
│ ├── dev4.jpeg
│ ├── dev5.jpeg
│ ├── dev6.jpeg
│ ├── dev7.jpeg
│ ├── goal.webp
│ ├── hack1.jpg
│ ├── img1.jpg
Expand All @@ -40,6 +47,10 @@
│ │ │ │ └── page.jsx
│ │ │ ├── Hackathon/
│ │ │ │ ├── Card.jsx
│ │ │ │ ├── [id]/
│ │ │ │ │ └── page.jsx
│ │ │ │ └── page.jsx
│ │ │ ├── PrivacyPolicy/
│ │ │ │ └── page.jsx
│ │ │ ├── Projects/
│ │ │ │ ├── Card.jsx
Expand All @@ -49,6 +60,8 @@
│ │ │ │ │ └── page.jsx
│ │ │ │ ├── page.jsx
│ │ │ │ └── resources.js
│ │ │ ├── RulesAndRegulations/
│ │ │ │ └── page.jsx
│ │ │ ├── SignIn/
│ │ │ │ └── page.jsx
│ │ │ ├── SignUp/
Expand All @@ -61,8 +74,15 @@
│ │ │ ├── TeamsGallery/
│ │ │ │ ├── Teams.js
│ │ │ │ └── page.jsx
│ │ │ └── careers/
│ │ │ ├── TermsAndConditions/
│ │ │ │ └── page.jsx
│ │ │ ├── careers/
│ │ │ │ └── page.jsx
│ │ │ └── localdev/
│ │ │ └── page.jsx
│ │ ├── api/
│ │ │ └── subscribe/
│ │ │ └── route.js
│ │ ├── favicon.ico
│ │ ├── fonts/
│ │ │ ├── GeistMonoVF.woff
Expand All @@ -75,6 +95,8 @@
│ │ ├── not-found.jsx
│ │ └── page.js
│ ├── components/
│ │ ├── Chatbot.jsx
│ │ ├── GTranslateLoader.js
│ │ ├── Global/
│ │ │ ├── Footer.jsx
│ │ │ ├── Header.jsx
Expand Down
17 changes: 17 additions & 0 deletions src/app/(pages)/api/generate/route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { GoogleGenerativeAI } from '@google/generative-ai';

const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY);

export async function POST(req) {
const { prompt } = await req.json();
try {
const model = genAI.getGenerativeModel({ model: 'gemini-pro' });
const result = await model.generateContent(prompt);
const response = await result.response;
const generatedText = await response.text();

return new Response(JSON.stringify({ generatedText }), { status: 200 });
} catch (error) {
return new Response(error.message, { status: 500 });
}
}
Loading