-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
089f727
commit c93f743
Showing
3 changed files
with
112 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Card, CardContent, CardHeader, CardTitle } from "./ui/card"; | ||
|
||
export type Document = { | ||
page_content: string; | ||
metadata: Record<string, any>; | ||
}; | ||
|
||
export const DocumentCard = ({ document }: { document: Document }) => { | ||
const description = | ||
document.metadata.description && document.metadata.description !== "" | ||
? document.metadata.description | ||
: document.page_content.slice(0, 250); | ||
|
||
return ( | ||
<Card className="md:w-[200px] sm:w-[200px] w-full h-[110px] bg-inherit border-gray-500 flex flex-col"> | ||
<CardHeader className="flex-shrink-0 px-3 pt-2 pb-0"> | ||
<CardTitle className="text-sm font-light text-gray-300 line-clamp-1 overflow-hidden p-[-24px]"> | ||
{document.metadata.title} | ||
</CardTitle> | ||
</CardHeader> | ||
<CardContent className="flex flex-col px-3 flex-grow justify-between"> | ||
<p className="text-xs font-light text-gray-400 line-clamp-4 overflow-hidden"> | ||
{description} | ||
</p> | ||
</CardContent> | ||
</Card> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters