Skip to content

Commit

Permalink
oai embeddings for more semantic search <> personalized recommendatio…
Browse files Browse the repository at this point in the history
…ns (#9)

* update: intial setUp for oai azure embeddings

* update db with embddings

* Ui updates

* update: dependencies

* env update

* readme updates

* assets

* feat: embed the docs before pushing in DB also while fetching recommendations

* fix: env files
  • Loading branch information
Hk669 authored Jul 12, 2024
1 parent b6f1bf3 commit 620355f
Show file tree
Hide file tree
Showing 28 changed files with 252 additions and 135 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ jobs:
GITHUB_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
MONGODB_URL: ${{ secrets.MONGODB_URL }}
GPAT: ${{ secrets.GPAT }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
AZURE_DEPLOYMENT: ${{ secrets.AZURE_DEPLOYMENT }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Open-Source Recommender

![alt text](public/application.png)
![application](public/application.png)

This will be a free public-facing web application designed to find open-source projects for beginners and developers.

Expand Down
Binary file not shown.
Binary file removed chroma/2fb656f8-eea6-4410-9c54-1e6d21ab400c/header.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified chroma/chroma.sqlite3
Binary file not shown.
10 changes: 10 additions & 0 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.7.2",
"date-fns": "^3.6.0",
"hamburger-react": "^2.5.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
4 changes: 2 additions & 2 deletions client/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ body {
justify-content: space-between;
width: 100%;
max-width: 1200px;
margin: 0 auto;
margin-top: auto;
padding: 20px;
}

Expand Down Expand Up @@ -96,6 +96,6 @@ body {
}

.recommendations-container {
margin-top: 20px;
margin-top: 10px;
}
}
78 changes: 39 additions & 39 deletions client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function App() {
if (response.ok) {
const data = await response.json();
setIsAuthenticated(true);
setUserData(data); // The backend now returns only necessary user information
setUserData(data);
navigate("/recommender");
} else {
localStorage.removeItem("jwt_token");
Expand Down Expand Up @@ -67,44 +67,44 @@ function App() {
navigate("/login");
};

return (
<div className="App">
<Navbar isAuthenticated={isAuthenticated} userData={userData} onLogout={handleLogout} />
<div className="app-container">
<Routes>
<Route path="/login" element={<Login />} />
<Route path="/auth-callback" element={<GithubCallback />} />
<Route
path="/recommender"
element={
isAuthenticated ? (
<>
<div className={`form-container ${recommendations.length > 0 ? "with-recommendations" : ""}`}>
<Input onSubmit={handleSubmit} userData={userData} />
</div>
<div className={`recommendations-container ${recommendations.length > 0 ? "visible" : ""}`}>
{loading ? (
<div className="loading-container">
<div className="loader"></div>
<p>Loading recommendations...</p>
</div>
) : recommendations.length > 0 ? (
<Recommendation recommendations={recommendations} />
) : null}
</div>
</>
) : (
<Login />
)
}
/>
<Route path="*" element={<Login />} />
</Routes>
</div>
<ToastContainer />
<Footer />
return (
<div className="App">
<Navbar isAuthenticated={isAuthenticated} userData={userData} onLogout={handleLogout} />
<div className="app-container">
<Routes>
<Route path="/login" element={<Login />} />
<Route path="/auth-callback" element={<GithubCallback />} />
<Route
path="/recommender"
element={
isAuthenticated ? (
<>
<div className={`form-container ${recommendations.length > 0 ? "with-recommendations" : ""}`}>
<Input onSubmit={handleSubmit} userData={userData} />
</div>
<div className={`recommendations-container ${recommendations.length > 0 ? "visible" : ""}`}>
{loading ? (
<div className="loading-container">
<div className="loader"></div>
<p>Loading recommendations...</p>
</div>
) : recommendations.length > 0 ? (
<Recommendation recommendations={recommendations} />
) : null}
</div>
</>
) : (
<Login />
)
}
/>
<Route path="*" element={<Login />} />
</Routes>
</div>
);
};
<ToastContainer />
<Footer />
</div>
);
}

export default App;
25 changes: 20 additions & 5 deletions client/src/components/Input/Input.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ form button {
}

form button:hover {
background-color: #ffffff;
color:#000000;
text-decoration: none;
background: linear-gradient(to right, #fa0366 -40%, #000000 140%);
-webkit-text-fill-color: white;

font-weight: 500;
cursor: pointer;
}

h2 {
Expand Down Expand Up @@ -96,22 +100,33 @@ ul li a:hover {
width: 90%;
}

p {
font-size: x-small;
color:#9b9696
}

.tag {
background-color: #bdc7ea;
border-radius: 16px;
border-radius: 10px;
padding: 5px 10px;
margin-top: 10px;
margin-right: 5px;
margin-bottom: 5px;
display: flex;
align-items: center;
height: 30px;
font-size: smaller;
cursor: default; /* Ensure the cursor is not a pointer */
}

.tag button {
background: none;
border: none;
cursor: pointer;
font-size: 16px;
margin-left: 5px;
padding: 0;
}
margin-left: 5px; /* Space between text and button */
line-height: 1; /* Prevent button from changing height */
/* Optional: set a width if needed */
width: 20px; /* Or adjust as necessary */
}
11 changes: 11 additions & 0 deletions client/src/components/Input/Input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,20 @@ const Input = ({ onSubmit }) => {
return;
}

if (!username) {
toast.error("GitHub username is required.", {
position: "top-right",
});
return;
}

setLoading(true);

try {
const response = await axios.post(
`http://127.0.0.1:8000/api/recommendations/`,
{
username: username,
languages: languages,
extra_topics: extraTopics,
},
Expand Down Expand Up @@ -153,6 +163,7 @@ const Input = ({ onSubmit }) => {
<button type="submit" disabled={loading}>
{loading ? "Fetching Recommendations..." : "Get Recommendations"}
</button>
<p>*Open Source Recommender can make mistakes</p>
</form>
);
};
Expand Down
15 changes: 13 additions & 2 deletions client/src/components/Login/Login.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
}

.github-login-button:hover {
background: linear-gradient(to right, #9181f4 -40%, #fffa64 140%);
-webkit-text-fill-color: black;
background: linear-gradient(to right, #fa0366 -40%, #000000 140%);
-webkit-text-fill-color: rgb(255, 255, 255);
cursor: pointer;
}

Expand All @@ -40,6 +40,7 @@ h3 {
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
margin-top: 20px;
padding-left: 50px;
padding-right: 50px;
}

.features-container ul li:hover {
Expand All @@ -56,3 +57,13 @@ h3 {
list-style-type: none;
padding: 10px;
}

.login-container p{
font-size: 1.2rem;
margin-top: 1rem;
margin-bottom: 2rem;
}

.login-container {
margin-left: 3rem;
}
4 changes: 2 additions & 2 deletions client/src/components/Login/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ const Login = () => {
return (
<div className="login-container">
<h1>Search Your Next Open-Source Contribution with Ease!</h1>
<h3>
<p>
Discover the perfect open-source projects to contribute to with this
personalized recommendation system. Whether you're new to open source or
a seasoned contributor, find relevant repositories tailored just for
you.
</h3>
</p>
<br></br>

<button className="github-login-button" onClick={handleLogin}>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Navbar/Navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}

.logo img {
height: 40px; /* Adjust as needed */
height: 55px; /* Adjust as needed */
}

.nav-links {
Expand Down
60 changes: 14 additions & 46 deletions client/src/components/Recommendation/Recommendation.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,14 @@
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.reco-container ul li:hover {
text-decoration: none;
background: linear-gradient(to right, #9181f4 -40%, #ed6c7d 140%);
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color:transparent;
font-weight: 700;
cursor: pointer;
}

.reco-container ul {
list-style-type: none;
padding: 0;
}

.reco-container ul li {
margin-bottom: 10px;
}

.reco-container ul li a {
color: #333;
text-decoration: none;
font-size: 16px;
}

.reco-container ul li a:hover {
text-decoration: none;
.reco-container h2 {
margin-bottom: 20px;
}

.repo-card {
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
padding: 15px;
border: 1px solid #ddd;
border-radius: 8px;
Expand Down Expand Up @@ -66,28 +42,14 @@
display: flex;
flex-wrap: wrap;
margin-top: 8px;
font-size: small;
}

.repo-details span {
margin-right: 10px;
margin-bottom: 5px;
padding: 5px 10px;
background-color: #f0f0f0;
border-radius: 5px;
}

.repo-details span:first-child {
margin-left: 0;
}

.repo-avatar {
margin-left: 20px;
}

.repo-avatar img {
width: 80px;
height: 80px;
border-radius: 50%;
padding: 5px 10px; /* Keep padding for spacing */
/* Removed background-color and border-radius */
}

.repo-link {
Expand All @@ -102,6 +64,12 @@

.repo-link a:hover {
text-decoration: underline;
background: linear-gradient(to right, #fa0366 -40%, #000000 140%);
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-weight: 700;
cursor: pointer;
}

.topics-container {
Expand All @@ -116,4 +84,4 @@
border-radius: 5px;
margin-right: 8px;
margin-bottom: 8px;
}
}
Loading

0 comments on commit 620355f

Please sign in to comment.