Skip to content
Merged
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
33 changes: 25 additions & 8 deletions ui/src/workflow/nodes/base-node/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
@submitDialog="submitDialog"
/>
</el-form-item>
<el-form-item >
<el-form-item>
<template #label>
<div class="flex-between">
<div class="flex align-center">
Expand All @@ -70,7 +70,11 @@
<Setting />
</el-icon>
</el-button>
<el-switch size="small" v-model="form_data.file_upload_enable" @change="switchFileUpload"/>
<el-switch
size="small"
v-model="form_data.file_upload_enable"
@change="switchFileUpload"
/>
</div>
</div>
</template>
Expand All @@ -90,14 +94,19 @@
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
</el-tooltip> -->
</div>
<el-switch size="small" v-model="form_data.stt_model_enable" @change="sttModelEnableChange"/>
<el-switch
size="small"
v-model="form_data.stt_model_enable"
@change="sttModelEnableChange"
/>
</div>
</template>

<el-select
v-show="form_data.stt_model_enable"
v-model="form_data.stt_model_id"
class="w-full"
@wheel="wheel"
popper-class="select-model"
placeholder="请选择语音识别模型"
>
Expand Down Expand Up @@ -170,7 +179,11 @@
<Setting />
</el-icon>
</el-button>
<el-switch size="small" v-model="form_data.tts_model_enable" @change="ttsModelEnableChange"/>
<el-switch
size="small"
v-model="form_data.tts_model_enable"
@change="ttsModelEnableChange"
/>
</div>
</div>
</template>
Expand All @@ -182,6 +195,7 @@
v-if="form_data.tts_type === 'TTS' && form_data.tts_model_enable"
v-model="form_data.tts_model_id"
class="w-full"
@wheel="wheel"
popper-class="select-model"
@change="ttsModelChange()"
placeholder="请选择语音合成模型"
Expand Down Expand Up @@ -241,7 +255,11 @@
</el-form-item>
</el-form>
<TTSModeParamSettingDialog ref="TTSModeParamSettingDialogRef" @refresh="refreshTTSForm" />
<FileUploadSettingDialog ref="FileUploadSettingDialogRef" :node-model="nodeModel" @refresh="refreshFileUploadForm"/>
<FileUploadSettingDialog
ref="FileUploadSettingDialogRef"
:node-model="nodeModel"
@refresh="refreshFileUploadForm"
/>
</NodeContainer>
</template>
<script setup lang="ts">
Expand Down Expand Up @@ -368,7 +386,6 @@ function sttModelEnableChange() {
}
}


const openTTSParamSettingDialog = () => {
const model_id = form_data.value.tts_model_id
if (!model_id) {
Expand All @@ -382,7 +399,6 @@ const refreshTTSForm = (data: any) => {
form_data.value.tts_model_params_setting = data
}


const switchFileUpload = () => {
const default_upload_setting = {
maxFiles: 3,
Expand All @@ -394,7 +410,8 @@ const switchFileUpload = () => {
}

if (form_data.value.file_upload_enable) {
form_data.value.file_upload_setting = form_data.value.file_upload_setting || default_upload_setting
form_data.value.file_upload_setting =
form_data.value.file_upload_setting || default_upload_setting
}
props.nodeModel.graphModel.eventCenter.emit('refreshFileUploadConfig')
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The code appears to be well-written and follows standard conventions for Vue.js 3 with TypeScript. However, there are a few minor points that could potentially enhance readability or maintainability:

  1. Empty Lines: The code contains empty lines after some @submitDialog calls without spaces around them. Adding spacing makes it easier to read.

  2. Spaces Around Operators: There are no spaces between the operators (=) in expressions like size="small" and v-model="form_data.file_upload_enable". Adding spaces improves readability.

  3. Comment Formatting: Comments are formatted consistently but could be more descriptive depending on their content.

Here is a slightly revised version of the template based on these suggestions:

<template>
  <!-- ... rest of the template unchanged... -->
</template>

<script setup lang="ts">
// ... rest of the script unchanged...
</script>

Summary of Optimization Suggested

  1. Add Spaces:
    • In JavaScript/TypeScript assignments within attributes (e.g., size="small", v-model="formData.file_upload_enabled").
    • Add spaces around assignment operators (=).

These adjustments can make the code more readable and consistent with industry standards.

Expand Down