From d5f867c76ca84733be2c429644db3cb4e81f38e1 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Thu, 27 Feb 2025 15:53:16 +0800 Subject: [PATCH 1/7] refactor: Password input constractor --- .../dynamics-form/constructor/data.ts | 4 + .../items/PasswordInputConstructor.vue | 194 ++++++++++++++++++ .../items/TextInputConstructor.vue | 18 +- ui/src/locales/lang/en-US/dynamics-form.ts | 4 +- ui/src/locales/lang/zh-CN/dynamics-form.ts | 4 +- ui/src/locales/lang/zh-Hant/dynamics-form.ts | 4 +- .../component/UserFieldFormDialog.vue | 1 + .../component/UserInputFieldTable.vue | 6 + 8 files changed, 214 insertions(+), 21 deletions(-) create mode 100644 ui/src/components/dynamics-form/constructor/items/PasswordInputConstructor.vue diff --git a/ui/src/components/dynamics-form/constructor/data.ts b/ui/src/components/dynamics-form/constructor/data.ts index 273a1c687..98ee4b0f6 100644 --- a/ui/src/components/dynamics-form/constructor/data.ts +++ b/ui/src/components/dynamics-form/constructor/data.ts @@ -4,6 +4,10 @@ const input_type_list = [ label: t('dynamicsForm.input_type_list.TextInput'), value: 'TextInput' }, + { + label: t('dynamicsForm.input_type_list.PasswordInput'), + value: 'PasswordInput' + }, { label: t('dynamicsForm.input_type_list.Slider'), value: 'Slider' diff --git a/ui/src/components/dynamics-form/constructor/items/PasswordInputConstructor.vue b/ui/src/components/dynamics-form/constructor/items/PasswordInputConstructor.vue new file mode 100644 index 000000000..dd447966e --- /dev/null +++ b/ui/src/components/dynamics-form/constructor/items/PasswordInputConstructor.vue @@ -0,0 +1,194 @@ + + + diff --git a/ui/src/components/dynamics-form/constructor/items/TextInputConstructor.vue b/ui/src/components/dynamics-form/constructor/items/TextInputConstructor.vue index ccac26de6..7d9715377 100644 --- a/ui/src/components/dynamics-form/constructor/items/TextInputConstructor.vue +++ b/ui/src/components/dynamics-form/constructor/items/TextInputConstructor.vue @@ -1,11 +1,4 @@ @@ -111,9 +103,7 @@ const getData = () => { attrs: { maxlength: formValue.value.maxlength, minlength: formValue.value.minlength, - 'show-word-limit': true, - type: formValue.value.show_password ? 'password' : 'text', - 'show-password': formValue.value.show_password + 'show-word-limit': true }, default_value: formValue.value.default_value, show_default_value: formValue.value.show_default_value, @@ -145,7 +135,6 @@ const rander = (form_data: any) => { formValue.value.maxlength = attrs.maxlength formValue.value.default_value = form_data.default_value formValue.value.show_default_value = form_data.show_default_value - formValue.value.show_password = attrs['show-password'] } const rangeRules = [ { @@ -176,8 +165,7 @@ onMounted(() => { formValue.value.minlength = 0 formValue.value.maxlength = 20 formValue.value.default_value = '' - formValue.value.show_password = false - + // console.log(formValue.value.show_default_value) if (formValue.value.show_default_value === undefined) { formValue.value.show_default_value = true } diff --git a/ui/src/locales/lang/en-US/dynamics-form.ts b/ui/src/locales/lang/en-US/dynamics-form.ts index 9e1c4c24d..2cfcd8058 100644 --- a/ui/src/locales/lang/en-US/dynamics-form.ts +++ b/ui/src/locales/lang/en-US/dynamics-form.ts @@ -1,6 +1,7 @@ export default { input_type_list: { TextInput: 'Input', + PasswordInput: 'Password', Slider: 'Slider', SwitchInput: 'Switch', SingleSelect: 'Single Select', @@ -96,7 +97,6 @@ export default { requiredMessage2: 'and', requiredMessage3: 'characters', requiredMessage4: 'Text length is a required parameter' - }, - showPassword: 'Show Password' + } } } diff --git a/ui/src/locales/lang/zh-CN/dynamics-form.ts b/ui/src/locales/lang/zh-CN/dynamics-form.ts index 31b0180df..9814c06eb 100644 --- a/ui/src/locales/lang/zh-CN/dynamics-form.ts +++ b/ui/src/locales/lang/zh-CN/dynamics-form.ts @@ -1,6 +1,7 @@ export default { input_type_list: { TextInput: '文本框', + PasswordInput: '密码框', Slider: '滑块', SwitchInput: '开关', SingleSelect: '单选框', @@ -96,7 +97,6 @@ export default { requiredMessage2: '到', requiredMessage3: '个字符', requiredMessage4: '文本长度为必填参数' - }, - showPassword: '密文显示' + } } } diff --git a/ui/src/locales/lang/zh-Hant/dynamics-form.ts b/ui/src/locales/lang/zh-Hant/dynamics-form.ts index 750cd4296..e75c2393d 100644 --- a/ui/src/locales/lang/zh-Hant/dynamics-form.ts +++ b/ui/src/locales/lang/zh-Hant/dynamics-form.ts @@ -1,6 +1,7 @@ export default { input_type_list: { TextInput: '文字框', + PasswordInput: '密文框', Slider: '滑桿', SwitchInput: '開關', SingleSelect: '單選框', @@ -96,7 +97,6 @@ export default { requiredMessage2: '到', requiredMessage3: '個字元', requiredMessage4: '文字長度為必填參數' - }, - showPassword: '密文顯示' + } } } diff --git a/ui/src/workflow/nodes/base-node/component/UserFieldFormDialog.vue b/ui/src/workflow/nodes/base-node/component/UserFieldFormDialog.vue index 52cf48f59..6b9eaadd8 100644 --- a/ui/src/workflow/nodes/base-node/component/UserFieldFormDialog.vue +++ b/ui/src/workflow/nodes/base-node/component/UserFieldFormDialog.vue @@ -123,6 +123,7 @@ const currentRow = computed(() => { const currentIndex = ref(null) const inputTypeList = ref([ { label: t('dynamicsForm.input_type_list.TextInput'), value: 'TextInputConstructor' }, + { label: t('dynamicsForm.input_type_list.PasswordInput'), value: 'PasswordInputConstructor' }, { label: t('dynamicsForm.input_type_list.SingleSelect'), value: 'SingleSelectConstructor' }, { label: t('dynamicsForm.input_type_list.MultiSelect'), value: 'MultiSelectConstructor' }, { label: t('dynamicsForm.input_type_list.RadioCard'), value: 'RadioCardConstructor' }, diff --git a/ui/src/workflow/nodes/base-node/component/UserInputFieldTable.vue b/ui/src/workflow/nodes/base-node/component/UserInputFieldTable.vue index 26d0c9c99..f0eaa0daf 100644 --- a/ui/src/workflow/nodes/base-node/component/UserInputFieldTable.vue +++ b/ui/src/workflow/nodes/base-node/component/UserInputFieldTable.vue @@ -49,6 +49,9 @@ {{ $t('dynamicsForm.input_type_list.TextInput') }} + {{ + $t('dynamicsForm.input_type_list.PasswordInput') + }} {{ $t('dynamicsForm.input_type_list.Slider') }} @@ -169,6 +172,9 @@ function refreshFieldTitle(data: any) { } const getDefaultValue = (row: any) => { + if(row.input_type === 'PasswordInput') { + return '******' + } if (row.default_value) { const default_value = row.option_list ?.filter((v: any) => row.default_value.indexOf(v.value) > -1) From 54ebfc30f2c66570b0566e9e78d1fd230967d23f Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Thu, 27 Feb 2025 16:19:03 +0800 Subject: [PATCH 2/7] fix: Modify generate question page translation and bugs --- .../ai-chat/component/user-form/index.vue | 2 ++ ui/src/components/generate-related-dialog/index.vue | 9 ++++----- ui/src/locales/lang/en-US/components.ts | 7 ++++++- ui/src/locales/lang/en-US/views/document.ts | 13 +++---------- ui/src/locales/lang/en-US/views/problem.ts | 1 - ui/src/locales/lang/zh-CN/components.ts | 5 +++++ ui/src/locales/lang/zh-CN/views/document.ts | 6 ------ ui/src/locales/lang/zh-CN/views/problem.ts | 1 - ui/src/locales/lang/zh-Hant/components.ts | 5 +++++ ui/src/locales/lang/zh-Hant/views/document.ts | 6 ------ ui/src/locales/lang/zh-Hant/views/problem.ts | 1 - .../document/component/EmbeddingContentDialog.vue | 6 +++--- .../views/problem/component/RelateProblemDialog.vue | 2 +- .../base-node/component/UserInputTitleDialog.vue | 11 +++++------ 14 files changed, 34 insertions(+), 41 deletions(-) diff --git a/ui/src/components/ai-chat/component/user-form/index.vue b/ui/src/components/ai-chat/component/user-form/index.vue index 980ad8663..39759a831 100644 --- a/ui/src/components/ai-chat/component/user-form/index.vue +++ b/ui/src/components/ai-chat/component/user-form/index.vue @@ -16,7 +16,9 @@ + {{ inputFieldConfig.title }} + diff --git a/ui/src/components/generate-related-dialog/index.vue b/ui/src/components/generate-related-dialog/index.vue index 4d485eae0..373152361 100644 --- a/ui/src/components/generate-related-dialog/index.vue +++ b/ui/src/components/generate-related-dialog/index.vue @@ -48,13 +48,13 @@ type="textarea" /> - + - {{ - $t('views.document.form.selectVectorization.error') + {{ + $t('components.selectParagraph.error') }} {{ - $t('views.document.form.selectVectorization.all') + $t('components.selectParagraph.all') }} @@ -148,7 +148,6 @@ const submitHandle = async (formEl: FormInstance) => { const data = { ...form.value, paragraph_id_list: idList.value, - state_list: stateMap[state.value] } paragraphApi.batchGenerateRelated(id, documentId, data, loading).then(() => { MsgSuccess(t('views.document.generateQuestion.successMessage')) diff --git a/ui/src/locales/lang/en-US/components.ts b/ui/src/locales/lang/en-US/components.ts index ce54bd265..fd63f8345 100644 --- a/ui/src/locales/lang/en-US/components.ts +++ b/ui/src/locales/lang/en-US/components.ts @@ -3,5 +3,10 @@ export default { quickCreateName: 'document name', noData: 'No Data', loading: 'Loading', - noMore: 'No more!' + noMore: 'No more! ', + selectParagraph: { + title: 'Select Paragraph', + error: 'Process only the failed segments', + all: 'All Segments' + } } diff --git a/ui/src/locales/lang/en-US/views/document.ts b/ui/src/locales/lang/en-US/views/document.ts index 14867b162..8eefd00fa 100644 --- a/ui/src/locales/lang/en-US/views/document.ts +++ b/ui/src/locales/lang/en-US/views/document.ts @@ -12,7 +12,7 @@ export default { cancelGenerateQuestion: 'Cancel Generating Questions', cancelVectorization: 'Cancel Vectorization', cancelGenerate: 'Cancel Generation', - export: 'Export to', + export: 'Export to' }, tip: { saveMessage: 'Current changes have not been saved. Confirm exit?', @@ -84,8 +84,7 @@ export default { text: 'Remove duplicate extra symbols, spaces, blank lines, and tab words.' }, checkedConnect: { - label: - 'Add "Related Questions" section for question-based QA pairs during import.' + label: 'Add "Related Questions" section for question-based QA pairs during import.' } }, buttons: { @@ -153,11 +152,6 @@ export default { label: 'Similarity Higher Than', placeholder: 'Directly return segment content', requiredMessage: 'Please enter similarity value' - }, - selectVectorization: { - label: 'Select Vectorization Content', - error: 'Segments that failed vectorization', - all: 'All Segments' } }, hitHandlingMethod: { @@ -173,7 +167,6 @@ export default { tip4: 'The generation effect depends on the selected model and prompt. Users can adjust to achieve the best effect.', prompt1: 'Content: {data}\n \n Please summarize the above and generate 5 questions based on the summary. \nAnswer requirements: \n - Please output only questions; \n - Please place each question in', - prompt2: 'tag.', - error: 'Segments only failed', + prompt2: 'tag.' } } diff --git a/ui/src/locales/lang/en-US/views/problem.ts b/ui/src/locales/lang/en-US/views/problem.ts index f312cce6a..cd9780b59 100644 --- a/ui/src/locales/lang/en-US/views/problem.ts +++ b/ui/src/locales/lang/en-US/views/problem.ts @@ -31,7 +31,6 @@ export default { title: 'Relate to Segment', selectDocument: 'Select a Document', placeholder: 'Search document by name', - selectParagraph: 'Select Segments', selectedParagraph: 'Selected Segments', count: 'Count' } diff --git a/ui/src/locales/lang/zh-CN/components.ts b/ui/src/locales/lang/zh-CN/components.ts index 589a14337..5b871daf1 100644 --- a/ui/src/locales/lang/zh-CN/components.ts +++ b/ui/src/locales/lang/zh-CN/components.ts @@ -4,4 +4,9 @@ export default { noData: '无匹配数据', loading: '加载中', noMore: '到底啦!', + selectParagraph: { + title: '选择分段', + error: '仅执行未成功分段', + all: '全部分段' + } } diff --git a/ui/src/locales/lang/zh-CN/views/document.ts b/ui/src/locales/lang/zh-CN/views/document.ts index a5ca5a4a3..73a1ef6e9 100644 --- a/ui/src/locales/lang/zh-CN/views/document.ts +++ b/ui/src/locales/lang/zh-CN/views/document.ts @@ -150,11 +150,6 @@ export default { placeholder: '直接返回分段内容', requiredMessage: '请输入相似度' }, - selectVectorization: { - label: '选择向量化内容', - error: '向量化未成功的分段', - all: '全部分段' - } }, hitHandlingMethod: { optimization: '模型优化', @@ -169,6 +164,5 @@ export default { tip4: '生成效果依赖于所选模型和提示词,用户可自行调整至最佳效果。', prompt1: `内容:{data}\n\n请总结上面的内容,并根据内容总结生成 5 个问题。\n回答要求:\n- 请只输出问题;\n- 请将每个问题放置`, prompt2: `标签中。`, - error: '仅执行未成功的分段', } } diff --git a/ui/src/locales/lang/zh-CN/views/problem.ts b/ui/src/locales/lang/zh-CN/views/problem.ts index 53fc24c98..bb53275aa 100644 --- a/ui/src/locales/lang/zh-CN/views/problem.ts +++ b/ui/src/locales/lang/zh-CN/views/problem.ts @@ -31,7 +31,6 @@ export default { title: '关联分段', selectDocument: '选择文档', placeholder: '按 文档名称 搜索', - selectParagraph: '选择分段', selectedParagraph: '已选分段', count: '个' }, diff --git a/ui/src/locales/lang/zh-Hant/components.ts b/ui/src/locales/lang/zh-Hant/components.ts index a7c3592cf..da25a3709 100644 --- a/ui/src/locales/lang/zh-Hant/components.ts +++ b/ui/src/locales/lang/zh-Hant/components.ts @@ -4,4 +4,9 @@ export default { noData: '無匹配数据', loading: '加載中', noMore: '到底啦!', + selectParagraph: { + title: '選擇分段', + error: '僅執行未成功分段', + all: '全部分段' + } } diff --git a/ui/src/locales/lang/zh-Hant/views/document.ts b/ui/src/locales/lang/zh-Hant/views/document.ts index 087fab73b..383958afd 100644 --- a/ui/src/locales/lang/zh-Hant/views/document.ts +++ b/ui/src/locales/lang/zh-Hant/views/document.ts @@ -150,11 +150,6 @@ export default { placeholder: '直接返回分段内容', requiredMessage: '请输入相似度' }, - selectVectorization: { - label: '選擇向量化', - error: '向量化未成功的分段', - all: '全部分段' - } }, hitHandlingMethod: { optimization: '模型優化', @@ -169,6 +164,5 @@ export default { tip4: '生成效果取決於所選模型和提示詞,用戶可自行調整至最佳效果。', prompt1: `內容:{data}\n\n請總結上面的內容,並根據內容總結生成 5 個問題。\n回答要求:\n - 請只輸出問題;\n - 請將每個問題放置在`, prompt2: `標籤中。`, - error: '只執行未成功的分段', } } diff --git a/ui/src/locales/lang/zh-Hant/views/problem.ts b/ui/src/locales/lang/zh-Hant/views/problem.ts index 0fb8b30d9..12cb86020 100644 --- a/ui/src/locales/lang/zh-Hant/views/problem.ts +++ b/ui/src/locales/lang/zh-Hant/views/problem.ts @@ -31,7 +31,6 @@ export default { title: '關聯分段', selectDocument: '選擇文件', placeholder: '按 文件名稱 搜尋', - selectParagraph: '選擇分段', selectedParagraph: '已選分段', count: '個' }, diff --git a/ui/src/views/document/component/EmbeddingContentDialog.vue b/ui/src/views/document/component/EmbeddingContentDialog.vue index 4ceb05639..8d3616ec8 100644 --- a/ui/src/views/document/component/EmbeddingContentDialog.vue +++ b/ui/src/views/document/component/EmbeddingContentDialog.vue @@ -1,15 +1,15 @@