Browse Source

Merge pull request #903 from doccano/fix/#902

Fix 400 error on text classification
pull/904/head
Hiroki Nakayama 4 years ago
committed by GitHub
parent
commit
d5e0478104
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 14 deletions
  1. 34
      frontend/components/organisms/annotation/MultiClassClassification.vue
  2. 2
      tools/install-mssql.sh

34
frontend/components/organisms/annotation/MultiClassClassification.vue

@ -1,13 +1,12 @@
<template>
<v-combobox
:value="annotatedLabels"
v-model="annotatedLabels"
:items="labels"
item-text="text"
label="Label"
hide-selected
chips
multiple
@input="add"
>
<template v-slot:selection="{ attrs, item, select, selected }">
<v-chip
@ -53,16 +52,26 @@ export default {
},
computed: {
annotatedLabels() {
const labelIds = this.annotations.map(item => item.label)
return this.labels.filter(item => labelIds.includes(item.id))
},
labelObject() {
const obj = {}
for (const label of this.labels) {
obj[label.id] = label
annotatedLabels: {
get() {
const labelIds = this.annotations.map(item => item.label)
return this.labels.filter(item => labelIds.includes(item.id))
},
set(newValue) {
if (newValue.length > this.annotations.length) {
const label = newValue[newValue.length - 1]
if (typeof label === 'object') {
this.add(label)
} else {
newValue.pop()
}
} else {
const label = this.annotatedLabels.find(x => !newValue.some(y => y.id === x.id))
if (typeof label === 'object') {
this.remove(label.id)
}
}
}
return obj
}
},
@ -70,8 +79,7 @@ export default {
textColor(backgroundColor) {
return idealColor(backgroundColor)
},
add(labels) {
const label = labels[labels.length - 1]
add(label) {
this.addLabel(label.id)
},
remove(labelId) {

2
tools/install-mssql.sh

@ -15,7 +15,7 @@ apt-get update
apt-get install --no-install-recommends -y --allow-downgrades \
curl=7.52.1-5+deb9u10 \
gnupg=2.1.18-8~deb9u4 \
apt-transport-https=1.4.9
apt-transport-https
# install dependency to compile django-pyodbc-azure
if [[ "${mode}" = "dev" ]]; then

Loading…
Cancel
Save