Skip to content

fix: Optimize copywriting and style #2718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ui/src/locales/lang/en-US/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ export default {
editSuccess: 'Successful',
modify: 'Modify',
modifySuccess: 'Successful',
add: 'Add',
addSuccess: 'Successful',
cancel: 'Cancel',
confirm: 'OK',
tip: 'Tips',
add: 'Add',
refresh: 'Refresh',
search: 'Search',
clear: 'Clear',
Expand Down
7 changes: 4 additions & 3 deletions ui/src/locales/lang/zh-CN/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ export default {
editSuccess: '编辑成功',
modify: '修改',
modifySuccess: '修改成功',
add: '添加',
addSuccess: '添加成功',
cancel: '取消',
confirm: '确定',
tip: '提示',
add: '添加',
refresh: '刷新',
search: '搜索',
clear: '清空',
Expand Down Expand Up @@ -57,7 +58,7 @@ export default {
param: {
outputParam: '输出参数',
inputParam: '输入参数',
initParam: '启动参数',
initParam: '启动参数'
},
rename:'重命名'
rename: '重命名'
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes you've made look generally accurate but there might be some subtle issues to consider:

  1. Duplicate add and modifySuccess: In the original code, both "add" and "modifySuccess" were identical. This can cause confusion in certain contexts. You could remove one of them.

  2. Consistency with Naming Conventions: Ensure that all keys consistently have consistent naming styles. While this doesn't affect function, it's good practice for consistency across your translation files.

  3. Correct Key Order: The order of properties is not strictly necessary for functionality, but maintaining a logical sequence can make the file easier to read and manage.

Here’s an optimized version of your code:

export default {
  editSuccess: '编辑成功',
  modify: '修改',
  modifySuccess: '修改成功',
+  add: '添加',
+  addSuccess: '添加成功',
  cancel: '取消',
  confirm: '确定',
  tip: '提示',
- // Removed duplicate add
  refresh: '刷新',
  search: '搜索',
  clear: '清空',
  
  param: {
    outputParam: '输出参数',
    inputParam: '输入参数',
-   initParam: '启动参数',  // Corrected spelling error here
+   initParam: '启动参数' 
  },
-  rename: '重命名'
+  rename: '重命名'
}

These adjustments ensure clarity and maintainability of the translations.

5 changes: 3 additions & 2 deletions ui/src/locales/lang/zh-Hant/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ export default {
editSuccess: '編輯成功',
modify: '修改',
modifySuccess: '修改成功',
add: '添加',
addSuccess: '添加成功',
cancel: '取消',
confirm: '確認',
tip: '提示',
add: '新增',
refresh: '重新整理',
search: '搜尋',
clear: '清除',
Expand Down Expand Up @@ -57,7 +58,7 @@ export default {
param: {
outputParam: '輸出參數',
inputParam: '輸入參數',
initParam: '啟動參數',
initParam: '啟動參數'
},
rename: '重命名'
}
145 changes: 73 additions & 72 deletions ui/src/views/dataset/ImportDocumentDataset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,80 +5,81 @@
</template>
<div class="create-dataset__main flex" v-loading="loading">
<div class="create-dataset__component main-calc-height">
<el-scrollbar>
<div class="upload-document p-24">
<h4 class="title-decoration-1 mb-8">
{{ $t('views.document.feishu.selectDocument') }}
</h4>
<el-form
ref="FormRef"
:model="form"
:rules="rules"
label-position="top"
require-asterisk-position="right"
>
<div class="mt-16 mb-16">
<el-radio-group v-model="form.fileType" class="app-radio-button-group">
<el-radio-button value="txt"
>{{ $t('views.document.fileType.txt.label') }}
</el-radio-button>
</el-radio-group>
<div class="upload-document p-24">
<h4 class="title-decoration-1 mb-8">
{{ $t('views.document.feishu.selectDocument') }}
</h4>
<el-form
ref="FormRef"
:model="form"
:rules="rules"
label-position="top"
require-asterisk-position="right"
>
<div class="mt-16 mb-16">
<el-radio-group v-model="form.fileType" class="app-radio-button-group">
<el-radio-button value="txt"
>{{ $t('views.document.fileType.txt.label') }}
</el-radio-button>
</el-radio-group>
</div>
<div class="update-info flex p-8-12 border-r-4 mb-16">
<div class="mt-4">
<AppIcon iconName="app-warning-colorful" style="font-size: 16px"></AppIcon>
</div>
<div class="update-info flex p-8-12 border-r-4 mb-16">
<div class="mt-4">
<AppIcon iconName="app-warning-colorful" style="font-size: 16px"></AppIcon>
</div>
<div class="ml-16 lighter">
<p>{{ $t('views.document.feishu.tip1') }}</p>
<p>{{ $t('views.document.feishu.tip2') }}</p>
</div>
<div class="ml-16 lighter">
<p>{{ $t('views.document.feishu.tip1') }}</p>
<p>{{ $t('views.document.feishu.tip2') }}</p>
</div>
<div class="card-never border-r-4 mb-16">
<el-checkbox
v-model="allCheck"
:label="$t('views.document.feishu.allCheck')"
size="large"
class="ml-24"
@change="handleAllCheckChange"
/>
</div>

<el-tree
:props="props"
:load="loadNode"
lazy
show-checkbox
node-key="token"
ref="treeRef"
>
<template #default="{ node, data }">
<div class="custom-tree-node flex align-center lighter">
<img
src="@/assets/fileType/file-icon.svg"
alt=""
height="20"
v-if="data.type === 'folder'"
/>
<img
src="@/assets/fileType/docx-icon.svg"
alt=""
height="22"
v-else-if="data.type === 'docx'"
/>
<img
src="@/assets/fileType/xlsx-icon.svg"
alt=""
height="22"
v-else-if="data.type === 'sheet'"
/>

<span class="ml-4">{{ node.label }}</span>
</div>
</template>
</el-tree>
</el-form>
</div>
</el-scrollbar>
</div>
<div class="card-never border-r-4 mb-16">
<el-checkbox
v-model="allCheck"
:label="$t('views.document.feishu.allCheck')"
size="large"
class="ml-24"
@change="handleAllCheckChange"
/>
</div>
<div style="height:calc(100vh - 430px)">
<el-scrollbar>
<el-tree
:props="props"
:load="loadNode"
lazy
show-checkbox
node-key="token"
ref="treeRef"
>
<template #default="{ node, data }">
<div class="custom-tree-node flex align-center lighter">
<img
src="@/assets/fileType/file-icon.svg"
alt=""
height="20"
v-if="data.type === 'folder'"
/>
<img
src="@/assets/fileType/docx-icon.svg"
alt=""
height="22"
v-else-if="data.type === 'docx'"
/>
<img
src="@/assets/fileType/xlsx-icon.svg"
alt=""
height="22"
v-else-if="data.type === 'sheet'"
/>

<span class="ml-4">{{ node.label }}</span>
</div>
</template>
</el-tree>
</el-scrollbar>
</div>
</el-form>
</div>
</div>
</div>
<div class="create-dataset__footer text-right border-t">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code snippet you provided is missing some closing tags and formatting. Here are a few suggestions to address these issues:

  1. Missing Closing Tags:

    • Add </div> at the end of the .create-dataset__component div.
    • Ensure all other open tags have matching close tags.
  2. Incorrect CSS Syntax:

    • In the style="height:calc(100vh - 430px)" line, it should be consistent with standard JavaScript syntax without using backticks ( ) which suggests an interpolation issue in Vue.js components.

Here's the corrected version:

<template>
  <!-- ... previous code -->
</template>

<script lang="ts">
import { defineComponent } from 'vue';

export default defineComponent({
  // component setup logic here
});
</script>

<style scoped>
/* add styles here */
.create-dataset__footer {
  /* existing styles */
}
</style>

Ensure that any custom Vue.js directives or functions used inside the script section work as expected as well. If there are more specific rules or requirements related to Vue.js template syntax or functionality changes since October 2021, let me know!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<span class="dialog-footer">
<el-button @click.prevent="dialogVisible = false"> {{ $t('common.cancel') }} </el-button>
<el-button type="primary" @click="submit(fieldFormRef)" :loading="loading">
{{ isEdit ? $t('common.save') : $t('common.add') }}
{{ $t('common.add') }}
</el-button>
</span>
</template>
Expand All @@ -34,14 +34,11 @@ import { reactive, ref, watch } from 'vue'
import type { FormInstance } from 'element-plus'
import { cloneDeep } from 'lodash'
import { t } from '@/locales'
import functionLibApi from '@/api/function-lib'
import { MsgSuccess } from '@/utils/message'

const emit = defineEmits(['refresh'])

const fieldFormRef = ref()
const loading = ref<boolean>(false)
const isEdit = ref(false)

const form = ref<any>({
name: ''
Expand All @@ -64,14 +61,12 @@ watch(dialogVisible, (bool) => {
form.value = {
name: ''
}
isEdit.value = false
}
})

const open = (row: any) => {
if (row) {
form.value = cloneDeep(row)
isEdit.value = true
}

dialogVisible.value = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provided code contains an issue with the isEdit variable not being used within the same component where it's defined. To fix this, remove the line that references isEdit.

Here’s the corrected version of your code:

@@ -23,7 +23,7 @@
       <span class="dialog-footer">
         <el-button @click.prevent="dialogVisible = false"> {{ $t('common.cancel') }} </el-button>
         <el-button type="primary" @click="submit(fieldFormRef)" :loading="loading">
-          {{ isEdit ? $t('common.save') : $t('common.add') }}
+          {{ $t('common.add') }}
         </el-button>
       </span>
     </template>

@@ -34,15 +34,11 @@ import { reactive, ref, watch } from 'vue'
 import type { FormInstance } from 'element-plus'
 import { cloneDeep } from 'lodash'
 import { t } from '@/locales'
-import functionLibApi from '@/api/function-lib'
-import { MsgSuccess } from '@/utils/message'

 const emit = defineEmits(['refresh'])

 const fieldFormRef = ref()
 const loading = ref<boolean>(false)

const form = ref<any>({
  name: ''
})

watch(dialogVisible, (bool) => {
  form.value = {
    name: ''
  }
})

Additionally, I recommend you move the call to open(row) inside the watch listener for dialogVisible. This would ensure that when the modal pops up based on the value of isVisible, the appropriate data is loaded into the form.

Here’s how you can adjust the code:

watch(dialogVisible, (bool) => {
  if (bool && row) {
   	form.value = cloneDeep(row)
  }
  
  form.value = {
    name: ''
	// Remove the line below as it doesn't need to be here
	// isEdit.value = bool // Assuming you want to reflect visibility status here somehow
  }
})

In summary:

  1. Remove the reference to isEdit that does not align with its use in the component.
  2. Move the logic to load data upon opening the dialog into the watcher for isVisible.
  3. Consider whether there should be a different approach to handle edit versus add operations, perhaps using a single method like handleFormSubmit().

Expand Down
2 changes: 1 addition & 1 deletion ui/src/views/function-lib/component/InternalDescDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</div>

<div class="mt-16">
<el-text type="info" v-if="functionDetail?.desc">
<el-text type="info">
<div>{{ $t('common.author') }}: MaxKB</div>
</el-text>
</div>
Expand Down