fix(frontend): persist graph extract toggle state on KB save (#1297)

The "启用实体关系提取" switch in GraphSettings was silently dropped on
save: buildSubmitData only attached extract_config to the request when
both indexingStrategy.graphEnabled AND nodeExtractConfig.enabled were
true. When the graph indexing strategy was off (the default), the
toggle change never reached the backend and reloading the KB always
showed the switch as off.

Always emit extract_config based on the user's actual toggle state so
the value round-trips correctly through updateKBConfig regardless of
the indexing strategy selection.
This commit is contained in:
wizardchen
2026-05-13 00:40:58 +08:00
committed by lyingbug
parent 9e08ab7302
commit f58139a945
@@ -934,14 +934,15 @@ const buildSubmitData = () => {
}
}
// Sync extract_config.enabled from indexingStrategy.graphEnabled
if (formData.value.indexingStrategy?.graphEnabled && formData.value.nodeExtractConfig?.enabled) {
// Always persist extract_config so the toggle state from GraphSettings is saved,
// regardless of whether the graph indexing strategy is currently enabled.
if (formData.value.nodeExtractConfig) {
data.extract_config = {
enabled: true,
text: formData.value.nodeExtractConfig.text,
tags: formData.value.nodeExtractConfig.tags,
nodes: formData.value.nodeExtractConfig.nodes,
relations: formData.value.nodeExtractConfig.relations
enabled: !!formData.value.nodeExtractConfig.enabled,
text: formData.value.nodeExtractConfig.text || '',
tags: formData.value.nodeExtractConfig.tags || [],
nodes: formData.value.nodeExtractConfig.nodes || [],
relations: formData.value.nodeExtractConfig.relations || []
}
}