Open MrXionGe opened 1 week ago
Switching the "score" switch in the Knowledge Retrieval component does not save the "score" value in Dify version 7.0.3 because the handleSwitch
function is designed to only handle the score_threshold_enabled
key. It explicitly ignores the top_k
key and does not handle any other keys.
Here's the relevant code snippet:
const handleSwitch = (key: string, enable: boolean) => {
if (key === 'top_k')
return
onChange({
...datasetConfigs,
score_threshold_enabled: enable,
})
}
To save the "score" value, you would need to modify the handleSwitch
function to handle the appropriate key and update the dataset configuration accordingly [1].
To continue talking to Dosu, mention @dosu.
In the knowledge base settings, retrieval settings. Switching the "score" switch is more in line with usage habits. I think.
https://github.com/user-attachments/assets/16ccb9a6-76a8-458f-b42d-224771125dd9
Self Checks
Dify version
0.7.3
Cloud or Self Hosted
Cloud
Steps to reproduce
✔️ Expected Behavior
Turn off the "score" switch, and the "score" value will turn gray. Turn on the "score" switch and the value will be restored. Because in the knowledge base settings, retrieval settings, the "score" value is like this.
❌ Actual Behavior
Turn off the "score" switch, and the "score" value will be cleared. Turn on the "score" switch, and the value will return to the default value "0.8".
https://github.com/user-attachments/assets/968d426d-1830-420a-8f8d-6c37029dd8d1