-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: show/hide autoplay and autosend checkbox #2053
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,7 +90,7 @@ | |
| $t('views.application.applicationForm.form.voiceInput.label') | ||
| }}</span> | ||
| <div class="flex"> | ||
| <el-checkbox v-model="form_data.stt_autosend">{{ | ||
| <el-checkbox v-if="form_data.stt_model_enable" v-model="form_data.stt_autosend">{{ | ||
| $t('views.application.applicationForm.form.voiceInput.autoSend') | ||
| }}</el-checkbox> | ||
| <el-switch | ||
|
|
@@ -117,7 +117,7 @@ | |
| $t('views.application.applicationForm.form.voicePlay.label') | ||
| }}</span> | ||
| <div class="flex"> | ||
| <el-checkbox v-model="form_data.tts_autoplay">{{ | ||
| <el-checkbox v-if="form_data.tts_model_enable" v-model="form_data.tts_autoplay">{{ | ||
| $t('views.application.applicationForm.form.voicePlay.autoPlay') | ||
| }}</el-checkbox> | ||
| <el-switch | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The provided code snippet appears to be part of an HTML template for a form within an application. It involves conditional rendering using Vue's Here’s a summary of the checks and potential optimizations:
Code Suggestion<div class="input-options flex-column m-y-4">
<!-- Voice Input -->
<span>{{ $t('views.application.applicationForm.form.voiceInput.label') }}</span>
<el-checkbox v-model="form_data.vic_input_enabled">{{
// Display "autoSend" only when stt_model_enable = true
$t(form_data.vic_input_enabled ? 'views.application.applicationForm.form.voiceInput.autoSend' : '')
}}</el-checkbox>
<!-- Toggle for TTS Auto Play -->
<span>{{ $t('views.application.applicationForm.form.voicePlay.label') }}</span>
<el-switch v-model="form_data.vic_automode_play"
:disabled="{true: !vic_tts_model_enabled || vic_voiceenabled}"
size="mini"></el-switch>
</div>Summary of Key Observations and Recommendations:
By addressing these points, you can ensure the code remains readable and maintainable while also improving user experience through optimal layout design and effective language integration. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The provided code appears to be from an application's Vue.js interface that manages form settings related to voice integration. After reviewing it, here are some suggestions:
Conditional Rendering: All
el-checkboxelements should ideally have their conditions checked before rendering. Here you have two instances wherev-if="applicationForm.stt_model_enable"is missing and could lead to unnecessary renderings of checkboxes when the feature isn't enabled.Code Clarity: While not critical, consider adding comments around sections of code like conditional checks for better readability.
Performance Considerations:
applicationForm.stt_model_enableis expected to toggle frequently (e.g., due to server-side changes), ensure that reactive updates are optimized for performance since these might cause multiple re-renders.TTS Configuration: Since the code handles both STT (Speech To Text) and TTS (Text To Speech) configurations, similar considerations apply to enabling/disabling those features through
applicationForm.tts_model_enable.Overall, these points improve the maintainability and efficiency of the code while ensuring that its functionality aligns with user expectations according to translations fetched via
$t.