feat: import Sample SQL / Terminologies

This commit is contained in:
ulleo
2025-11-19 18:18:31 +08:00
committed by ulleo
parent b81d964d1e
commit f3ffb96351
9 changed files with 20 additions and 11 deletions
@@ -150,13 +150,13 @@ async def upload_excel(trans: Trans, current_user: CurrentUser, file: UploadFile
if row.isnull().all():
continue
question = row[0].strip() if pd.notna(row[0]) and row[0].strip() else None
description = row[1].strip() if pd.notna(row[1]) and row[1].strip() else None
datasource_name = row[2].strip() if pd.notna(row[2]) and row[2].strip() else None
question = row[0].strip() if pd.notna(row[0]) and row[0].strip() else ''
description = row[1].strip() if pd.notna(row[1]) and row[1].strip() else ''
datasource_name = row[2].strip() if pd.notna(row[2]) and row[2].strip() else ''
advanced_application_name = None
advanced_application_name = ''
if oid == 1 and len(row) > 3:
advanced_application_name = row[3].strip() if pd.notna(row[3]) and row[3].strip() else None
advanced_application_name = row[3].strip() if pd.notna(row[3]) and row[3].strip() else ''
if oid == 1:
import_data.append(
+2 -2
View File
@@ -146,10 +146,10 @@ async def upload_excel(trans: Trans, current_user: CurrentUser, file: UploadFile
if row.isnull().all():
continue
word = row[0].strip() if pd.notna(row[0]) and row[0].strip() else None
word = row[0].strip() if pd.notna(row[0]) and row[0].strip() else ''
other_words = [w.strip() for w in row[1].strip().split(',')] if pd.notna(row[1]) and row[
1].strip() else []
description = row[2].strip() if pd.notna(row[2]) and row[2].strip() else None
description = row[2].strip() if pd.notna(row[2]) and row[2].strip() else ''
datasource_names = [d.strip() for d in row[3].strip().split(',')] if pd.notna(row[3]) and row[
3].strip() else []
all_datasource = True if pd.notna(row[4]) and row[4].lower().strip() in ['y', 'yes', 'true'] else False
+1 -1
View File
@@ -39,7 +39,7 @@ dependencies = [
"pyyaml (>=6.0.2,<7.0.0)",
"fastapi-mcp (>=0.3.4,<0.4.0)",
"tabulate>=0.9.0",
"sqlbot-xpack>=0.0.3.46,<1.0.0",
"sqlbot-xpack>=0.0.3.47,<1.0.0",
"fastapi-cache2>=0.2.2",
"sqlparse>=0.5.3",
"redis>=6.2.0",
+3
View File
@@ -25,6 +25,7 @@
"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!",
"edit_prompt_word": "Edit prompt word",
"all_236_terms": "Export all {msg} {type} prompt records?",
"export_hint": "Export all {type} prompts?",
"prompt_word_name_de": "Do you want to delete the prompt word: {msg}?"
},
"training": {
@@ -44,6 +45,7 @@
"sql_statement": "SQL Statement",
"edit_training_data": "Edit SQL Sample",
"all_236_terms": "Export all {msg} sample SQL records?",
"export_hint": "Export all sample SQL?",
"sales_this_year": "Do you want to delete the SQL Sample: {msg}?",
"upload_success": "Import Successful",
"upload_failed": "Import successful: {success} records. Failed: {fail} records. For details, see: {fail_info}"
@@ -64,6 +66,7 @@
"business_term": "Business Term",
"synonyms": "Synonyms",
"all_236_terms": "Export all {msg} terms?",
"export_hint": "Export all terms?",
"export": "Export",
"selected_2_terms": "Delete the selected {msg} terms?",
"selected_2_terms_de": "Export the selected {msg} terms?",
+3
View File
@@ -25,6 +25,7 @@
"loss_exercise_caution": "데이터베이스 삭제, 데이터 테이블 삭제 또는 테이블 구조 수정과 같은 고위험 작업 명령을 입력하면 데이터가 영구적으로 손실될 수 있으니 신중하게 작업하십시오!",
"edit_prompt_word": "프롬프트 편집",
"all_236_terms": "모든 {msg}개의 {type} 프롬프트 기록을 내보내시겠습니까?",
"export_hint": "모든 {type} 프롬프트를 내보내시겠습니까?",
"prompt_word_name_de": "프롬프트를 삭제하시겠습니까: {msg}?"
},
"training": {
@@ -44,6 +45,7 @@
"sql_statement": "SQL 문",
"edit_training_data": "예제 SQL 편집",
"all_236_terms": "모든 {msg}개의 예시 SQL 기록을 내보내시겠습니까?",
"export_hint": "모든 예시 SQL을 내보내시겠습니까?",
"sales_this_year": "예제 SQL을 삭제하시겠습니까: {msg}?",
"upload_success": "가져오기 성공",
"upload_failed": "성공: {success}건, 실패: {fail}건. 자세한 내용은 다음을 참조하세요: {fail_info}"
@@ -64,6 +66,7 @@
"business_term": "비즈니스 용어",
"synonyms": "동의어",
"all_236_terms": "전체 {msg}개 용어를 내보내시겠습니까?",
"export_hint": "모든 용어를 내보내시겠습니까?",
"export": "내보내기",
"selected_2_terms": "선택된 {msg}개 용어를 삭제하시겠습니까?",
"selected_2_terms_de": "선택된 {msg}개 용어를 내보내시겠습니까?",
+3
View File
@@ -25,6 +25,7 @@
"loss_exercise_caution": "若输入删除数据库、数据表或修改表结构等高风险的操作指令,可能导致数据永久丢失,请务必谨慎!",
"edit_prompt_word": "编辑提示词",
"all_236_terms": "是否导出全部 {msg} 条{type}提示词?",
"export_hint": "是否导出全部{type}提示词?",
"prompt_word_name_de": "是否删除提示词:{msg}?"
},
"training": {
@@ -44,6 +45,7 @@
"sql_statement": "SQL 语句",
"edit_training_data": "编辑示例 SQL",
"all_236_terms": "是否导出全部 {msg} 条示例 SQL?",
"export_hint": "是否导出全部示例 SQL?",
"sales_this_year": "是否删除示例 SQL:{msg}?",
"upload_success": "导入成功",
"upload_failed": "导入成功 {success} 条,失败 {fail} 条,失败信息详见:{fail_info}"
@@ -64,6 +66,7 @@
"business_term": "业务术语",
"synonyms": "同义词",
"all_236_terms": "是否导出全部 {msg} 条术语?",
"export_hint": "是否导出全部术语?",
"export": "导出",
"selected_2_terms": "是否删除选中的 {msg} 条术语?",
"selected_2_terms_de": "是否导出选中的 {msg} 条术语?",
@@ -158,7 +158,7 @@ const onError = () => {
}
const exportExcel = () => {
ElMessageBox.confirm(t('professional.all_236_terms', { msg: pageInfo.total }), {
ElMessageBox.confirm(t('professional.export_hint', { msg: pageInfo.total }), {
confirmButtonType: 'primary',
confirmButtonText: t('professional.export'),
cancelButtonText: t('common.cancel'),
+1 -1
View File
@@ -183,7 +183,7 @@ const exportExcel = () => {
if (currentType.value === 'PREDICT_DATA') {
title = t('prompt.data_prediction')
}
ElMessageBox.confirm(t('prompt.all_236_terms', { msg: pageInfo.total, type: title }), {
ElMessageBox.confirm(t('prompt.export_hint', { msg: pageInfo.total, type: title }), {
confirmButtonType: 'primary',
confirmButtonText: t('professional.export'),
cancelButtonText: t('common.cancel'),
+1 -1
View File
@@ -178,7 +178,7 @@ const onError = () => {
}
const exportExcel = () => {
ElMessageBox.confirm(t('training.all_236_terms', { msg: pageInfo.total }), {
ElMessageBox.confirm(t('training.export_hint', { msg: pageInfo.total }), {
confirmButtonType: 'primary',
confirmButtonText: t('professional.export'),
cancelButtonText: t('common.cancel'),