feat: 完成关系标注接口联调
This commit is contained in:
parent
383534037a
commit
a594b620f1
|
@ -41,13 +41,14 @@ def query_anno():
|
||||||
file_content = read_file(file_path)
|
file_content = read_file(file_path)
|
||||||
|
|
||||||
anno_output_path = ANNO_OUTPUT_PATH.format(project_name, file_name)
|
anno_output_path = ANNO_OUTPUT_PATH.format(project_name, file_name)
|
||||||
anno_details = []
|
j = {}
|
||||||
if os.path.exists(anno_output_path):
|
if os.path.exists(anno_output_path):
|
||||||
anno_details = json.loads(read_file(anno_output_path))['annoDetails']
|
j = json.loads(read_file(anno_output_path))
|
||||||
|
|
||||||
query_anno = QueryAnno()
|
query_anno = QueryAnno()
|
||||||
query_anno.fileContent = file_content
|
query_anno.fileContent = file_content
|
||||||
query_anno.annoDetails = anno_details
|
query_anno.annoDetails = j.get('annoDetails', [])
|
||||||
|
query_anno.relDetails = j.get('relDetails', [])
|
||||||
ret_info.info = query_anno
|
ret_info.info = query_anno
|
||||||
|
|
||||||
ret_info.errCode = 0
|
ret_info.errCode = 0
|
||||||
|
|
|
@ -15,6 +15,7 @@ class ReturnInfo:
|
||||||
class QueryAnno:
|
class QueryAnno:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.annoDetails = []
|
self.annoDetails = []
|
||||||
|
self.relDetails = []
|
||||||
self.fileContent = ''
|
self.fileContent = ''
|
||||||
# self.isAnno = False
|
# self.isAnno = False
|
||||||
|
|
||||||
|
|
|
@ -349,8 +349,9 @@ export default {
|
||||||
const hasCache = !!that.nersCache[newFile]
|
const hasCache = !!that.nersCache[newFile]
|
||||||
that.$set(that, 'ners', that.nersCache[newFile] ? [...that.nersCache[newFile]] : [])
|
that.$set(that, 'ners', that.nersCache[newFile] ? [...that.nersCache[newFile]] : [])
|
||||||
that.flushWordsType()
|
that.flushWordsType()
|
||||||
if (that.nowText) {
|
if (that.nowText && that.projectType !== '关系标注') {
|
||||||
delete window.isLoadingNowText
|
delete window.isLoadingNowText
|
||||||
|
return
|
||||||
} else {
|
} else {
|
||||||
get(`/v1/anno/query?projectName=${that.projectName}&fileName=${newFile}`, function (info) {
|
get(`/v1/anno/query?projectName=${that.projectName}&fileName=${newFile}`, function (info) {
|
||||||
delete window.isLoadingNowText
|
delete window.isLoadingNowText
|
||||||
|
@ -364,6 +365,10 @@ export default {
|
||||||
// 更新文件的标注缓存
|
// 更新文件的标注缓存
|
||||||
that.$set(that.nersCache, newFile, info.annoDetails)
|
that.$set(that.nersCache, newFile, info.annoDetails)
|
||||||
}
|
}
|
||||||
|
if (that.projectType === '关系标注' && newFile === that.nowFile) {
|
||||||
|
console.log('relDetails', info.relDetails)
|
||||||
|
that.$set(that, 'relDetails', info.relDetails || [])
|
||||||
|
}
|
||||||
// 更新文件的文本缓存
|
// 更新文件的文本缓存
|
||||||
that.$set(that.textDic, newFile, info.fileContent)
|
that.$set(that.textDic, newFile, info.fileContent)
|
||||||
if (newFile === that.nowFile) {
|
if (newFile === that.nowFile) {
|
||||||
|
@ -577,6 +582,7 @@ export default {
|
||||||
type: this.nowType
|
type: this.nowType
|
||||||
})
|
})
|
||||||
this.$set(this, 'relStartIdx', undefined)
|
this.$set(this, 'relStartIdx', undefined)
|
||||||
|
this.save()
|
||||||
} else {
|
} else {
|
||||||
this.$set(this, 'relStartIdx', idx)
|
this.$set(this, 'relStartIdx', idx)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue