Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adjust data-handle detail page style and fix some issue #283

Merged
merged 2 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .kiwi/en-US/DataHandle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export default {
kaiShiShiJian: 'Start Time',
wanChengShiJian: 'Completion time',
chuangJianRen: 'Creator',
chuLiHouShuJu: 'Processed Dataset',
chuLiQianShuJu: 'Dataset before Processing',
chuLiHouShuJu: 'Processed Dataset:',
chuLiQianShuJu: 'Dataset before Processing:',
qAWenBen: 'QA Text',
puTongWenBen: 'Normal ext',
wenJianLeiXing: 'File Type',
Expand Down
4 changes: 2 additions & 2 deletions .kiwi/zh-CN/DataHandle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export default {
kaiShiShiJian: '开始时间',
wanChengShiJian: '完成时间',
chuangJianRen: '创建人',
chuLiHouShuJu: '处理后数据集',
chuLiQianShuJu: '处理前数据集',
chuLiHouShuJu: '处理后数据集',
chuLiQianShuJu: '处理前数据集',
qAWenBen: 'QA文本',
puTongWenBen: '普通文本',
wenJianLeiXing: '文件类型',
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions src/pages/CreateDataHandle/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,6 @@ class $$Page extends React.Component {

this.state = {
afterTreatmentData: [
{
_type: 'qa_split',
type: 'QA拆分',
before:
' 为了保证知识库问答质量,需要对文档做 QA 拆分,QA 拆分时需要选择对应的模型服务。',
after: `Q:为什么要做 QA 拆分?<br />A:为了保证知识库问答质量。<br />Q:QA 拆分需要注意什么?<br /> A:QA 拆分时需要选择对应的模型服务。`,
},
{
_type: 'document_chunk',
type: '文本分段',
Expand All @@ -110,6 +103,13 @@ class $$Page extends React.Component {
<p>为:分段长度 40 字符,分段重叠长度 10 字符。</p>
`,
},
{
_type: 'qa_split',
type: 'QA拆分',
before:
' 为了保证知识库问答质量,需要对文档做 QA 拆分,QA 拆分时需要选择对应的模型服务。',
after: `Q:为什么要做 QA 拆分?<br />A:为了保证知识库问答质量。<br />Q:QA 拆分需要注意什么?<br /> A:QA 拆分时需要选择对应的模型服务。`,
},
{
_type: 'remove_invisible_characters',
type: '移除不可见字符',
Expand Down Expand Up @@ -181,8 +181,8 @@ class $$Page extends React.Component {
cacheqaSplitHighConfig: {},
configEnableMap: {},
configMap: {
qa_split: 'QAsplitChecked',
document_chunk: 'TextSegmentationChecked',
qa_split: 'QAsplitChecked',
remove_invisible_characters: 'RemoveInvisibleCharactersChecked',
space_standardization: 'SpaceHandleChecked',
remove_garbled_text: 'RemoveGarbledCodeChecked',
Expand Down Expand Up @@ -237,16 +237,16 @@ class $$Page extends React.Component {
},
step2FormData: {},
step3Data: {
QAsplitChecked: true,
QAsplitForm: {
type: undefined,
model: undefined,
},
TextSegmentationChecked: true,
TextSegmentationForm: {
chunk_size: 500,
chunk_overlap: 50,
},
QAsplitChecked: true,
QAsplitForm: {
type: undefined,
model: undefined,
},
RemoveInvisibleCharactersChecked: true,
SpaceHandleChecked: true,
RemoveGarbledCodeChecked: true,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/DataHandleDetail/FileStatus.less
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
margin-right: 8px;
}
.retry {
margin-left: 4px;
margin-left: 16px;
}
69 changes: 44 additions & 25 deletions src/pages/DataHandleDetail/FileStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import React, { useEffect, useState } from 'react';
import Status from '@/components/Status';
import I18N from '@/utils/kiwiI18N';

import utils from '../../utils/__utils';
import styles from './FileStatus.less';

interface Iprops {
Expand Down Expand Up @@ -62,13 +63,6 @@ const FileStatus: React.FC<Iprops> = props => {

<div>
<Status {...statuesMap[item.status]} />
{item.status === 'fail' ? (
<a className={styles.retry} onClick={props.getData}>
{I18N.DataHandle.chongShi}
</a>
) : (
''
)}
</div>
<div>
<span className={styles.time}>
Expand All @@ -83,22 +77,54 @@ const FileStatus: React.FC<Iprops> = props => {
setFileStatusCount(statusCount);
// setItems(_items);
}, [file_details]);

const onRetry = () => {
const record = props.data;
utils.bff
.dataProcessRetry({
input: {
id: record.id,
creator: utils.getAuthData()?.user?.name,
},
})
.then(res => {
utils.notification.success({
message: res.dataProcess.dataProcessRetry.message,
});
props.getData();
})
.catch(error => {
utils.notification.warn({
message: '重试失败',
});
});
};

return (
<div>
<Button className={styles.reloadBtn} onClick={props.getData}>
{I18N.DataHandle.shuaXin}
</Button>
<div
dangerouslySetInnerHTML={{
__html: I18N.template(I18N.DataHandle.fileStatusCount, {
total: fileTotal,
success: fileStatusCount.success,
not_start: fileStatusCount.not_start,
doing: fileStatusCount.doing,
fail: fileStatusCount.fail,
}),
}}
></div>
<div style={{ display: 'flex' }}>
<div
dangerouslySetInnerHTML={{
__html: I18N.template(I18N.DataHandle.fileStatusCount, {
total: fileTotal,
success: fileStatusCount.success,
not_start: fileStatusCount.not_start,
doing: fileStatusCount.doing,
fail: fileStatusCount.fail,
}),
}}
></div>
{props.data.status === 'process_fail' ? (
<a className={styles.retry} onClick={onRetry}>
{I18N.DataHandle.chongShi}
</a>
) : (
''
)}
</div>
<List
dataSource={file_details}
itemLayout="horizontal"
Expand All @@ -118,13 +144,6 @@ const FileStatus: React.FC<Iprops> = props => {
<span className={styles.title}>{item.file_name}</span>
<Divider type="vertical" />
<Status {...statuesMap[item.status]} />
{item.status === 'fail' ? (
<a className={styles.retry} onClick={props.getData}>
{I18N.DataHandle.chongShi}
</a>
) : (
''
)}
<Divider type="vertical" />
<span className={styles.time}>
<ClockCircleOutlined />
Expand Down
106 changes: 56 additions & 50 deletions src/pages/DataHandleDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,56 +85,6 @@ const DataHandleDetail = props => {
children:
detailData.file_type === 'text' ? I18N.DataHandle.puTongWenBen : I18N.DataHandle.qAWenBen,
},
{
label: I18N.DataHandle.chuLiQianShuJu,
children: (
<>
<a onClick={() => Link('/dataset/detail/' + detailData.pre_dataset_name)}>
{detailData.pre_dataset_name}
</a>
---
<a
onClick={() =>
Link(
'/dataset/detail/' +
detailData.pre_dataset_name +
'/version/' +
detailData.pre_dataset_name +
'-' +
detailData.pre_dataset_version
)
}
>
{detailData.pre_dataset_version}
</a>
</>
),
},
{
label: I18N.DataHandle.chuLiHouShuJu,
children: (
<>
<a onClick={() => Link('/dataset/detail/' + detailData.post_dataset_name)}>
{detailData.post_dataset_name}
</a>
---
<a
onClick={() =>
Link(
'/dataset/detail/' +
detailData.post_dataset_name +
'/version/' +
detailData.post_dataset_name +
'-' +
detailData.post_dataset_version
)
}
>
{detailData.post_dataset_version}
</a>
</>
),
},
{
label: I18N.DataHandle.kaiShiShiJian,
children: (
Expand Down Expand Up @@ -324,6 +274,62 @@ const DataHandleDetail = props => {
{I18N.DataHandle.haoShi}
{calcSpendTime(item)}
</span>
<Divider
style={{
borderInlineStart: '1px solid rgba(5, 5, 5, 0.15)',
marginInline: 16,
}}
type="vertical"
/>
<span>{I18N.DataHandle.chuLiQianShuJu}</span>
<>
<a onClick={() => Link('/dataset/detail/' + detailData.pre_dataset_name)}>
{detailData.pre_dataset_name}
</a>
---
<a
onClick={() =>
Link(
'/dataset/detail/' +
detailData.pre_dataset_name +
'/version/' +
detailData.pre_dataset_name +
'-' +
detailData.pre_dataset_version
)
}
>
{detailData.pre_dataset_version}
</a>
</>
<Divider
style={{
borderInlineStart: '1px solid rgba(5, 5, 5, 0.15)',
marginInline: 16,
}}
type="vertical"
/>
<span>{I18N.DataHandle.chuLiHouShuJu}</span>
<>
<a onClick={() => Link('/dataset/detail/' + detailData.pre_dataset_name)}>
{detailData.pre_dataset_name}
</a>
---
<a
onClick={() =>
Link(
'/dataset/detail/' +
detailData.pre_dataset_name +
'/version/' +
detailData.pre_dataset_name +
'-' +
detailData.pre_dataset_version
)
}
>
{detailData.pre_dataset_version}
</a>
</>
</>
}
title={<h4>{item.name || I18N.DataHandle.zheShiYiGeMing}</h4>}
Expand Down
Loading