Skip to content

Commit f3ffb96

Browse files
committed
feat: import Sample SQL / Terminologies
1 parent b81d964 commit f3ffb96

File tree

9 files changed

+20
-11
lines changed

9 files changed

+20
-11
lines changed

backend/apps/data_training/api/data_training.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,13 @@ def inner():
150150
if row.isnull().all():
151151
continue
152152

153-
question = row[0].strip() if pd.notna(row[0]) and row[0].strip() else None
154-
description = row[1].strip() if pd.notna(row[1]) and row[1].strip() else None
155-
datasource_name = row[2].strip() if pd.notna(row[2]) and row[2].strip() else None
153+
question = row[0].strip() if pd.notna(row[0]) and row[0].strip() else ''
154+
description = row[1].strip() if pd.notna(row[1]) and row[1].strip() else ''
155+
datasource_name = row[2].strip() if pd.notna(row[2]) and row[2].strip() else ''
156156

157-
advanced_application_name = None
157+
advanced_application_name = ''
158158
if oid == 1 and len(row) > 3:
159-
advanced_application_name = row[3].strip() if pd.notna(row[3]) and row[3].strip() else None
159+
advanced_application_name = row[3].strip() if pd.notna(row[3]) and row[3].strip() else ''
160160

161161
if oid == 1:
162162
import_data.append(

backend/apps/terminology/api/terminology.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ def inner():
146146
if row.isnull().all():
147147
continue
148148

149-
word = row[0].strip() if pd.notna(row[0]) and row[0].strip() else None
149+
word = row[0].strip() if pd.notna(row[0]) and row[0].strip() else ''
150150
other_words = [w.strip() for w in row[1].strip().split(',')] if pd.notna(row[1]) and row[
151151
1].strip() else []
152-
description = row[2].strip() if pd.notna(row[2]) and row[2].strip() else None
152+
description = row[2].strip() if pd.notna(row[2]) and row[2].strip() else ''
153153
datasource_names = [d.strip() for d in row[3].strip().split(',')] if pd.notna(row[3]) and row[
154154
3].strip() else []
155155
all_datasource = True if pd.notna(row[4]) and row[4].lower().strip() in ['y', 'yes', 'true'] else False

backend/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ dependencies = [
3939
"pyyaml (>=6.0.2,<7.0.0)",
4040
"fastapi-mcp (>=0.3.4,<0.4.0)",
4141
"tabulate>=0.9.0",
42-
"sqlbot-xpack>=0.0.3.46,<1.0.0",
42+
"sqlbot-xpack>=0.0.3.47,<1.0.0",
4343
"fastapi-cache2>=0.2.2",
4444
"sqlparse>=0.5.3",
4545
"redis>=6.2.0",

frontend/src/i18n/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"loss_exercise_caution": "Entering high-risk operations such as deleting a database or table or modifying the table structure may result in permanent data loss. Exercise caution!",
2626
"edit_prompt_word": "Edit prompt word",
2727
"all_236_terms": "Export all {msg} {type} prompt records?",
28+
"export_hint": "Export all {type} prompts?",
2829
"prompt_word_name_de": "Do you want to delete the prompt word: {msg}?"
2930
},
3031
"training": {
@@ -44,6 +45,7 @@
4445
"sql_statement": "SQL Statement",
4546
"edit_training_data": "Edit SQL Sample",
4647
"all_236_terms": "Export all {msg} sample SQL records?",
48+
"export_hint": "Export all sample SQL?",
4749
"sales_this_year": "Do you want to delete the SQL Sample: {msg}?",
4850
"upload_success": "Import Successful",
4951
"upload_failed": "Import successful: {success} records. Failed: {fail} records. For details, see: {fail_info}"
@@ -64,6 +66,7 @@
6466
"business_term": "Business Term",
6567
"synonyms": "Synonyms",
6668
"all_236_terms": "Export all {msg} terms?",
69+
"export_hint": "Export all terms?",
6770
"export": "Export",
6871
"selected_2_terms": "Delete the selected {msg} terms?",
6972
"selected_2_terms_de": "Export the selected {msg} terms?",

frontend/src/i18n/ko-KR.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"loss_exercise_caution": "데이터베이스 삭제, 데이터 테이블 삭제 또는 테이블 구조 수정과 같은 고위험 작업 명령을 입력하면 데이터가 영구적으로 손실될 수 있으니 신중하게 작업하십시오!",
2626
"edit_prompt_word": "프롬프트 편집",
2727
"all_236_terms": "모든 {msg}개의 {type} 프롬프트 기록을 내보내시겠습니까?",
28+
"export_hint": "모든 {type} 프롬프트를 내보내시겠습니까?",
2829
"prompt_word_name_de": "프롬프트를 삭제하시겠습니까: {msg}?"
2930
},
3031
"training": {
@@ -44,6 +45,7 @@
4445
"sql_statement": "SQL 문",
4546
"edit_training_data": "예제 SQL 편집",
4647
"all_236_terms": "모든 {msg}개의 예시 SQL 기록을 내보내시겠습니까?",
48+
"export_hint": "모든 예시 SQL을 내보내시겠습니까?",
4749
"sales_this_year": "예제 SQL을 삭제하시겠습니까: {msg}?",
4850
"upload_success": "가져오기 성공",
4951
"upload_failed": "성공: {success}건, 실패: {fail}건. 자세한 내용은 다음을 참조하세요: {fail_info}"
@@ -64,6 +66,7 @@
6466
"business_term": "비즈니스 용어",
6567
"synonyms": "동의어",
6668
"all_236_terms": "전체 {msg}개 용어를 내보내시겠습니까?",
69+
"export_hint": "모든 용어를 내보내시겠습니까?",
6770
"export": "내보내기",
6871
"selected_2_terms": "선택된 {msg}개 용어를 삭제하시겠습니까?",
6972
"selected_2_terms_de": "선택된 {msg}개 용어를 내보내시겠습니까?",

frontend/src/i18n/zh-CN.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"loss_exercise_caution": "若输入删除数据库、数据表或修改表结构等高风险的操作指令,可能导致数据永久丢失,请务必谨慎!",
2626
"edit_prompt_word": "编辑提示词",
2727
"all_236_terms": "是否导出全部 {msg} 条{type}提示词?",
28+
"export_hint": "是否导出全部{type}提示词?",
2829
"prompt_word_name_de": "是否删除提示词:{msg}?"
2930
},
3031
"training": {
@@ -44,6 +45,7 @@
4445
"sql_statement": "SQL 语句",
4546
"edit_training_data": "编辑示例 SQL",
4647
"all_236_terms": "是否导出全部 {msg} 条示例 SQL?",
48+
"export_hint": "是否导出全部示例 SQL?",
4749
"sales_this_year": "是否删除示例 SQL:{msg}?",
4850
"upload_success": "导入成功",
4951
"upload_failed": "导入成功 {success} 条,失败 {fail} 条,失败信息详见:{fail_info}"
@@ -64,6 +66,7 @@
6466
"business_term": "业务术语",
6567
"synonyms": "同义词",
6668
"all_236_terms": "是否导出全部 {msg} 条术语?",
69+
"export_hint": "是否导出全部术语?",
6770
"export": "导出",
6871
"selected_2_terms": "是否删除选中的 {msg} 条术语?",
6972
"selected_2_terms_de": "是否导出选中的 {msg} 条术语?",

frontend/src/views/system/professional/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ const onError = () => {
158158
}
159159
160160
const exportExcel = () => {
161-
ElMessageBox.confirm(t('professional.all_236_terms', { msg: pageInfo.total }), {
161+
ElMessageBox.confirm(t('professional.export_hint', { msg: pageInfo.total }), {
162162
confirmButtonType: 'primary',
163163
confirmButtonText: t('professional.export'),
164164
cancelButtonText: t('common.cancel'),

frontend/src/views/system/prompt/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ const exportExcel = () => {
183183
if (currentType.value === 'PREDICT_DATA') {
184184
title = t('prompt.data_prediction')
185185
}
186-
ElMessageBox.confirm(t('prompt.all_236_terms', { msg: pageInfo.total, type: title }), {
186+
ElMessageBox.confirm(t('prompt.export_hint', { msg: pageInfo.total, type: title }), {
187187
confirmButtonType: 'primary',
188188
confirmButtonText: t('professional.export'),
189189
cancelButtonText: t('common.cancel'),

frontend/src/views/system/training/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ const onError = () => {
178178
}
179179
180180
const exportExcel = () => {
181-
ElMessageBox.confirm(t('training.all_236_terms', { msg: pageInfo.total }), {
181+
ElMessageBox.confirm(t('training.export_hint', { msg: pageInfo.total }), {
182182
confirmButtonType: 'primary',
183183
confirmButtonText: t('professional.export'),
184184
cancelButtonText: t('common.cancel'),

0 commit comments

Comments
 (0)