mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-17 19:32:47 +03:00
e4217fe15f
* feature: delete file * feature: consume /explore/file_name to view details of an uploaded document * feature: optimistic update when deleting file * feature: Loading state for /explore * style: Exit animation * style: responsive card
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import axios from "axios";
|
|
import { Document } from "../types";
|
|
|
|
interface DocumentDataProps {
|
|
documentName: string;
|
|
}
|
|
|
|
const DocumentData = async ({ documentName }: DocumentDataProps) => {
|
|
const res = await axios.get(
|
|
`${process.env.NEXT_PUBLIC_BACKEND_URL}/explore/${documentName}`
|
|
);
|
|
const documents = res.data.documents as any[];
|
|
const doc = documents[0];
|
|
return (
|
|
<div className="prose">
|
|
<p>No. of documents: {documents.length}</p>
|
|
{/* {documents.map((doc) => (
|
|
<pre key={doc.name}>{JSON.stringify(doc)}</pre>
|
|
))} */}
|
|
<div className="flex flex-col gap-2">
|
|
{documents[0] &&
|
|
Object.keys(documents[0]).map((k) => {
|
|
return (
|
|
<div className="grid grid-cols-2 border-b py-2" key={k}>
|
|
<span className="capitalize font-bold">
|
|
{k.replaceAll("_", " ")}
|
|
</span>
|
|
<span className="">{documents[0][k] || "Not Available"}</span>
|
|
</div>
|
|
);
|
|
})}
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default DocumentData;
|