Commit 1b3028d7 authored by JzoNg's avatar JzoNg

fix: file icon

parent 3cbd57f3
...@@ -78,3 +78,34 @@ ...@@ -78,3 +78,34 @@
color: #f79009; color: #f79009;
@apply text-xs font-medium; @apply text-xs font-medium;
} }
.fileIcon {
@apply w-4 h-4 mr-1 bg-center bg-no-repeat;
background-image: url(../assets/unknow.svg);
background-size: 16px;
}
.fileIcon.csv {
background-image: url(../assets/csv.svg);
}
.fileIcon.xlsx,
.fileIcon.xls {
background-image: url(../assets/xlsx.svg);
}
.fileIcon.pdf {
background-image: url(../assets/pdf.svg);
}
.fileIcon.html,
.fileIcon.htm {
background-image: url(../assets/html.svg);
}
.fileIcon.md,
.fileIcon.markdown {
background-image: url(../assets/md.svg);
}
.fileIcon.txt {
background-image: url(../assets/txt.svg);
}
.fileIcon.json {
background-image: url(../assets/json.svg);
}
...@@ -146,6 +146,7 @@ const EmbeddingProcess: FC<Props> = ({ datasetId, batchId, documents = [], index ...@@ -146,6 +146,7 @@ const EmbeddingProcess: FC<Props> = ({ datasetId, batchId, documents = [], index
const doc = documents.find(document => document.id === id) const doc = documents.find(document => document.id === id)
return doc?.name return doc?.name
} }
const getFileType = (name?: string) => name?.split('.').pop() || 'txt'
const getSourcePercent = (detail: IndexingStatusResponse) => { const getSourcePercent = (detail: IndexingStatusResponse) => {
const completedCount = detail.completed_segments || 0 const completedCount = detail.completed_segments || 0
const totalCount = detail.total_segments || 0 const totalCount = detail.total_segments || 0
...@@ -202,7 +203,7 @@ const EmbeddingProcess: FC<Props> = ({ datasetId, batchId, documents = [], index ...@@ -202,7 +203,7 @@ const EmbeddingProcess: FC<Props> = ({ datasetId, batchId, documents = [], index
)} )}
<div className={s.info}> <div className={s.info}>
{getSourceType(indexingStatusDetail.id) === DataSourceType.FILE && ( {getSourceType(indexingStatusDetail.id) === DataSourceType.FILE && (
<div className={s.type}></div> <div className={cn(s.fileIcon, s[getFileType(getSourceName(indexingStatusDetail.id))])}/>
)} )}
{getSourceType(indexingStatusDetail.id) === DataSourceType.NOTION && ( {getSourceType(indexingStatusDetail.id) === DataSourceType.NOTION && (
<NotionIcon <NotionIcon
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment