Skip to content

Commit

Permalink
Convert storeEmbeddings to a server-side API
Browse files Browse the repository at this point in the history
  • Loading branch information
praveen-palanisamy committed May 2, 2023
1 parent ffc00b1 commit cdb9a45
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 32 deletions.
17 changes: 15 additions & 2 deletions renderer/components/FileUploadArea.tsx
Expand Up @@ -91,8 +91,21 @@ function FileUploadArea(props: FileUploadAreaProps) {
};
// console.log(fileObject);
// Store embeddings in the database
await storeEmbeddings(fileObject);

try {
const storeEmbeddingsResponse = await axios.post(
"/api/store-embeddings",
// send fileObject to /api/store-embeddings in req.body
fileObject
);

if (storeEmbeddingsResponse.status === 200) {
console.log("Embeddings stored");
}
} catch (err: any) {
console.log(`Error storing embeddings: ${err}`);
return null;
}
// Return the fileObject
return fileObject;
} else {
console.log("Error creating file embedding");
Expand Down
30 changes: 0 additions & 30 deletions renderer/services/storeEmbeddings.ts

This file was deleted.

0 comments on commit cdb9a45

Please sign in to comment.