Skip to content

Commit

Permalink
Fix new ingestion status of enriched
Browse files Browse the repository at this point in the history
  • Loading branch information
NolanTrem committed Nov 5, 2024
1 parent 77f9af4 commit 746b05b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
17 changes: 13 additions & 4 deletions src/components/ChatDemo/DocumentsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const DocumentsTable: React.FC<DocumentsTableProps> = ({
order: 'asc' | 'desc';
}>({ key: 'title', order: 'asc' });
const [filters, setFilters] = useState<Record<string, any>>({
ingestion_status: ['success', 'failed', 'pending'],
ingestion_status: ['success', 'failed', 'pending', 'enriched'],
kg_extraction_status: ['success', 'failed', 'pending'],
});
const [currentPage, setCurrentPage] = useState(1);
Expand All @@ -73,6 +73,9 @@ const DocumentsTable: React.FC<DocumentsTableProps> = ({
if (lowerStatus === 'failed') {
return IngestionStatus.FAILED;
}
if (lowerStatus === 'enriched') {
return IngestionStatus.ENRICHED;
}
return IngestionStatus.PENDING;
};

Expand Down Expand Up @@ -121,13 +124,16 @@ const DocumentsTable: React.FC<DocumentsTableProps> = ({
label: 'Ingestion',
filterable: true,
filterType: 'multiselect',
filterOptions: ['success', 'failed', 'pending'],
filterOptions: ['success', 'failed', 'pending', 'enriched'],
renderCell: (doc) => {
let variant: 'success' | 'destructive' | 'pending' = 'pending';
let variant: 'success' | 'destructive' | 'pending' | 'enriched' = 'pending';
switch (doc.ingestion_status) {
case IngestionStatus.SUCCESS:
variant = 'success';
break;
case IngestionStatus.ENRICHED:
variant = 'success';
break;
case IngestionStatus.FAILED:
variant = 'destructive';
break;
Expand Down Expand Up @@ -203,7 +209,10 @@ const DocumentsTable: React.FC<DocumentsTableProps> = ({
setIsDocumentInfoDialogOpen(true);
}}
color="filled"
disabled={doc.ingestion_status !== IngestionStatus.SUCCESS}
disabled={
doc.ingestion_status !== IngestionStatus.SUCCESS &&
doc.ingestion_status !== IngestionStatus.ENRICHED
}
shape="slim"
tooltip="View Document Info"
>
Expand Down
6 changes: 4 additions & 2 deletions src/pages/collection/[collection_id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ const CollectionIdPage: React.FC = () => {
.filter(
(doc: DocumentInfoType) =>
doc.ingestion_status !== IngestionStatus.SUCCESS &&
doc.ingestion_status !== IngestionStatus.ENRICHED &&
doc.ingestion_status !== IngestionStatus.FAILED
)
.map((doc: DocumentInfoType) => doc.id)
Expand Down Expand Up @@ -193,6 +194,7 @@ const CollectionIdPage: React.FC = () => {
(doc: DocumentInfoType) =>
doc.id === id &&
doc.ingestion_status !== IngestionStatus.SUCCESS &&
doc.ingestion_status !== IngestionStatus.ENRICHED &&
doc.ingestion_status !== IngestionStatus.FAILED
)
)
Expand Down Expand Up @@ -348,11 +350,11 @@ const CollectionIdPage: React.FC = () => {
label: 'Ingestion',
filterable: true,
filterType: 'multiselect',
filterOptions: ['success', 'failed', 'pending'],
filterOptions: ['success', 'failed', 'pending', 'enriched'],
renderCell: (doc) => (
<Badge
variant={
doc.ingestion_status === IngestionStatus.SUCCESS
doc.ingestion_status === IngestionStatus.SUCCESS || IngestionStatus.EMBEDDING
? 'success'
: doc.ingestion_status === IngestionStatus.FAILED
? 'destructive'
Expand Down
1 change: 1 addition & 0 deletions src/pages/documents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const Index: React.FC = () => {
.filter(
(doc) =>
doc.ingestion_status !== IngestionStatus.SUCCESS &&
doc.ingestion_status !== IngestionStatus.ENRICHED &&
doc.ingestion_status !== IngestionStatus.FAILED
)
.map((doc) => doc.id);
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export enum IngestionStatus {
STORING = 'storing',
FAILED = 'failed',
SUCCESS = 'success',
ENRICHED = 'enriched',
}

export enum KGExtractionStatus {
Expand Down

0 comments on commit 746b05b

Please sign in to comment.