mirror of
https://github.com/langgenius/dify.git
synced 2026-04-27 19:27:23 +08:00
fix: ensure external knowledge API key updates are persisted (#33188)
Co-authored-by: Jeff <jeff@WKS0003265039.eu.boehringer.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
parent
3f515dcdda
commit
e1df0fad2b
@ -88,10 +88,15 @@ const AddExternalAPIModal: FC<AddExternalAPIModalProps> = ({ data, onSave, onCan
|
|||||||
try {
|
try {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
if (isEditMode && onEdit) {
|
if (isEditMode && onEdit) {
|
||||||
|
// Only send [__HIDDEN__] when the user has not changed the key, otherwise
|
||||||
|
// send the actual api_key so updated tokens are persisted.
|
||||||
|
const apiKeyToSend = formData.settings.api_key === '[__HIDDEN__]'
|
||||||
|
? '[__HIDDEN__]'
|
||||||
|
: formData.settings.api_key
|
||||||
await onEdit(
|
await onEdit(
|
||||||
{
|
{
|
||||||
...formData,
|
...formData,
|
||||||
settings: { ...formData.settings, api_key: formData.settings.api_key ? '[__HIDDEN__]' : formData.settings.api_key },
|
settings: { ...formData.settings, api_key: apiKeyToSend },
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
notify({ type: 'success', message: 'External API updated successfully' })
|
notify({ type: 'success', message: 'External API updated successfully' })
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user