Skip to content

Commit

Permalink
asd
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasdavis committed Jan 12, 2025
1 parent 38296b9 commit 9642d34
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 8 deletions.
58 changes: 54 additions & 4 deletions apps/registry/app/[username]/jobs-graph/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,60 @@ export default function Jobs({ params }) {

return (
<div className="p-6">
{/* <Hero
title="Jobs graph"
description="This page shows the most related jobs to you in a directed force graph. Jobs with the most relevance appear linked to your resume. Less relevant jobs are connected to other jobs instead of directly to your resume."
/> */}
<div className="space-y-6 mb-8 max-w-4xl">
<div>
<h1 className="text-3xl font-bold text-gray-900 mb-2">Job Matches Graph</h1>
<p className="text-lg text-gray-600">
This graph shows jobs that match your resume. The closer a job matches your skills and experience, the larger and more connected its circle will be.
</p>
</div>

<div className="bg-white p-6 rounded-lg border border-gray-200 shadow-sm">
<h2 className="text-xl font-semibold text-gray-800 mb-4">How to Use the Graph</h2>

<div className="grid md:grid-cols-2 gap-6">
<div>
<h3 className="font-medium text-gray-900 mb-2">Reading the Graph</h3>
<ul className="space-y-2 text-gray-600">
<li className="flex items-start">
<span className="text-blue-500 mr-2"></span>
Your resume sits in the center
</li>
<li className="flex items-start">
<span className="text-blue-500 mr-2"></span>
Bigger circles mean closer skill matches
</li>
<li className="flex items-start">
<span className="text-blue-500 mr-2"></span>
Numbers show match rank (1 is the best match)
</li>
</ul>
</div>

<div>
<h3 className="font-medium text-gray-900 mb-2">Tools to Help You</h3>
<ul className="space-y-2 text-gray-600">
<li className="flex items-start">
<span className="text-blue-500 mr-2"></span>
Click any job to see its details
</li>
<li className="flex items-start">
<span className="text-blue-500 mr-2"></span>
Search helps find specific jobs
</li>
<li className="flex items-start">
<span className="text-blue-500 mr-2"></span>
Salary view shows pay ranges in blue
</li>
<li className="flex items-start">
<span className="text-blue-500 mr-2"></span>
Mark jobs as read to keep track
</li>
</ul>
</div>
</div>
</div>
</div>

{/* {!jobs && <Loading />} */}
<div className="mt-4 text-lg">
Expand Down
8 changes: 4 additions & 4 deletions apps/registry/pages/api/jobs-graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default async function handler(req, res) {
});

const resumeDescription = resumeCompletion.choices[0].message.content;

console.log({ resumeDescription });
// const resumeDescription = `
// Professional Summary
// Dynamic and accomplished Full-Stack Web Developer with extensive experience in building scalable, user-focused applications from the ground up, particularly in startup environments. Adept at wearing multiple hats to deliver robust, product-driven solutions that prioritize user feedback and high-impact results. A recognized leader in the open-source community and a trusted contributor to several high-profile initiatives, with a proven track record of driving innovation and collaboration.
Expand All @@ -67,7 +67,7 @@ export default async function handler(req, res) {
let embedding = completion.data[0].embedding;
if (embedding.length < desiredLength) {
embedding = embedding.concat(
Array(desiredLength - embedding.length).fill(0)
Array(desiredLength - embedding.length).fill(0),
);
}

Expand Down Expand Up @@ -145,13 +145,13 @@ export default async function handler(req, res) {
(best, current) => {
const similarity = cosineSimilarity(
lessRelevantVector,
JSON.parse(current.embedding_v5)
JSON.parse(current.embedding_v5),
);
return similarity > best.similarity
? { job: current, similarity }
: best;
},
{ job: null, similarity: -1 }
{ job: null, similarity: -1 },
);

if (mostSimilarJob.job) {
Expand Down

0 comments on commit 9642d34

Please sign in to comment.