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

Conversation

shaohuzhang1
Copy link
Contributor

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

Copy link

f2c-ci-robot bot commented Apr 29, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link

f2c-ci-robot bot commented Apr 29, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@shaohuzhang1 shaohuzhang1 merged commit 00a3e5d into main Apr 29, 2025
4 checks passed
@shaohuzhang1 shaohuzhang1 deleted the pr@main@fix_search_setting branch April 29, 2025 07:18
@@ -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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant