Dify Knowledge Base icon

Dify Knowledge Base

Manage Dify AI knowledge base datasets, documents, segments, and metadata with comprehensive CRUD operations

Document → Update Text

AI-generated

Overview

The node "Dify Knowledge Base" enables managing documents within a knowledge base powered by Dify AI. Specifically, the Update Text operation for the Document resource allows users to update the textual content of an existing document in a dataset.

This operation is useful when you need to correct, enhance, or otherwise modify the text content of a document already stored in the knowledge base without recreating the entire document. For example, if a document contains outdated information or typos, you can update its text directly.

Practical scenarios include:

  • Keeping documentation up-to-date by editing text content.
  • Correcting errors or adding new information to existing documents.
  • Automating bulk updates of document texts based on external data changes.

Properties

Name Meaning
Dataset ID The unique identifier of the dataset that contains the document to be updated.
Document ID The unique identifier of the document whose text content will be updated.
Text The new text content to replace the existing content of the document.
Additional Fields Optional extra settings for the update operation:
- Name: New name for the document (optional).
- Indexing Technique: Choose between "High Quality" or "Economy" indexing.
- Process Rule: Configure processing mode and custom pre-processing rules including segmentation options like separator and max tokens per segment.

Output

The output JSON contains the response from the Dify API after updating the document text. This typically includes metadata about the updated document such as its ID, status, and possibly confirmation of the update.

No binary data output is expected from this operation.

Dependencies

  • Requires an active connection to the Dify AI knowledge base service.
  • Needs an API key credential configured in n8n for authentication.
  • The node uses the base URL and API key from the credentials to make HTTP requests to the Dify API.

Troubleshooting

  • Common issues:

    • Invalid or missing Dataset ID or Document ID will cause the update to fail.
    • Providing empty or invalid text content may result in errors or no changes.
    • Network or authentication failures due to incorrect API key or base URL configuration.
  • Error messages:

    • "The operation "updateText" is not supported for resource "document": Indicates a misconfiguration or unsupported operation selection.
    • API errors related to authorization or resource not found usually mean the provided IDs or credentials are incorrect.
  • Resolutions:

    • Verify Dataset ID and Document ID are correct and exist in the knowledge base.
    • Ensure the API key and base URL credentials are properly set up in n8n.
    • Confirm the text content is valid and non-empty.
    • Use the "Continue On Fail" option to handle errors gracefully during batch operations.

Links and References

Discussion