fix: resolve plugin model.position parsing in legacy DSL (≤0.1.5)
Summary
Fixes https://github.com/langgenius/dify/issues/20081 Fixes https://github.com/langgenius/dify/issues/19219 Fixes https://github.com/langgenius/dify/issues/20346
Reason: The ModelPosition definition in the following file is of type Optional[list[str]]:
https://github.com/langgenius/dify-plugin-sdks/blob/main/python/dify_plugin/entities/model/provider.py#L156
Whereas in api/../provider_entities.py, the position is defined as list[str] type (non-optional).
In other words:
- In provider.py:
position: Optional[list[str]] - In provider_entities.py:
position: list[str]
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
[!Tip] Close issue syntax:
Fixes #<issue number>orResolves #<issue number>, see documentation for more details.
Screenshots
| Before | After |
|---|---|
Checklist
[!IMPORTANT]
Please review the checklist below before submitting your pull request.
- [ ] This change requires a documentation update, included: Dify Document
- [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
- [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
- [x] I've updated the documentation accordingly.
- [x] I ran
dev/reformat(backend) andcd web && npx lint-staged(frontend) to appease the lint gods
We do not intend to continue supporting DSL files prior to version 1.0.0. As you can see, allowing fields to be empty would introduce a substantial amount of code to handle types, which is something we prefer to avoid.
We do not intend to continue supporting DSL files prior to version 1.0.0. As you can see, allowing fields to be empty would introduce a substantial amount of code to handle types, which is something we prefer to avoid.
If the requested API returns an optional type, the ProviderEntity should still need to be parsed. May I resubmit a fix to improve the reference checking?
If the requested API returns an optional type, the ProviderEntity should still need to be parsed.
Could you please explain which types of APIs return data that requires compatibility?
If the requested API returns an optional type, the ProviderEntity should still need to be parsed.
Could you please explain which types of APIs return data that requires compatibility?
I found out that if we need to parse this API: https://marketplace.dify.ai/api/v1/plugins/batch