fix: made reranker not disable when hybrid search is enabled (#7622)
* added toggle_disable option
* made toggle be disabled when toggle_disable is true
* added logic to disable toggle when choosing hybrid search
* Updated starter projects
* Fixed toggle_disable to be optional
* fixed toggle disable to remove toggle
* ✅ (intComponent.spec.ts): update test assertions to match expected behavior after changes in the component's functionality
---------
Co-authored-by: Carlos Coelho <80289056+carlosrcoelho@users.noreply.github.com>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
This commit is contained in:
parent
28675d873f
commit
7fb400d99e
8 changed files with 19 additions and 4 deletions
|
|
@ -827,7 +827,9 @@ class AstraDBVectorStoreComponent(LCVectorStoreComponent):
|
|||
build_config["search_method"]["value"] = "Vector Search"
|
||||
|
||||
# Set reranker and lexical terms options based on search method
|
||||
build_config["reranker"]["toggle_value"] = True
|
||||
build_config["reranker"]["show"] = build_config["search_method"]["value"] == "Hybrid Search"
|
||||
build_config["reranker"]["toggle_disable"] = build_config["search_method"]["value"] == "Hybrid Search"
|
||||
if build_config["reranker"]["show"]:
|
||||
build_config["search_type"]["value"] = "Similarity"
|
||||
|
||||
|
|
@ -887,6 +889,11 @@ class AstraDBVectorStoreComponent(LCVectorStoreComponent):
|
|||
build_config["lexical_terms"]["show"] = not is_vector_search
|
||||
build_config["lexical_terms"]["value"] = "" if is_vector_search else build_config["lexical_terms"]["value"]
|
||||
|
||||
# Disable reranker disabling if hybrid search is selected
|
||||
build_config["reranker"]["toggle_disable"] = not is_vector_search
|
||||
build_config["reranker"]["toggle_value"] = True
|
||||
build_config["reranker"]["value"] = build_config["reranker"]["options"][0]
|
||||
|
||||
# Toggle search type and score threshold based on search method
|
||||
build_config["search_type"]["show"] = is_vector_search
|
||||
build_config["search_score_threshold"]["show"] = is_vector_search
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -206,6 +206,8 @@ class DropDownMixin(BaseModel):
|
|||
"""Variable that defines if a toggle button is shown."""
|
||||
toggle_value: bool | None = None
|
||||
"""Variable that defines the value of the toggle button. Defaults to None."""
|
||||
toggle_disable: bool | None = None
|
||||
"""Variable that defines if the toggle button is disabled. Defaults to None."""
|
||||
|
||||
@field_validator("toggle_value")
|
||||
@classmethod
|
||||
|
|
|
|||
|
|
@ -469,6 +469,7 @@ class DropdownInput(BaseInputMixin, DropDownMixin, MetadataTraceMixin, ToolModeM
|
|||
combobox: CoalesceBool = False
|
||||
dialog_inputs: dict[str, Any] = Field(default_factory=dict)
|
||||
toggle: bool = False
|
||||
toggle_disable: bool | None = None
|
||||
toggle_value: bool | None = None
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ export default function DropdownComponent({
|
|||
handleNodeClass,
|
||||
toggle,
|
||||
toggleValue,
|
||||
toggleDisable,
|
||||
...baseInputProps
|
||||
}: InputProps<string, DropDownComponentType>) {
|
||||
const onChange = (value: any, dbValue?: boolean, skipSnapshot?: boolean) => {
|
||||
|
|
@ -44,7 +45,7 @@ export default function DropdownComponent({
|
|||
handleOnNewValue={handleOnNewValue}
|
||||
{...baseInputProps}
|
||||
/>
|
||||
{toggle && (
|
||||
{toggle && toggleDisable !== true ? (
|
||||
<ToggleShadComponent
|
||||
value={toggleValue ?? true}
|
||||
handleOnNewValue={(data) => {
|
||||
|
|
@ -57,6 +58,8 @@ export default function DropdownComponent({
|
|||
id={`toggle_dropdown_${id}`}
|
||||
disabled={disabled}
|
||||
/>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ export function StrRenderComponent({
|
|||
name={templateData?.name!}
|
||||
toggle={templateData.toggle}
|
||||
toggleValue={templateData.toggle_value}
|
||||
toggleDisable={templateData.toggle_disable}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ export type DropDownComponentType = {
|
|||
handleNodeClass: (value: any, code?: string, type?: string) => void;
|
||||
toggle?: boolean;
|
||||
toggleValue?: boolean;
|
||||
toggleDisable?: boolean;
|
||||
};
|
||||
|
||||
export type TextAreaComponentType = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue