Repository navigation
fix: [Agent] The "File Upload" toggle in the basic information settings is disabled, yet the file upload button remains visible in the debugging dialog window. - #7748
Conversation
…gs is disabled, yet the file upload button remains visible in the debugging dialog window.
| <el-button text :disabled="!canUpload" @click="fileInputRef?.click()"> | ||
| <MkIcon name="icon_attachment_outlined" :size="18" class="text-N900!" /> | ||
| </el-button> | ||
| </MkTooltip> |
There was a problem hiding this comment.
Overall, the diff looks syntactically valid and the refactor is reasonable. The main risk is ensuring the new canUpload computed has exactly the same semantics as the old inline condition, plus any upload-feature gating.
Potential issues
-
canUploadmust includeuploadEnabled- The template now hides the upload input/button when
uploadEnabledis false. - However,
useInputEventsnow relies only oncanUpload.value. - If
canUploaddoes not includeuploadEnabled, then paste/drag-drop handlers may still add files even though the upload UI is hidden. - Safest defensive option:
unless
canUpload: () => uploadEnabled.value && canUpload.value
canUploadalready incorporatesuploadEnabled.
- The template now hides the upload input/button when
-
Guard
allowedExtensionsbefore calling.join()allowedExtensions.join('、')will throw ifallowedExtensionsisundefined,null, or not an array.- Prefer a computed fallback:
Then use
const allowedExtensionsText = computed(() => allowedExtensions.value?.length ? allowedExtensions.value.join('、') : '无限制' )
{{ allowedExtensionsText }}in the template.
-
Ensure
canUploadpreserves the old conditions- The old condition was:
!disabled.value && !streamLoading.value && fileList.value.length < maxFiles
- Confirm the new
canUploadcomputed includes all of these. If it omits any condition, the upload button and paste/drop behavior may regress.
- The old condition was:
-
v-ifon the file input andfileInputRef- Using
v-if="uploadEnabled"meansfileInputRefisnullwhile uploads are disabled. - That is fine if all click paths are also gated, but ensure no external code calls
fileInputRef.value?.click()without checkinguploadEnabled/canUpload.
- Using
-
allowedExtensionsvsacceptListconsistency- The display now uses
allowedExtensions, while the file input still usesacceptList. - Make sure these are kept in sync or derived from the same source. Otherwise the tooltip may describe different accepted types than the actual input.
- The display now uses
Optimization / readability suggestions
-
Wrap both upload-related elements in one
<template v-if="uploadEnabled">instead of repeatingv-if:<template v-if="uploadEnabled"> <input ... /> <MkTooltip ...>...</MkTooltip> </template>
-
Consider renaming or documenting the distinction between:
uploadEnabled— feature-level availabilitycanUpload— current-state eligibility
This helps avoid future confusion.
-
If
allowedExtensionsis empty, decide whether to show “无限制” or fall back toacceptList; an empty string in the tooltip is not user-friendly.
No obvious syntax problems in the diff, but the canUpload/uploadEnabled relationship is the most important correctness point to verify.
fix: [Agent] The "File Upload" toggle in the basic information settings is disabled, yet the file upload button remains visible in the debugging dialog window.