fix: knowledge base status problem
This commit is contained in:
parent
31b0fbf775
commit
8c5999dc82
@ -242,7 +242,7 @@ const KnowledgeContent: FC<KnowledgeContentProps> = ({ selectedBase }) => {
|
|||||||
<FlexAlignCenter>
|
<FlexAlignCenter>
|
||||||
{item.uniqueId && <Button type="text" icon={<RefreshIcon />} onClick={() => refreshItem(item)} />}
|
{item.uniqueId && <Button type="text" icon={<RefreshIcon />} onClick={() => refreshItem(item)} />}
|
||||||
<StatusIconWrapper>
|
<StatusIconWrapper>
|
||||||
<StatusIcon sourceId={item.id} base={base} getProcessingStatus={getProcessingStatus} />
|
<StatusIcon sourceId={item.id} base={base} getProcessingStatus={getProcessingStatus} type="file" />
|
||||||
</StatusIconWrapper>
|
</StatusIconWrapper>
|
||||||
<Button type="text" danger onClick={() => removeItem(item)} icon={<DeleteOutlined />} />
|
<Button type="text" danger onClick={() => removeItem(item)} icon={<DeleteOutlined />} />
|
||||||
</FlexAlignCenter>
|
</FlexAlignCenter>
|
||||||
@ -279,6 +279,7 @@ const KnowledgeContent: FC<KnowledgeContentProps> = ({ selectedBase }) => {
|
|||||||
base={base}
|
base={base}
|
||||||
getProcessingStatus={getProcessingStatus}
|
getProcessingStatus={getProcessingStatus}
|
||||||
progressingPercent={progressingPercent}
|
progressingPercent={progressingPercent}
|
||||||
|
type="directory"
|
||||||
/>
|
/>
|
||||||
</StatusIconWrapper>
|
</StatusIconWrapper>
|
||||||
<Button type="text" danger onClick={() => removeItem(item)} icon={<DeleteOutlined />} />
|
<Button type="text" danger onClick={() => removeItem(item)} icon={<DeleteOutlined />} />
|
||||||
@ -311,7 +312,7 @@ const KnowledgeContent: FC<KnowledgeContentProps> = ({ selectedBase }) => {
|
|||||||
<FlexAlignCenter>
|
<FlexAlignCenter>
|
||||||
{item.uniqueId && <Button type="text" icon={<RefreshIcon />} onClick={() => refreshItem(item)} />}
|
{item.uniqueId && <Button type="text" icon={<RefreshIcon />} onClick={() => refreshItem(item)} />}
|
||||||
<StatusIconWrapper>
|
<StatusIconWrapper>
|
||||||
<StatusIcon sourceId={item.id} base={base} getProcessingStatus={getProcessingStatus} />
|
<StatusIcon sourceId={item.id} base={base} getProcessingStatus={getProcessingStatus} type="url" />
|
||||||
</StatusIconWrapper>
|
</StatusIconWrapper>
|
||||||
<Button type="text" danger onClick={() => removeItem(item)} icon={<DeleteOutlined />} />
|
<Button type="text" danger onClick={() => removeItem(item)} icon={<DeleteOutlined />} />
|
||||||
</FlexAlignCenter>
|
</FlexAlignCenter>
|
||||||
@ -343,7 +344,12 @@ const KnowledgeContent: FC<KnowledgeContentProps> = ({ selectedBase }) => {
|
|||||||
<FlexAlignCenter>
|
<FlexAlignCenter>
|
||||||
{item.uniqueId && <Button type="text" icon={<RefreshIcon />} onClick={() => refreshItem(item)} />}
|
{item.uniqueId && <Button type="text" icon={<RefreshIcon />} onClick={() => refreshItem(item)} />}
|
||||||
<StatusIconWrapper>
|
<StatusIconWrapper>
|
||||||
<StatusIcon sourceId={item.id} base={base} getProcessingStatus={getProcessingStatus} />
|
<StatusIcon
|
||||||
|
sourceId={item.id}
|
||||||
|
base={base}
|
||||||
|
getProcessingStatus={getProcessingStatus}
|
||||||
|
type="sitemap"
|
||||||
|
/>
|
||||||
</StatusIconWrapper>
|
</StatusIconWrapper>
|
||||||
<Button type="text" danger onClick={() => removeItem(item)} icon={<DeleteOutlined />} />
|
<Button type="text" danger onClick={() => removeItem(item)} icon={<DeleteOutlined />} />
|
||||||
</FlexAlignCenter>
|
</FlexAlignCenter>
|
||||||
@ -370,7 +376,7 @@ const KnowledgeContent: FC<KnowledgeContentProps> = ({ selectedBase }) => {
|
|||||||
<FlexAlignCenter>
|
<FlexAlignCenter>
|
||||||
<Button type="text" onClick={() => handleEditNote(note)} icon={<EditOutlined />} />
|
<Button type="text" onClick={() => handleEditNote(note)} icon={<EditOutlined />} />
|
||||||
<StatusIconWrapper>
|
<StatusIconWrapper>
|
||||||
<StatusIcon sourceId={note.id} base={base} getProcessingStatus={getProcessingStatus} />
|
<StatusIcon sourceId={note.id} base={base} getProcessingStatus={getProcessingStatus} type="note" />
|
||||||
</StatusIconWrapper>
|
</StatusIconWrapper>
|
||||||
<Button type="text" danger onClick={() => removeItem(note)} icon={<DeleteOutlined />} />
|
<Button type="text" danger onClick={() => removeItem(note)} icon={<DeleteOutlined />} />
|
||||||
</FlexAlignCenter>
|
</FlexAlignCenter>
|
||||||
|
|||||||
@ -10,9 +10,10 @@ interface StatusIconProps {
|
|||||||
base: KnowledgeBase
|
base: KnowledgeBase
|
||||||
getProcessingStatus: (sourceId: string) => ProcessingStatus | undefined
|
getProcessingStatus: (sourceId: string) => ProcessingStatus | undefined
|
||||||
progressingPercent?: number
|
progressingPercent?: number
|
||||||
|
type: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const StatusIcon: FC<StatusIconProps> = ({ sourceId, base, getProcessingStatus, progressingPercent }) => {
|
const StatusIcon: FC<StatusIconProps> = ({ sourceId, base, getProcessingStatus, progressingPercent, type }) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const status = getProcessingStatus(sourceId)
|
const status = getProcessingStatus(sourceId)
|
||||||
const item = base.items.find((item) => item.id === sourceId)
|
const item = base.items.find((item) => item.id === sourceId)
|
||||||
@ -40,8 +41,16 @@ const StatusIcon: FC<StatusIconProps> = ({ sourceId, base, getProcessingStatus,
|
|||||||
<StatusDot $status="pending" />
|
<StatusDot $status="pending" />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)
|
)
|
||||||
case 'processing':
|
|
||||||
return <Progress type="circle" size={14} percent={Number(progressingPercent?.toFixed(0))} />
|
case 'processing': {
|
||||||
|
return type === 'directory' ? (
|
||||||
|
<Progress type="circle" size={14} percent={Number(progressingPercent?.toFixed(0))} />
|
||||||
|
) : (
|
||||||
|
<Tooltip title={t('knowledge.status_processing')} placement="left">
|
||||||
|
<StatusDot $status="processing" />
|
||||||
|
</Tooltip>
|
||||||
|
)
|
||||||
|
}
|
||||||
case 'completed':
|
case 'completed':
|
||||||
return (
|
return (
|
||||||
<Tooltip title={t('knowledge.status_completed')} placement="left">
|
<Tooltip title={t('knowledge.status_completed')} placement="left">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user