Add AstraDB RAG Flow guide
This commit is contained in:
parent
52f503e7fa
commit
52154581d6
18 changed files with 3682 additions and 16 deletions
29
docs/src/theme/DownloadableJsonFile.js
Normal file
29
docs/src/theme/DownloadableJsonFile.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
const DownloadableJsonFile = ({ source, title }) => {
|
||||
const handleDownload = (event) => {
|
||||
event.preventDefault();
|
||||
fetch(source)
|
||||
.then((response) => response.blob())
|
||||
.then((blob) => {
|
||||
const url = window.URL.createObjectURL(
|
||||
new Blob([blob], { type: "application/json" })
|
||||
);
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.setAttribute("download", title);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
link.parentNode.removeChild(link);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error downloading file:", error);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<a href={source} download={title} onClick={handleDownload}>
|
||||
{title}
|
||||
</a>
|
||||
);
|
||||
};
|
||||
|
||||
export default DownloadableJsonFile;
|
||||
Loading…
Add table
Add a link
Reference in a new issue