Skip to content

Commit 1c104e9

Browse files
authored
refactor: Recommended questions with repeated prompts added. (#524)
1 parent b252619 commit 1c104e9

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

frontend/src/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@
190190
"chart_selected": "Selected {0}"
191191
},
192192
"qa": {
193+
"recommended_repetitive_tips": "Duplicate questions exist",
193194
"retrieve_error": "Model recommendation failed...",
194195
"retrieve_again": "Retrieve Again",
195196
"recently": "recently",

frontend/src/i18n/ko-KR.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@
190190
"chart_selected": "{0}개 선택됨"
191191
},
192192
"qa": {
193+
"recommended_repetitive_tips": "중복된 문제가 존재합니다",
193194
"retrieve_error": "모델 추천 문제 실패...",
194195
"retrieve_again": "다시 가져오기",
195196
"recently": "최근",

frontend/src/i18n/zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@
320320
}
321321
},
322322
"datasource": {
323+
"recommended_repetitive_tips": "存在重复问题",
323324
"recommended_problem_tips": "自定义配置至少一个问题,每个问题2-200个字符",
324325
"recommended_problem_configuration": "推荐问题配置",
325326
"problem_generation_method": "问题生成方式",

frontend/src/views/ds/RecommendedProblemConfigDialog.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,29 @@ const closeDialog = () => {
5151
const save = () => {
5252
if (state.recommended.recommended_config == 2) {
5353
let checkProblem = false
54+
let repetitiveQuestion = false
5455
if (state.recommended.recommendedProblemList.length === 0) {
5556
checkProblem = true
5657
}
58+
const questions = new Set<string>()
5759
state.recommended.recommendedProblemList.forEach((problem: RecommendedProblem): void => {
5860
if (problem.question.length > 200 || problem.question.length < 2) {
5961
checkProblem = true
6062
}
63+
if (questions.has(problem.question)) {
64+
repetitiveQuestion = true
65+
}
66+
questions.add(problem.question)
6167
})
6268
if (checkProblem) {
6369
ElMessage.error(t('datasource.recommended_problem_tips'))
6470
return
6571
}
72+
73+
if (repetitiveQuestion) {
74+
ElMessage.error(t('datasource.recommended_repetitive_tips'))
75+
return
76+
}
6677
}
6778
recommendedApi
6879
.save_recommended_problem({

0 commit comments

Comments
 (0)