From d6b3df8f6f92f8edc29155395dab506c216dbfec Mon Sep 17 00:00:00 2001 From: 17hz <0x149527@gmail.com> Date: Tue, 2 Sep 2025 14:52:05 +0800 Subject: [PATCH] fix: API Key Authorization Configuration Model Form render default value (#24963) --- .../model-auth/hooks/use-model-form-schemas.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-model-form-schemas.ts b/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-model-form-schemas.ts index eafbedfddf..22fab62bee 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-model-form-schemas.ts +++ b/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-model-form-schemas.ts @@ -65,7 +65,10 @@ export const useModelFormSchemas = ( }, [formSchemas, t]) const formValues = useMemo(() => { - let result = {} + let result: any = {} + formSchemas.forEach((schema) => { + result[schema.variable] = schema.default + }) if (credential) { result = { ...result, __authorization_name__: credential?.credential_name } if (credentials) @@ -74,7 +77,7 @@ export const useModelFormSchemas = ( if (model) result = { ...result, __model_name: model?.model, __model_type: model?.model_type } return result - }, [credentials, credential, model]) + }, [credentials, credential, model, formSchemas]) return { formSchemas: formSchemasWithAuthorizationName,