11import _ from 'lodash' ;
2- import type { AnnotationsWithGlobal , MediaAnnotatorConfig , MediaSample } from '@labelu/audio-annotator-react' ;
2+ import type { AnnotationsWithGlobal , MediaSample } from '@labelu/audio-annotator-react' ;
33
44import type { ParsedResult , SampleResponse } from '@/api/types' ;
55import { MediaType } from '@/api/types' ;
66
77import { jsonParse } from './index' ;
8- import { generateDefaultValues } from './generateGlobalToolDefaultValues' ;
98
10- export function convertMediaAnnotations ( mediaType : MediaType , result : ParsedResult , config : MediaAnnotatorConfig ) {
9+ export function convertMediaAnnotations ( mediaType : MediaType , result : ParsedResult ) {
1110 // annotation
1211 const pool = [
1312 [ 'segment' , MediaType . VIDEO === mediaType ? 'videoSegmentTool' : 'audioSegmentTool' ] ,
@@ -20,11 +19,6 @@ export function convertMediaAnnotations(mediaType: MediaType, result: ParsedResu
2019 . map ( ( [ type , key ] ) => {
2120 const items = _ . get ( result , [ key , 'result' ] , [ ] ) ;
2221
23- if ( ! items . length && ( type === 'tag' || type === 'text' ) ) {
24- // 生成全局工具的默认值
25- return [ type , generateDefaultValues ( config ?. [ type ] ) ] ;
26- }
27-
2822 return [
2923 type ,
3024 _ . map ( items , ( item ) => {
@@ -39,11 +33,7 @@ export function convertMediaAnnotations(mediaType: MediaType, result: ParsedResu
3933 . value ( ) as AnnotationsWithGlobal ;
4034}
4135
42- export function convertAudioAndVideoSample (
43- sample : SampleResponse ,
44- config : MediaAnnotatorConfig ,
45- mediaType ?: MediaType ,
46- ) : MediaSample | undefined {
36+ export function convertAudioAndVideoSample ( sample : SampleResponse , mediaType ?: MediaType ) : MediaSample | undefined {
4737 if ( ! sample ) {
4838 return ;
4939 }
@@ -60,6 +50,6 @@ export function convertAudioAndVideoSample(
6050 url : [ MediaType . VIDEO , MediaType . AUDIO ] . includes ( mediaType as MediaType )
6151 ? sample . file . url . replace ( 'attachment' , 'partial' )
6252 : sample . file . url ,
63- data : convertMediaAnnotations ( mediaType ! , resultParsed , config ) ,
53+ data : convertMediaAnnotations ( mediaType ! , resultParsed ) ,
6454 } ;
6555}
0 commit comments