fix(profiles): normalize profile names to lowercase before sending to hermes-agent (#302)
Profile name inputs accepted uppercase letters (e.g. 'MyConfig') but hermes-agent's backend validation only allows [a-z0-9_-], causing 'Invalid profile name' errors when creating or renaming profiles. Changes: - ProfileCreateModal: filter and lowercase input on @input - ProfileRenameModal: same fix + change from v-model to :value + @input - en.ts: update placeholder text to clarify 'lowercase letters' - zh.ts: update placeholder text to clarify '小写字母' Before: input 'MyConfig' was sent unchanged → backend error After: input 'MyConfig' is normalized to 'myconfig' → success Co-authored-by: HJW <hujingwen@hermes.ai>
This commit is contained in:
@@ -69,7 +69,7 @@ function handleClose() {
|
|||||||
<NInput
|
<NInput
|
||||||
:value="name"
|
:value="name"
|
||||||
:placeholder="t('profiles.namePlaceholder')"
|
:placeholder="t('profiles.namePlaceholder')"
|
||||||
@input="name = $event.replace(/[^a-zA-Z0-9_-]/g, '')"
|
@input="name = $event.toLowerCase().replace(/[^a-z0-9_-]/g, '')"
|
||||||
@keyup.enter="handleSave"
|
@keyup.enter="handleSave"
|
||||||
/>
|
/>
|
||||||
</NFormItem>
|
</NFormItem>
|
||||||
|
|||||||
@@ -56,8 +56,9 @@ function handleClose() {
|
|||||||
<NForm label-placement="top">
|
<NForm label-placement="top">
|
||||||
<NFormItem :label="t('profiles.newName')" required>
|
<NFormItem :label="t('profiles.newName')" required>
|
||||||
<NInput
|
<NInput
|
||||||
v-model:value="newName"
|
:value="newName"
|
||||||
:placeholder="t('profiles.newNamePlaceholder')"
|
:placeholder="t('profiles.newNamePlaceholder')"
|
||||||
|
@input="newName = $event.toLowerCase().replace(/[^a-z0-9_-]/g, '')"
|
||||||
@keyup.enter="handleSave"
|
@keyup.enter="handleSave"
|
||||||
/>
|
/>
|
||||||
</NFormItem>
|
</NFormItem>
|
||||||
|
|||||||
@@ -366,9 +366,9 @@ export default {
|
|||||||
importSelectFile: 'Select archive file',
|
importSelectFile: 'Select archive file',
|
||||||
importInvalidFile: 'Please select a valid archive (.tar.gz, .tgz, .gz, .zip)',
|
importInvalidFile: 'Please select a valid archive (.tar.gz, .tgz, .gz, .zip)',
|
||||||
name: 'Profile Name',
|
name: 'Profile Name',
|
||||||
namePlaceholder: 'English letters, numbers, hyphens only',
|
namePlaceholder: 'Lowercase letters, numbers, hyphens only',
|
||||||
newName: 'New Name',
|
newName: 'New Name',
|
||||||
newNamePlaceholder: 'Enter new name',
|
newNamePlaceholder: 'Lowercase letters, numbers, hyphens',
|
||||||
cloneFromCurrent: 'Clone from current profile',
|
cloneFromCurrent: 'Clone from current profile',
|
||||||
cloneCleanupNotice: 'Cloning automatically skips exclusive platform credentials (Weixin / Telegram / Slack, etc.) to avoid conflicts with the source profile',
|
cloneCleanupNotice: 'Cloning automatically skips exclusive platform credentials (Weixin / Telegram / Slack, etc.) to avoid conflicts with the source profile',
|
||||||
cloneStrippedCredentials: 'Stripped {count} exclusive credential(s): {list}',
|
cloneStrippedCredentials: 'Stripped {count} exclusive credential(s): {list}',
|
||||||
|
|||||||
@@ -358,9 +358,9 @@ export default {
|
|||||||
importSelectFile: '选择归档文件',
|
importSelectFile: '选择归档文件',
|
||||||
importInvalidFile: '请选择有效的归档文件 (.tar.gz, .tgz, .gz, .zip)',
|
importInvalidFile: '请选择有效的归档文件 (.tar.gz, .tgz, .gz, .zip)',
|
||||||
name: '配置名称',
|
name: '配置名称',
|
||||||
namePlaceholder: '仅限英文、数字、连字符',
|
namePlaceholder: '仅限小写字母、数字、连字符',
|
||||||
newName: '新名称',
|
newName: '新名称',
|
||||||
newNamePlaceholder: '输入新名称',
|
newNamePlaceholder: '小写字母、数字、连字符',
|
||||||
cloneFromCurrent: '从当前配置克隆',
|
cloneFromCurrent: '从当前配置克隆',
|
||||||
cloneCleanupNotice: '克隆时会自动跳过独占型平台凭据(Weixin / Telegram / Slack 等),避免与源配置冲突',
|
cloneCleanupNotice: '克隆时会自动跳过独占型平台凭据(Weixin / Telegram / Slack 等),避免与源配置冲突',
|
||||||
cloneStrippedCredentials: '已清理 {count} 项独占凭据:{list}',
|
cloneStrippedCredentials: '已清理 {count} 项独占凭据:{list}',
|
||||||
|
|||||||
Reference in New Issue
Block a user