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
|
||||
:value="name"
|
||||
: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"
|
||||
/>
|
||||
</NFormItem>
|
||||
|
||||
@@ -56,8 +56,9 @@ function handleClose() {
|
||||
<NForm label-placement="top">
|
||||
<NFormItem :label="t('profiles.newName')" required>
|
||||
<NInput
|
||||
v-model:value="newName"
|
||||
:value="newName"
|
||||
:placeholder="t('profiles.newNamePlaceholder')"
|
||||
@input="newName = $event.toLowerCase().replace(/[^a-z0-9_-]/g, '')"
|
||||
@keyup.enter="handleSave"
|
||||
/>
|
||||
</NFormItem>
|
||||
|
||||
Reference in New Issue
Block a user