mirror of
https://github.com/langgenius/dify-plugin-sdks.git
synced 2026-07-22 02:15:22 -04:00
Issue: Optimization Suggestions for Input Parameter Design #22
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 @yjc980121 on GitHub (Mar 24, 2025).
Description:
In the current API design, the following input parameters are missing or need optimization:
Missing user parameter:
The current API design does not include the user parameter. The user parameter is an essential identifier for defining the end-user's identity, which is useful for retrieval and statistics. According to the OpenAI API format, the user parameter can be passed in, so it is recommended to explicitly add this parameter to the API.
Parameter encapsulation optimization:
The current API includes auto_generate_name and files parameters. Although the OpenAI API itself does not have files or inputs parameters, to facilitate developers in passing additional information, it is suggested to encapsulate these parameters reasonably to maintain the simplicity and compatibility of the API.
Suggestions:
Add user parameter:
Explicitly add the user parameter to the API input parameters.
Parameter type: string
Parameter description: User identifier, used to define the identity of the end-user for retrieval and statistics. Defined by the developer, and it must be unique within the application.
Optimize parameter encapsulation:
Encapsulate the auto_generate_name and files parameters into a unified inputs parameter. The inputs parameter can contain multiple key-value pairs, with each key corresponding to a specific variable and each value being the specific value of that variable.
Parameter type: object
Parameter description: Allows passing in various variable values defined by the app. For example:
auto_generate_name: Boolean value, indicating whether to automatically generate a title. The default value is true.
files: Array, containing information about uploaded files. Supported types include images (image). Transfer methods include:
remote_url: URL of the image.
local_file: Uploaded file.
url: URL of the image (only when the transfer method is remote_url).
upload_file_id: ID of the uploaded file (only when the transfer method is local_file).
Example:
Applicable Scope:
chat.py
workflow.py
completion.py
Expected Outcome:
By implementing the above optimizations, the API design can be made more complete and flexible while maintaining compatibility with the OpenAI API, making it easier for developers to pass additional information.
Priority:
Medium