mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-07-22 12:25:45 -04:00
[DOCS]: Persistent Storage documentation is a bit unclear what self is in the code example
#258
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Escapingbug on GitHub (Oct 28, 2025).
Type of Documentation Change
Other
Documentation Page URL or Path
https://docs.dify.ai/plugin-dev-en/0411-persistent-storage-kv
Current Content
Current code example gives entry point and usage such as:
Entry point:
Interface:
Suggested Changes
The code example should include a bit more context such as what the
selfis mean to be.It is better to describe what the
selfs are about, and better write down code examples to help user understand how it can be used.Reason for Change
Considering the context of plugin development, there are at least provider context and tool context. Although it is possible that both provider and tool contexts support the storage accessing, it is unclear in the example.
Also, the interface
setreferencesselfas well, which confuses reader even more. It is possible to be used directly on tool context for exampleself.set(xxx)orself.session.storage.set(xxx).It is better to describe this directly. If it is possible to provide code examples, which would be better.
Code of Conduct
@dosubot[bot] commented on GitHub (Oct 28, 2025):
Hi @Escapingbug! I'm Dosu and I’m helping the dify-docs team.
In the Dify plugin persistent storage examples,
selfrefers to the instance of your plugin endpoint handler class, which is typically a subclass of the plugin SDK'sEndpointclass. Persistent storage is accessed viaself.session.storagewithin your plugin class methods. For example, in the official WhatsApp Bot plugin, you see usage like:This means
selfis not a provider or tool context, but specifically your plugin handler instance. Thesessionattribute provides access to the storage interface, supportingget,set, anddeletemethods. For more context, see the official plugin example.Clarifying this in the documentation and providing a full code snippet like above would help developers understand how to use persistent storage in their plugins.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
