feat(model-declaration): support per-field help on model provider credentials#774
Open
dparkmit24 wants to merge 1 commit into
Open
feat(model-declaration): support per-field help on model provider credentials#774dparkmit24 wants to merge 1 commit into
dparkmit24 wants to merge 1 commit into
Conversation
…dentials Model-provider credential form fields (ModelProviderCredentialFormSchema) did not model a per-field help, so a plugin manifest's help on such a field was silently dropped during unmarshal and never reached the management-API declaration. Tool credential fields (ProviderConfig) already carry Help and URL, so tool credential help renders while model provider help does not. Add Help and URL to ModelProviderCredentialFormSchema, matching the ProviderConfig fields, to bring model-provider credentials to parity. Additive and optional; no behavior change for existing plugins. Add a round-trip test asserting help survives unmarshal and marshal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Model-provider credential form fields don't carry per-field
help, so a plugin manifest'shelpon such a field is silently dropped during unmarshal and never reaches the provider declaration returned by the management API. Tool credential fields already model this —ProviderConfig(pkg/entities/plugin_entities/config.go) hasHelpandURL— which is why tool credential help renders in the Dify UI while model-provider credential help does not.This brings model-provider credentials to parity by adding
Help(andURL, matchingProviderConfig) toModelProviderCredentialFormSchema(pkg/entities/plugin_entities/model_declaration.go). Thetype Aliasunmarshalers handle the new fields automatically. The change is additive and optional — no behavior change for existing plugins.For example,
models/bedrocksetshelponbedrock_endpoint_url/bedrock_proxy_urlandmodels/openaionapi_protocol; today those never reach the client. (Full trace: manifest → daemon struct → management-API JSON confirms the field is dropped at this struct.)Type of Change
Essential Checklist
Testing
Bug Fix (if applicable)
Fixes #123orCloses #123)Additional Information
This is the first of three coordinated changes needed for a plugin's per-field help to reach the model-provider credential form in the Dify UI: (1) this daemon change so the declaration carries
help; (2) thegraphonCredentialFormSchemaneeds the field (it currently drops unknown keys via pydanticextra="ignore"); (3) the Dify frontend needs to maphelp→tooltipfor model-provider credentials (tools/agents already do). Flagging so it's clear this is intentionally scoped to the daemon and is safe/inert on its own.Note:
URLis included for exact parity withProviderConfig; happy to drop it toHelp-only if you'd prefer the minimal change. Similarly,jsonomitemptywas left offhelpto matchProviderConfig— glad to add it on both if you'd rather.Drafted with AI assistance (Claude) and reviewed by me before submitting.