Skip to content
Open
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
10 changes: 2 additions & 8 deletions src/Ai.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,12 @@ const API_KEY = process.env.REACT_APP_API_KEY;
export default async function Query(userdata) {

userdata = userdata
console.log(Query)
try {

const userdata = `
City: New York City
Address: 919 3rd Ave, New York, NY 10022
Bio: I like to paint and computers
Age: 12
`;


const prompt = `Generate a list of say 2 for each category of Google search queries, please find 10 for each in these categories
1. Search queries for finding educational opportunities for the person, 2. Search queries for finding wokr / internship / co-op opportunities for the person. 3. Search queries for
1. Search queries for finding educational opportunities for the person, 2. Search queries for finding work / internship / co-op opportunities for the person. 3. Search queries for
finding volunteering opprtunities for the person. 4. Search queries for fidning healthy food opportunities and food banks for the person. put them in JSON format based on the provided user data.
The queries should focus on activities and experiences within the user's city that match their interests and age.
Ensure each query is specific to the city mentioned.
Expand Down
2 changes: 1 addition & 1 deletion src/AiTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function AiTest({}) {

return(
<>
<p>Hello!</p>

<h1>{response}</h1>

</>
Expand Down
195 changes: 114 additions & 81 deletions src/FinalOutputAi.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,91 +5,124 @@ import axios from 'axios';
const API_KEY = process.env.REACT_APP_API_KEY;


export default async function Query2() {
export default async function Query() {

//userdata = userdata
const userdata = `City: Washington
Address: 1002 fairmont st nw
Bio: I like computer science and the gym
Age: 19
`;
try {
const activityData = `{
"Educational Programs": [
{
"title": "Washington Computer Science Education Initiative",
"description": "Explore various computer science courses for students and professionals in Washington.",
"link": "https://dummy-website.com/cs-education-washington"
},
{
"title": "Youth Fitness Training for Beginners",
"description": "A fitness program designed for 19-year-olds looking to improve their physical health.",
"link": "https://dummy-website.com/youth-fitness-washington"
},
{
"title": "Intro to Computer Science Workshop Series",
"description": "A series of workshops for individuals looking to start a career in computer science.",
"link": "https://dummy-website.com/cs-workshops-washington"
},
{
"title": "Healthy Cooking Classes in Washington",
"description": "Classes focused on teaching the basics of healthy cooking with locally sourced ingredients.",
"link": "https://dummy-website.com/healthy-cooking-classes"
}
],
"Internships": [
{
"title": "Washington Tech Computer Science Internships",
"description": "Various internships in the computer science field tailored for students and recent graduates.",
"link": "https://dummy-website.com/cs-internships-washington"
},
{
"title": "Fitness Instructor Internship for Youth",
"description": "A gym internship opportunity aimed at aspiring fitness instructors in Washington.",
"link": "https://dummy-website.com/fitness-internship-youth"
},
{
"title": "Health and Fitness Summer Internship",
"description": "A summer internship opportunity at a gym for young adults passionate about fitness.",
"link": "https://dummy-website.com/summer-fitness-internship"
},
{
"title": "Tech Innovators Computer Science Internship",
"description": "An internship program offering real-world experience in computer science for young tech enthusiasts.",
"link": "https://dummy-website.com/tech-innovators-cs-internship"
}
],
"Volunteering Opportunities": [
{
"title": "Washington CS Volunteer Network",
"description": "Join local computer science professionals in various community-oriented volunteer projects.",
"link": "https://dummy-website.com/cs-volunteer-washington"
},
{
"title": "Community Health and Fitness Volunteering",
"description": "Assist in local fitness centers and help the community with health and wellness initiatives.",
"link": "https://dummy-website.com/fitness-volunteer-washington"
},
{
"title": "Food Banks Volunteer Network",
"description": "Volunteer at Washington food banks and support those in need with your time and service.",
"link": "https://dummy-website.com/food-bank-volunteer"
},
{
"title": "Washington Tech for Good Volunteering",
"description": "Volunteer in tech events and help organize computer science workshops across Washington.",
"link": "https://dummy-website.com/tech-volunteer-washington"
}
],
"Co-op Opportunities": [
{
"title": "Washington CS Student Co-ops",
"description": "A range of co-op opportunities for computer science students in tech companies across Washington.",
"link": "https://dummy-website.com/cs-coop-washington"
},
{
"title": "Youth Gym Instructor Co-op Program",
"description": "A co-op program for young individuals passionate about becoming gym instructors.",
"link": "https://dummy-website.com/gym-coop-washington"
},
{
"title": "Health and Wellness Co-ops in Washington",
"description": "Participate in co-op programs focused on health and fitness in community centers.",
"link": "https://dummy-website.com/health-coop-washington"
},
{
"title": "Tech Innovators Co-op for CS Students",
"description": "A co-op program offering hands-on experience in computer science for university students.",
"link": "https://dummy-website.com/tech-coop-cs-students"
}
]
}


`;


const prompt = `
Generate an output in a JSON format using data from the user and the activities they are taking. You are to rank the different links you find based on how likely the user is to take them. Use the user data given below to rank the different queries based on userdata and sort them into four categories 1. finding educational opportunities 2. work/internship / co-op opportunities 3 volunteering opportunities. 4. finding healthy food opportunities and food banks put them in JSON format based on the provided user data. sort this data and parse the output using the return format given below
do not yap only give me the output in the return format listed

User Data: ${userdata}
Input data: ${activityData}

const userdata = "City: New York City Bio: I like to paint and computers Age: 12";
Return format:
{
“Catagory 1” : [Name1,Description1,Link1]
“Catagory 2” : [Name2,Description2,Link2],

const activityData = `
Painting classes for kids in New York City
Query: Painting classes for kids in New York City
Title: Kids at Art - The Best Children's Art Classes in NYC - Kids at Art
Link: https://www.kidsatartnyc.com/
Description: Kids at Art offers art classes for kids ages 2 - 11, plus art classes for teens and adults too! Painting, drawing, sculpture, fashion design, ...


Query: Art exhibitions for children in New York City
Title: Children's Museum of the Arts
Link: https://www.cmany.org/
Description: CMA organizes free public art events that enable children to create, curate and exhibit their own artwork on an equal footing with their grown-up counterparts.


Query: Computer workshops for kids in New York City
Title: New York Coding Classes for Kids: Free Programs
Link: https://www.create-learn.us/blog/new-york-coding-classes-for-kids/
Description: We've curated a selection of top-tier New York City coding classes for kids, ranging from Cobble Hill, Tribeca, and Brooklyn to Manhattan, and beyond.


Query: Coding classes for kids in New York City
Title: Coding Classes for Kids in New York City | CodeWizardsHQ
Link: https://www.codewizardshq.com/coding-classes-near-me/coding-classes-new-york-city/
Description: No description available


Query: Tech museums in New York City
Title: Mercer Labs
Link: https://mercerlabs.com/
Description: Mercer Labs where culture and innovation converge with intention and art humanizes technology. The museum fosters this exchange among artists through ...


Query: Art supplies stores in New York City
Title: 6th Ave Art Store | New York City, NY
Link: https://www.dickblick.com/stores/new-york/new-york-city-6th-ave/?srsltid=AfmBOooOr4JUZGvEXJ5BW-w-wRQ1O-kq1H5y8zon4qgJ54Abptn4PQkZ
Description: Visit the New York BLICK store located in Midtown on 6th Ave and 20th St. Shop a wide assortment of art supplies, craft supplies, and unique gift items.


Query: Kids friendly art galleries in New York City
Title: Museums, Galleries & Exhibits for NYC Kids
Link: https://mommypoppins.com/family/best-museums-and-exhibits-for-kids-in-nyc
Description: The ultimate guide to the best museums, galleries and exhibits in NYC for kids - plus how to make your family visit run smoothly, and how to get in free.


Query: Educational computer games events in New York City
Title: NYC Summer of Games - MOME
Link: https://www.nyc.gov/site/mome/industries/nyc-summer-of-games.page
Description: NYC Summer of Games 2024 celebrates New York City's booming digital games community featuring marquee events, expos, tournaments, exhibits, workshops, and ...


Query: Interactive tech exhibits for kids in New York City
Title: Interactive Experiences - Kid On The Town
Link: https://www.kidonthetown.com/pop-ups/
Description: No description available


Query: DIY painting activity in New York City
Title: New York Shot of Art Studio - Painting Events, Location ...
Link: https://www.shotofart.com/city/new-york
Description: Unleash your artistic passion today with Shot of Art studio in New York City. Explore our unique art events, painting classes, adult & kids parties, prices, ...


`;


const prompt = `
You are an expert recommender tasked with recommending activities for a user living in a specific. You are to rank the different links you find based on how likely the user is to take them. Use the user data given below to rank the different queries
User data:
${userdata}
Activity Data:

${activityData}




`;


}`;

// Call the GPT API with the prompt
const response = await axios.post(
'https://api.openai.com/v1/chat/completions',
Expand Down
52 changes: 19 additions & 33 deletions src/components/UserForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import React, { useState } from 'react';
import { useNavigate } from 'react-router-dom';

import Query2 from '../FinalOutputAi'

function UserForm() {
const [formData, setFormData] = useState({
Expand All @@ -27,40 +28,25 @@ function UserForm() {
setStep(step - 1);
};

const handleSearch = async () => {
const queries = {
queries: [
"Art education opportunities for kids in New York City",
"Computer science education opportunities for kids in New York City",
// ...other queries as needed
],
};

try {
const response = await fetch('http://127.0.0.1:8000/search', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(queries),
});
if (response.ok) {
const results = await response.json();
setSearchResults(results);
console.log("Formatted Search Results:", results);
} else {
console.error("Error fetching search results:", response.statusText);
}
} catch (error) {
console.error("Error fetching search results:", error);
}
};
// Async function to call fetchSearchResults


const handleSubmit = async (e) => { // Make handleSubmit async
const handleSubmit = (e) => {
e.preventDefault();
await handleSearch(); // Await search to ensure it completes before navigating




{/*Data managment system */}
const formattedData = `City: ${formData.city}\nAddress: ${formData.address}\nBio: ${formData.bio}\nAge: ${formData.age}`;
console.log("Submitted Data:", formattedData);

{/* const querysFromGPT = Query(formattedData); // Pass the formatted data to the Query function

const datafromSearchAPI = searchAPI(querysFromGPT)

const summarizedData = summarizeGPT(datafromSearchAPI)
*/}



navigate('/opportunity');
};

Expand Down