Skip to content

Commit

Permalink
Merge pull request #118 from SciPhi-AI/Nolan/CleanUp
Browse files Browse the repository at this point in the history
Clean up collection naming conventions
  • Loading branch information
NolanTrem authored Oct 30, 2024
2 parents 698006a + e909506 commit 77f9af4
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 47 deletions.
95 changes: 48 additions & 47 deletions src/pages/collection/[collection_id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
Entity,
Community,
Triple,
DocumentInCollectionType,
} from '@/types';

const MAX_RETRIES = 5;
Expand Down Expand Up @@ -264,52 +265,6 @@ const CollectionIdPage: React.FC = () => {
setCurrentPage(page);
};

const columns: Column<DocumentInfoType>[] = [
{ key: 'title', label: 'Title', sortable: true },
{ key: 'id', label: 'Document ID', truncate: true, copyable: true },
{
key: 'ingestion_status',
label: 'Ingestion',
filterable: true,
filterType: 'multiselect',
filterOptions: ['success', 'failed', 'pending'],
renderCell: (doc) => (
<Badge
variant={
doc.ingestion_status === IngestionStatus.SUCCESS
? 'success'
: doc.ingestion_status === IngestionStatus.FAILED
? 'destructive'
: 'pending'
}
>
{doc.ingestion_status}
</Badge>
),
},
{
key: 'kg_extraction_status',
label: 'KG Extraction',
filterable: true,
filterType: 'multiselect',
filterOptions: ['success', 'failed', 'pending'],
renderCell: (doc) => (
<Badge
variant={
doc.kg_extraction_status === KGExtractionStatus.SUCCESS
? 'success'
: doc.kg_extraction_status === KGExtractionStatus.FAILED
? 'destructive'
: 'pending'
}
>
{doc.kg_extraction_status}
</Badge>
),
selected: false,
},
];

const renderDocumentActions = (doc: DocumentInfoType) => (
<div className="flex space-x-1 justify-end">
<RemoveButton
Expand Down Expand Up @@ -385,6 +340,52 @@ const CollectionIdPage: React.FC = () => {
</div>
);

const documentColumns: Column<DocumentInCollectionType>[] = [
{ key: 'title', label: 'Title', sortable: true },
{ key: 'id', label: 'Document ID', truncate: true, copyable: true },
{
key: 'ingestion_status',
label: 'Ingestion',
filterable: true,
filterType: 'multiselect',
filterOptions: ['success', 'failed', 'pending'],
renderCell: (doc) => (
<Badge
variant={
doc.ingestion_status === IngestionStatus.SUCCESS
? 'success'
: doc.ingestion_status === IngestionStatus.FAILED
? 'destructive'
: 'pending'
}
>
{doc.ingestion_status}
</Badge>
),
},
{
key: 'kg_extraction_status',
label: 'KG Extraction',
filterable: true,
filterType: 'multiselect',
filterOptions: ['success', 'failed', 'pending'],
renderCell: (doc) => (
<Badge
variant={
doc.kg_extraction_status === KGExtractionStatus.SUCCESS
? 'success'
: doc.kg_extraction_status === KGExtractionStatus.FAILED
? 'destructive'
: 'pending'
}
>
{doc.kg_extraction_status}
</Badge>
),
selected: false,
},
];

const userColumns: Column<User>[] = [
{ key: 'id', label: 'User ID', truncate: true, copyable: true },
{ key: 'email', label: 'Email', truncate: true, copyable: true },
Expand Down Expand Up @@ -500,7 +501,7 @@ const CollectionIdPage: React.FC = () => {
<TabsContent value="documents" className="flex-1 overflow-auto">
<Table
data={documents}
columns={columns}
columns={documentColumns}
itemsPerPage={itemsPerPage}
onSelectAll={handleSelectAll}
onSelectItem={(itemId: string, selected: boolean) => {
Expand Down
13 changes: 13 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,19 @@ export interface DocumentInfoType {
updated_at: string;
}

export interface DocumentInCollectionType {
id: string;
title: string;
user_id: string;
document_type?: string;
created_at: string;
updated_at: string;
ingestion_status: IngestionStatus;
kg_extraction_status: KGExtractionStatus;
collection_ids: string[];
metadata: Record<string, any>;
}

export interface DocumentInfoDialogProps {
id: string;
apiUrl?: string;
Expand Down

0 comments on commit 77f9af4

Please sign in to comment.