mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-25 17:22:55 +00:00
parent
f19e78b692
commit
3afdab8acf
|
|
@ -437,6 +437,9 @@ class ParagraphSerializers(ApiMixin, serializers.Serializer):
|
|||
ParagraphSerializers.Create.or_get(exists_problem_list, problem.get('content'), dataset_id) for
|
||||
problem in (
|
||||
instance.get('problem_list') if 'problem_list' in instance else [])]
|
||||
# 问题去重
|
||||
problem_model_list = [x for i, x in enumerate(problem_model_list) if
|
||||
len([item for item in problem_model_list[:i] if item.content == x.content]) <= 0]
|
||||
|
||||
problem_paragraph_mapping_list = [
|
||||
ProblemParagraphMapping(id=uuid.uuid1(), document_id=document_id, problem_id=problem_model.id,
|
||||
|
|
|
|||
|
|
@ -149,6 +149,15 @@ function addProblemHandle(val: string) {
|
|||
problemValue.value = ''
|
||||
isAddProblem.value = false
|
||||
})
|
||||
} else {
|
||||
const problem = problemOptions.value.find((option) => option.id === val)
|
||||
const content = problem ? problem.content : val
|
||||
if (!problemList.value.some((item) => item.content === content)) {
|
||||
problemList.value.push({ content: content })
|
||||
}
|
||||
|
||||
problemValue.value = ''
|
||||
isAddProblem.value = false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue