Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasdavis committed Feb 1, 2025
1 parent 55bad89 commit 04352e8
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions apps/registry/pages/api/jobs-graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 All @@ -173,12 +173,6 @@ export default async function handler(req, res) {
jobInfoMap[job.uuid] = JSON.parse(job.gpt_content);
});

// Set cache control headers for CDN caching
res.setHeader(
'Cache-Control',
'public, max-age=86400, s-maxage=86400, stale-while-revalidate=604800'
);

res.status(200).json({
graphData,
jobInfoMap,
Expand Down

0 comments on commit 04352e8

Please sign in to comment.