fix(channels): don't gate webchat creation on auto-generated API Key

The Web/API (webchat) onboarding wizard marked api_key as required while
it is also readOnly and platform-generated on save. The readOnly field
could never be filled during creation, so canSubmitConfig never passed
and "Continue" stayed disabled.

Exclude readOnly fields from the wizard's required/optional field sets so
they neither gate "Continue" nor render as fillable inputs. The api_key
still appears as required + readOnly in the edit modal once a value
exists.

Refs matevip/mateclaw#338
This commit is contained in:
倪程伟 2026-06-17 18:41:46 +08:00 committed by matevip
parent 1522009aec
commit 981c3d56d9

View File

@ -393,8 +393,13 @@ const subtitle = computed(() =>
)
const allFields = computed<ChannelFieldDef[]>(() => CHANNEL_FIELD_DEFS[channelType.value] || [])
const requiredFields = computed(() => allFields.value.filter((f) => f.required))
const optionalFields = computed(() => allFields.value.filter((f) => !f.required))
// readOnly fields are platform-generated on save (e.g. webchat's api_key) the
// user can't enter them during creation, so they must never gate "Continue" nor
// render as fillable inputs here. They show up (required, readOnly) in the edit
// modal once a value exists.
const editableFields = computed(() => allFields.value.filter((f) => !f.readOnly))
const requiredFields = computed(() => editableFields.value.filter((f) => f.required))
const optionalFields = computed(() => editableFields.value.filter((f) => !f.required))
const hasVerifier = computed(() => VERIFIABLE_TYPES.has(channelType.value))
const isOAuthStyle = computed(() => OAUTH_STYLE_TYPES.has(channelType.value))