mirror of https://github.com/doccano/doccano.git
Hironsan
1 year ago
6 changed files with 26 additions and 97 deletions
Split View
Diff Options
-
24frontend/components/configAutoLabeling/ConfigCreationForm.vue
-
10frontend/components/configAutoLabeling/ConfigList.vue
-
22frontend/domain/models/autoLabeling/configRepository.ts
-
3frontend/plugins/services.ts
-
10frontend/repositories/autoLabeling/config/apiConfigRepository.ts
-
54frontend/services/application/autoLabeling/configApplicationService.ts
@ -1,22 +0,0 @@ |
|||
import { ConfigItem, ConfigItemList } from '~/domain/models/autoLabeling/config' |
|||
|
|||
export interface ConfigTestResponse { |
|||
valid: boolean |
|||
labels: object[] |
|||
} |
|||
|
|||
export interface ConfigRepository { |
|||
list(projectId: string): Promise<ConfigItemList> |
|||
|
|||
create(projectId: string, item: ConfigItem): Promise<ConfigItem> |
|||
|
|||
delete(projectId: string, itemId: number): Promise<void> |
|||
|
|||
update(projectId: string, item: ConfigItem): Promise<ConfigItem> |
|||
|
|||
testParameters(projectId: string, item: ConfigItem, text: string): Promise<ConfigTestResponse> |
|||
|
|||
testTemplate(projectId: string, response: any, item: ConfigItem): Promise<ConfigTestResponse> |
|||
|
|||
testMapping(projectId: string, item: ConfigItem, response: any): Promise<ConfigTestResponse> |
|||
} |
@ -1,54 +0,0 @@ |
|||
import { ConfigRepository } from '~/domain/models/autoLabeling/configRepository' |
|||
import { ConfigItemList, ConfigItem } from '~/domain/models/autoLabeling/config' |
|||
|
|||
export class ConfigApplicationService { |
|||
constructor(private readonly configRepository: ConfigRepository) {} |
|||
|
|||
public list(id: string): Promise<ConfigItemList> { |
|||
return this.configRepository.list(id) |
|||
} |
|||
|
|||
public save(projectId: string, item: ConfigItem): Promise<ConfigItem> { |
|||
return this.configRepository.create(projectId, item) |
|||
} |
|||
|
|||
public delete(projectId: string, itemId: number) { |
|||
return this.configRepository.delete(projectId, itemId) |
|||
} |
|||
|
|||
public testParameters(projectId: string, item: ConfigItem, text: string) { |
|||
return this.configRepository |
|||
.testParameters(projectId, item, text) |
|||
.then((value) => { |
|||
return value |
|||
}) |
|||
.catch((error) => { |
|||
const data = error.response.data |
|||
throw new Error(data) |
|||
}) |
|||
} |
|||
|
|||
public testTemplate(projectId: string, response: any, item: ConfigItem) { |
|||
return this.configRepository |
|||
.testTemplate(projectId, response, item) |
|||
.then((value) => { |
|||
return value |
|||
}) |
|||
.catch((error) => { |
|||
const data = error.response.data |
|||
throw new Error(data) |
|||
}) |
|||
} |
|||
|
|||
public testMapping(projectId: string, item: ConfigItem, response: any) { |
|||
return this.configRepository |
|||
.testMapping(projectId, item, response) |
|||
.then((value) => { |
|||
return value |
|||
}) |
|||
.catch((error) => { |
|||
const data = error.response.data |
|||
throw new Error(data) |
|||
}) |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save