Skip to content

fix: The similarity of knowledge base mixed retrieval should be 0-2 #3021

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
Apr 29, 2025
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
2 changes: 1 addition & 1 deletion ui/src/views/application/component/ParamSettingDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<el-input-number
v-model="form.dataset_setting.similarity"
:min="0"
:max="form.search_mode === 'blend' ? 2 : 1"
:max="form.dataset_setting.search_mode === 'blend' ? 2 : 1"
:precision="3"
:step="0.1"
:value-on-clear="0"
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 provided lines of code seem to be part of an implementation for a Vue.js component using Element Plus framework, with form being the state object containing various properties related to dataset settings. The specific concern is about the value of form.dataset_setting.similarity, which has a maximum limit that depends on the value of another property, form.search_mode.

Here’s what I recommend:

  1. Variable Consistency: Ensure that all variables and constants used in conditionals match their expected values. In this case, both form.search_mode and form.dataset_setting.search_mode should ideally point to a single variable to avoid inconsistencies.

  2. Documentation: It would improve readability to add comments explaining why the upper bound is 2 when search_mode is 'blend'. This might clarify future maintenance requirements.

  3. Optimization Suggestions:

    • If there are multiple places where the same calculation (form.search_mode === 'blend' ? 2 : 1) occurs, consider centralizing it into a helper function to maintain consistency and reduce duplication.
// Helper function to determine max similarity based on search mode
function getMaxSimilarityModeBlend(searchMode) {
  return searchMode === 'blend' ? 2 : 1;
}

<el-input-number
  v-model="form.dataset_setting.similarity"
  :min="0"
  :max="getMaxSimilarityModeBlend(form.search_mode)"
  :precision="3"
  :step="0.1"
  :value-on-clear="0"
/>

This way, if you need to change the logic later (e.g., handling different modes differently), you only need to modify one place instead of many.

Expand Down