MCPcopy Create free account
hub / github.com/code100x/daily-code / insertData

Function insertData

apps/web/lib/search.ts:56–86  ·  view source on GitHub ↗
(trackId: string)

Source from the content-addressed store, hash-verified

54}
55
56export async function insertData(trackId: string) {
57 const data = await scrapeData({ trackId });
58 data.forEach(async (problem) => {
59 const response = await model.embedContent(problem.titles);
60 problem.vector = response.embedding.values.slice(0, VECTOR_SIZE);
61 await client.upsert("DailyCode", {
62 wait: true,
63 points: [
64 {
65 id: randomUUID(),
66 vector: problem.vector,
67 payload: {
68 trackId: problem.trackId,
69 trackTitle: problem.trackTitle,
70 image: problem.image,
71 problemTitle: problem.title,
72 problemId: problem.id,
73 },
74 },
75 ],
76 });
77 });
78 await db.track.update({
79 where: {
80 id: trackId,
81 },
82 data: {
83 inSearch: true,
84 },
85 });
86}
87
88export async function getSearchResults(query: string) {
89 const vector = await model.embedContent(query);

Callers 2

handleAddTracksFunction · 0.90
handleAddTrackFunction · 0.90

Calls 1

scrapeDataFunction · 0.85

Tested by

no test coverage detected