Skip to content

Commit edbc396

Browse files
authored
Fix: Added some prompts and polling functionality to retrieve data source logs. infiniflow#10703 (infiniflow#11103)
### What problem does this PR solve? Fix: Added some prompts and polling functionality to retrieve data source logs. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
1 parent b137de1 commit edbc396

File tree

13 files changed

+155
-95
lines changed

13 files changed

+155
-95
lines changed

web/src/components/ui/input.tsx

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,47 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
3030
}
3131
};
3232
return (
33-
<div className="relative w-full">
34-
<input
35-
type={type === 'password' && showPassword ? 'text' : type}
36-
className={cn(
37-
'flex h-8 w-full rounded-md border border-input bg-bg-input px-2 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-text-disabled focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 text-text-primary',
38-
className,
39-
)}
40-
ref={ref}
41-
value={inputValue ?? ''}
42-
onChange={handleChange}
43-
{...restProps}
44-
/>
45-
{type === 'password' && (
46-
<button
47-
type="button"
48-
className="absolute inset-y-0 right-0 pr-3 flex items-center"
49-
onClick={() => setShowPassword(!showPassword)}
50-
>
51-
{showPassword ? (
52-
<EyeOff className="h-4 w-4 text-text-secondary" />
53-
) : (
54-
<Eye className="h-4 w-4 text-text-secondary" />
33+
<>
34+
{type !== 'password' && (
35+
<input
36+
type={type === 'password' && showPassword ? 'text' : type}
37+
className={cn(
38+
'flex h-8 w-full rounded-md border border-input bg-bg-input px-2 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-text-disabled focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 text-text-primary',
39+
className,
5540
)}
56-
</button>
41+
ref={ref}
42+
value={inputValue ?? ''}
43+
onChange={handleChange}
44+
{...restProps}
45+
/>
46+
)}
47+
{type === 'password' && (
48+
<div className="relative w-full">
49+
<input
50+
type={type === 'password' && showPassword ? 'text' : type}
51+
className={cn(
52+
'flex h-8 w-full rounded-md border border-input bg-bg-input px-2 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-text-disabled focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 text-text-primary',
53+
className,
54+
)}
55+
ref={ref}
56+
value={inputValue ?? ''}
57+
onChange={handleChange}
58+
{...restProps}
59+
/>
60+
<button
61+
type="button"
62+
className="absolute inset-y-0 right-0 pr-3 flex items-center"
63+
onClick={() => setShowPassword(!showPassword)}
64+
>
65+
{showPassword ? (
66+
<EyeOff className="h-4 w-4 text-text-secondary" />
67+
) : (
68+
<Eye className="h-4 w-4 text-text-secondary" />
69+
)}
70+
</button>
71+
</div>
5772
)}
58-
</div>
73+
</>
5974
);
6075
},
6176
);

web/src/locales/en.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@ export default {
274274
reRankModelWaring: 'Re-rank model is very time consuming.',
275275
},
276276
knowledgeConfiguration: {
277+
rebuildTip:
278+
'Re-downloads files from the linked data source and parses them again.',
279+
baseInfo: 'Basic Info',
280+
gobalIndex: 'Global Index',
277281
dataSource: 'Data Source',
278282
linkSourceSetTip: 'Manage data source linkage with this dataset',
279283
linkDataSource: 'Link Data Source',
@@ -304,7 +308,7 @@ export default {
304308
dataFlowPlaceholder: 'Please select a pipeline.',
305309
buildItFromScratch: 'Build it from scratch',
306310
dataFlow: 'Pipeline',
307-
parseType: 'Ingestion pipeline',
311+
parseType: 'Parse Type',
308312
manualSetup: 'Choose pipeline',
309313
builtIn: 'Built-in',
310314
titleDescription:
@@ -692,6 +696,8 @@ This auto-tagging feature enhances retrieval by adding another layer of domain-s
692696
newDocs: 'New Docs',
693697
timeStarted: 'Time started',
694698
log: 'Log',
699+
confluenceDescription:
700+
'Integrate your Confluence workspace to search documentation.',
695701
s3Description:
696702
'Connect to your AWS S3 bucket to import and sync stored files.',
697703
discordDescription:

web/src/locales/zh.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,9 @@ export default {
260260
theDocumentBeingParsedCannotBeDeleted: '正在解析的文档不能被删除',
261261
},
262262
knowledgeConfiguration: {
263+
rebuildTip: '从所有已关联的数据源重新下载文件并再次解析。',
264+
baseInfo: '基础信息',
265+
gobalIndex: '全局索引',
263266
dataSource: '数据源',
264267
linkSourceSetTip: '管理与此数据集的数据源链接',
265268
linkDataSource: '链接数据源',
@@ -282,14 +285,14 @@ export default {
282285
eidtLinkDataPipeline: '编辑pipeline',
283286
linkPipelineSetTip: '管理与此数据集的数据管道链接',
284287
default: '默认',
285-
dataPipeline: 'pipeline',
288+
dataPipeline: 'Ingestion pipeline',
286289
linkDataPipeline: '关联pipeline',
287290
enableAutoGenerate: '是否启用自动生成',
288291
teamPlaceholder: '请选择团队',
289292
dataFlowPlaceholder: '请选择pipeline',
290293
buildItFromScratch: '去Scratch构建',
291294
dataFlow: 'pipeline',
292-
parseType: 'Ingestion pipeline',
295+
parseType: '解析方法',
293296
manualSetup: '选择pipeline',
294297
builtIn: '内置',
295298
titleDescription: '在这里更新您的知识库详细信息,尤其是切片方法。',
@@ -683,6 +686,7 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于
683686
newDocs: '新文档',
684687
timeStarted: '开始时间',
685688
log: '日志',
689+
confluenceDescription: '连接你的 Confluence 工作区以搜索文档内容。',
686690
s3Description: ' 连接你的 AWS S3 存储桶以导入和同步文件。',
687691
discordDescription: ' 连接你的 Discord 服务器以访问和分析聊天数据。',
688692
notionDescription: ' 同步 Notion 页面与数据库,用于知识检索。',

web/src/pages/dataset/dataset-overview/interface.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ export interface IFileLogItem {
4949
process_duration: number;
5050
progress: number;
5151
progress_msg: string;
52-
source_type: string;
52+
source_type?: string;
53+
source_from?: string;
5354
status: string;
5455
task_type: string;
5556
tenant_id: string;

web/src/pages/dataset/dataset-overview/overview-table.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ export const getFileLogsTableColumns = (
107107
meta: { cellClassName: 'max-w-[10vw]' },
108108
cell: ({ row }) => (
109109
<div className="text-text-primary">
110-
{row.original.source_type
110+
{row.original.source_from
111111
? DataSourceInfo[
112-
row.original.source_type as keyof typeof DataSourceInfo
112+
row.original.source_from as keyof typeof DataSourceInfo
113113
].icon
114114
: t('localUpload')}
115115
</div>

web/src/pages/dataset/dataset-setting/components/link-data-source.tsx

Lines changed: 38 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
import { IconFontFill } from '@/components/icon-font';
12
import { Button } from '@/components/ui/button';
2-
import { Modal } from '@/components/ui/modal/modal';
3+
import {
4+
Tooltip,
5+
TooltipContent,
6+
TooltipTrigger,
7+
} from '@/components/ui/tooltip';
38
import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
49
import { IConnector } from '@/interfaces/database/knowledge';
510
import { delSourceModal } from '@/pages/user-setting/data-source/component/delete-source-modal';
611
import { DataSourceInfo } from '@/pages/user-setting/data-source/contant';
12+
import { useDataSourceRebuild } from '@/pages/user-setting/data-source/hooks';
713
import { IDataSourceBase } from '@/pages/user-setting/data-source/interface';
814
import { Link, Settings, Unlink } from 'lucide-react';
915
import { useMemo, useState } from 'react';
@@ -27,58 +33,45 @@ interface DataSourceItemProps extends IDataSourceNodeProps {
2733

2834
const DataSourceItem = (props: DataSourceItemProps) => {
2935
const { t } = useTranslation();
30-
const { id, name, icon, unbindFunc } = props;
36+
const { id, name, icon, source, unbindFunc } = props;
3137

3238
const { navigateToDataSourceDetail } = useNavigatePage();
39+
const { handleRebuild } = useDataSourceRebuild();
3340
const toDetail = (id: string) => {
3441
navigateToDataSourceDetail(id);
3542
};
36-
const openUnlinkModal = () => {
37-
Modal.show({
38-
visible: true,
39-
className: '!w-[560px]',
40-
title: t('dataflowParser.unlinkSourceModalTitle'),
41-
children: (
42-
<div
43-
className="text-sm text-text-secondary"
44-
dangerouslySetInnerHTML={{
45-
__html: t('dataflowParser.unlinkSourceModalContent'),
46-
}}
47-
></div>
48-
),
49-
onVisibleChange: () => {
50-
Modal.hide();
51-
},
52-
footer: (
53-
<div className="flex justify-end gap-2">
54-
<Button variant={'outline'} onClick={() => Modal.hide()}>
55-
{t('dataflowParser.changeStepModalCancelText')}
56-
</Button>
57-
<Button
58-
variant={'secondary'}
59-
className="!bg-state-error text-bg-base"
60-
onClick={() => {
61-
unbindFunc?.(props);
62-
Modal.hide();
63-
}}
64-
>
65-
{t('dataflowParser.unlinkSourceModalConfirmText')}
66-
</Button>
67-
</div>
68-
),
69-
});
70-
};
7143

7244
return (
73-
<div className="flex items-center justify-between gap-1 px-2 rounded-md border ">
45+
<div className="flex items-center justify-between gap-1 px-2 h-10 rounded-md border group hover:bg-bg-card">
7446
<div className="flex items-center gap-1">
7547
<div className="w-6 h-6 flex-shrink-0">{icon}</div>
48+
<div className="text-base text-text-primary">
49+
{DataSourceInfo[source].name}
50+
</div>
7651
<div>{name}</div>
7752
</div>
78-
<div className="flex gap-1 items-center">
53+
<div className="flex items-center">
54+
<Tooltip>
55+
<TooltipTrigger>
56+
<Button
57+
variant={'transparent'}
58+
className="border-none hidden group-hover:block"
59+
type="button"
60+
onClick={() => {
61+
handleRebuild({ source_id: id });
62+
}}
63+
>
64+
{/* <Settings /> */}
65+
<IconFontFill name="reparse" className="text-text-primary" />
66+
</Button>
67+
</TooltipTrigger>
68+
<TooltipContent>
69+
{t('knowledgeConfiguration.rebuildTip')}
70+
</TooltipContent>
71+
</Tooltip>
7972
<Button
8073
variant={'transparent'}
81-
className="border-none"
74+
className="border-none hidden group-hover:block"
8275
type="button"
8376
onClick={() => {
8477
toDetail(id);
@@ -93,7 +86,7 @@ const DataSourceItem = (props: DataSourceItemProps) => {
9386
<Button
9487
type="button"
9588
variant={'transparent'}
96-
className="border-none"
89+
className="border-none hidden group-hover:block"
9790
onClick={() => {
9891
// openUnlinkModal();
9992
delSourceModal({
@@ -151,9 +144,12 @@ const LinkDataSource = (props: ILinkDataSourceProps) => {
151144
return (
152145
<div className="flex flex-col gap-2">
153146
<section className="flex flex-col">
154-
<div className="flex items-center gap-1 text-text-primary text-sm">
147+
<div className="text-base font-medium text-text-primary">
155148
{t('knowledgeConfiguration.dataSource')}
156149
</div>
150+
{/* <div className="flex items-center gap-1 text-text-primary text-sm">
151+
{t('knowledgeConfiguration.dataSource')}
152+
</div> */}
157153
<div className="flex justify-between items-center">
158154
<div className="text-center text-xs text-text-secondary">
159155
{t('knowledgeConfiguration.linkSourceSetTip')}

web/src/pages/dataset/dataset-setting/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,14 @@ export default function DatasetSettings() {
219219
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-6 ">
220220
<div className="w-[768px] h-[calc(100vh-240px)] pr-1 overflow-y-auto scrollbar-auto">
221221
<MainContainer className="text-text-secondary">
222+
<div className="text-base font-medium text-text-primary">
223+
{t('knowledgeConfiguration.baseInfo')}
224+
</div>
222225
<GeneralForm></GeneralForm>
223226
<Divider />
224-
227+
<div className="text-base font-medium text-text-primary">
228+
{t('knowledgeConfiguration.gobalIndex')}
229+
</div>
225230
<GraphRagItems
226231
className="border-none p-0"
227232
data={graphRagGenerateData as IGenerateLogButtonProps}
@@ -235,6 +240,9 @@ export default function DatasetSettings() {
235240
onDelete={() => handleDeletePipelineTask(GenerateType.Raptor)}
236241
></RaptorFormFields>
237242
<Divider />
243+
<div className="text-base font-medium text-text-primary">
244+
{t('knowledgeConfiguration.dataPipeline')}
245+
</div>
238246
<ParseTypeItem line={1} />
239247
{parseType === 1 && (
240248
<ChunkMethodItem line={1}></ChunkMethodItem>

web/src/pages/user-setting/data-source/data-source-detail-page/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const SourceDetailPage = () => {
6666
render: (fieldProps: FormFieldConfig) => (
6767
<div className="flex items-center gap-1 w-full relative">
6868
<Input {...fieldProps} type={FormFieldType.Number} />
69-
<span className="absolute right-0 -translate-x-12 text-text-secondary italic ">
69+
<span className="absolute right-0 -translate-x-[58px] text-text-secondary italic ">
7070
minutes
7171
</span>
7272
<button
@@ -96,7 +96,7 @@ const SourceDetailPage = () => {
9696
return (
9797
<div className="flex items-center gap-1 w-full relative">
9898
<Input {...fieldProps} type={FormFieldType.Number} />
99-
<span className="absolute right-0 -translate-x-3 text-text-secondary italic ">
99+
<span className="absolute right-0 -translate-x-6 text-text-secondary italic ">
100100
hours
101101
</span>
102102
</div>
@@ -111,7 +111,7 @@ const SourceDetailPage = () => {
111111
render: (fieldProps: FormFieldConfig) => (
112112
<div className="flex items-center gap-1 w-full relative">
113113
<Input {...fieldProps} type={FormFieldType.Number} />
114-
<span className="absolute right-0 -translate-x-3 text-text-secondary italic ">
114+
<span className="absolute right-0 -translate-x-6 text-text-secondary italic ">
115115
seconds
116116
</span>
117117
</div>
@@ -183,7 +183,7 @@ const SourceDetailPage = () => {
183183
</div>
184184
<section className="flex flex-col gap-2 mt-6">
185185
<div className="text-2xl text-text-primary">{t('setting.log')}</div>
186-
<DataSourceLogsTable />
186+
<DataSourceLogsTable refresh_freq={detail?.refresh_freq || false} />
187187
</section>
188188
</CardContent>
189189
</Card>

web/src/pages/user-setting/data-source/data-source-detail-page/log-table.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,14 @@ const columns = ({
130130
// pageSize: 10,
131131
// total: 0,
132132
// };
133-
export const DataSourceLogsTable = () => {
133+
export const DataSourceLogsTable = ({
134+
refresh_freq,
135+
}: {
136+
refresh_freq: number | false;
137+
}) => {
134138
// const [pagination, setPagination] = useState(paginationInit);
135-
const { data, pagination, setPagination } = useLogListDataSource();
139+
const { data, pagination, setPagination } =
140+
useLogListDataSource(refresh_freq);
136141
const navigate = useNavigate();
137142
const currentPagination = useMemo(
138143
() => ({

0 commit comments

Comments
 (0)