Skip to content

Commit

Permalink
fix(frontend): show is_pre_annotated in samples (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
gary-Shen authored Jan 8, 2025
1 parent 6657764 commit 94a9d10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
2 changes: 2 additions & 0 deletions apps/frontend/src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ export interface SampleResponse {
/** Id description: annotation id */
id?: number;
inner_id: number;
is_pre_annotated: boolean;

/** State description: sample file state, NEW is has not start yet, DONE is completed, SKIPPED is skipped */
state?: SampleState;
/** Data description: sample data, include filename, file url, or result */
Expand Down
22 changes: 6 additions & 16 deletions apps/frontend/src/pages/tasks.[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ const Samples = () => {
}),
);

const sampleNamesWithPreAnnotation = useMemo(() => {
return _.chain(preAnnotations).map('sample_names').flatten().value();
}, [preAnnotations]);

const taskStatus = _.get(task, 'status');
const isTaskReadyToAnnotate =
![TaskStatus.DRAFT, TaskStatus.IMPORTED].includes(taskStatus!) &&
Expand Down Expand Up @@ -145,23 +141,17 @@ const Samples = () => {
</Tooltip>
</>
),
dataIndex: 'unknown',
key: 'unknown',
dataIndex: 'is_pre_annotated',
key: 'is_pre_annotated',
align: 'left',
render: (text, record) => {
render: (value: boolean, record) => {
const sampleNames = _.get(record, 'sample_names');

if (sampleNames) {
return '-';
return '';
}

const sampleName = (record as SampleResponse).file?.filename;
// sample_name前8为是截取的uuid,截取第9位到最后一位(如果预标注是非labelu生成的,jsonl中的sample name可能不带前缀)
const realSampleName = record.file?.filename?.substring(9);

return sampleNamesWithPreAnnotation.includes(realSampleName) ||
sampleNamesWithPreAnnotation.includes(sampleName)
? t('yes')
: '';
return value ? t('yes') : '';
},
},
{
Expand Down

0 comments on commit 94a9d10

Please sign in to comment.