dify - 💡(How to fix) Fix [Bug] External knowledge base retrieval settings (top_k / score_threshold) are not applied on save and retrieval testing

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

  1. Open DevTools Console. The following error is thrown:

Root Cause

  1. The Save button click does nothing — no PATCH is sent — because a TypeError crashes the hook that owns the button's onClick.

Fix Action

Fix / Workaround

  1. Create a new Knowledge Base with provider = external (bound to any external knowledge API).
  2. Open Knowledge Base Settings → Retrieval Settings.
  3. Change top_k from the default 4 to 7.
  4. Click Save.
  • Expected: a PATCH request is sent to /console/api/datasets/<id> and the new values are persisted.
  1. On the settings page, saving retrieval settings for an external knowledge base should fire a PATCH request and persist the values the user configured.

  2. The Save button click does nothing — no PATCH is sent — because a TypeError crashes the hook that owns the button's onClick.

Code Example

{
    "external_retrieval_model": {
      "top_k": 7,
      "score_threshold": 0.35,
      "score_threshold_enabled": false
    }
  }

---

{
    "external_retrieval_model": {
      "top_k": 4,
      "score_threshold": 0.5,
      "score_threshold_enabled": false
    }
  }
RAW_BUFFERClick to expand / collapse

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.14.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Create a new Knowledge Base with provider = external (bound to any external knowledge API).
  2. Open Knowledge Base Settings → Retrieval Settings.
  3. Change top_k from the default 4 to 7.
  4. Click Save.
  • Expected: a PATCH request is sent to /console/api/datasets/<id> and the new values are persisted.

  • Actual: no network request is fired; the button click silently does nothing.

  1. Open DevTools Console. The following error is thrown: TypeError: Cannot read properties of undefined (reading 'reranking_provider_name') at showMultiModalTip useMemo in use-form-state.ts
  2. Regardless of step 4, navigate to Retrieval Testing, enter a query and click Testing. Expected request body:
  {
    "external_retrieval_model": {
      "top_k": 7,
      "score_threshold": 0.35,
      "score_threshold_enabled": false
    }
  }
  • Actual request body (hard-coded defaults):
  {
    "external_retrieval_model": {
      "top_k": 4,
      "score_threshold": 0.5,
      "score_threshold_enabled": false
    }
  }

✔️ Expected Behavior

  1. On the settings page, saving retrieval settings for an external knowledge base should fire a PATCH request and persist the values the user configured.

  2. On the retrieval testing page, the request body should use the persisted top_k / score_threshold / score_threshold_enabled, not hard-coded defaults.

<img width="3420" height="1828" alt="Image" src="https://github.com/user-attachments/assets/bdcf814d-6551-4223-b44f-49d6c861d2c6" />

❌ Actual Behavior

  1. The Save button click does nothing — no PATCH is sent — because a TypeError crashes the hook that owns the button's onClick.

  2. Retrieval testing always sends hard-coded defaults (top_k: 4, score_threshold: 0.5, score_threshold_enabled: false), ignoring the user's saved configuration.

<img width="3428" height="1830" alt="Image" src="https://github.com/user-attachments/assets/9bdd13c8-4d38-480a-8844-b57a747cc24d" />

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

dify - 💡(How to fix) Fix [Bug] External knowledge base retrieval settings (top_k / score_threshold) are not applied on save and retrieval testing