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
30 changes: 15 additions & 15 deletions ui/src/views/application/component/ParamSettingDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
>
<el-scrollbar max-height="550">
<div class="p-16">
<el-form label-position="top" ref="paramFormRef" :model="form">
<el-form label-position="top" ref="paramFormRef" :model="form" v-loading="loading">
<el-form-item :label="$t('views.application.applicationForm.dialog.selectSearchMode')">
<el-radio-group
v-model="form.dataset_setting.search_mode"
Expand Down Expand Up @@ -259,20 +259,20 @@ const isWorkflowType = ref(false)

watch(dialogVisible, (bool) => {
if (!bool) {
form.value = {
dataset_setting: {
search_mode: 'embedding',
top_n: 3,
similarity: 0.6,
max_paragraph_char_number: 5000,
no_references_setting: {
status: 'ai_questioning',
value: '{question}'
}
},
problem_optimization: false,
problem_optimization_prompt: ''
}
// form.value = {
// dataset_setting: {
// search_mode: 'embedding',
// top_n: 3,
// similarity: 0.6,
// max_paragraph_char_number: 5000,
// no_references_setting: {
// status: 'ai_questioning',
// value: '{question}'
// }
// },
// problem_optimization: false,
// problem_optimization_prompt: ''
// }
noReferencesform.value = {
ai_questioning: defaultValue['ai_questioning'],
designated_answer: defaultValue['designated_answer']
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The code is mostly correct, but there are a few minor issues and improvements that can be made:

  1. The comments added to hide default values when dialogVisible is false are unnecessary and could cause confusion.
  2. Consider removing or commenting out the commented-out lines with default values, unless they serve some specific purpose (e.g., debugging).
  3. Ensure all necessary dependencies like v-loading, refs, and $t are properly imported and defined.
  4. The rest of the logic appears to be correctly implemented.

Here's a slightly optimized version of the relevant part:

watch(dialogVisible, (bool) => {
  if (!bool) {
    form.value.dataset_setting = {
      search_mode: 'embedding',
      top_n: 3,
      similarity: 0.6,
      max_paragraph_char_number: 5000,
      no_references_setting: {
        status: 'ai_questioning',
        value: '{question}'
      }
    };
    noReferencesform.value.ai_questioning = defaultValue['ai_questioning'];
    noReferencesform.value.designated_answer = defaultValue['designated_answer'];
    
    // Optionally, you might want to reset any loading state here
    loading.value = false;
  } else {
    // Initialize form with new defaults or load existing data
  }
});

If you have more complex initialization logic for noReferencesform, it would need to be included within the else block. Make sure to adjust based on your full application structure and requirements.

Expand Down