diff --git a/frontend/src/components/layout/Person.vue b/frontend/src/components/layout/Person.vue
index a1333db3..223724ca 100644
--- a/frontend/src/components/layout/Person.vue
+++ b/frontend/src/components/layout/Person.vue
@@ -75,7 +75,7 @@ const logout = () => {
@@ -184,6 +184,7 @@ const logout = () => {
font-size: 14px;
line-height: 22px;
margin-left: 8px;
+ max-width: 85px;
}
&::after {
diff --git a/frontend/src/components/layout/PwdForm.vue b/frontend/src/components/layout/PwdForm.vue
index e2c6c064..abe92bfc 100644
--- a/frontend/src/components/layout/PwdForm.vue
+++ b/frontend/src/components/layout/PwdForm.vue
@@ -70,11 +70,11 @@ defineExpose({
{
- if (!value) return false
- if (value.trim().length == 0) return false
- return true
- },
- }).then(({ value }) => {
- _loading.value = true
- chatApi
- .renameChat(chat.id, value)
- .then((res) => {
- ElMessage({
- type: 'success',
- message: 'Successfully renamed chat',
- })
- emits('chatRenamed', { id: chat.id, brief: res })
- })
- .catch((err) => {
- ElMessage({
- type: 'error',
- message: err.message,
- })
- console.error(err)
- })
- .finally(() => {
- _loading.value = false
- })
- })
-
+ password.id = chat.id
+ password.name = chat.brief as string
+ dialogVisiblePassword.value = true
break
case 'delete':
ElMessageBox.confirm('This action will permanently delete the chat. Continue?', 'Warning', {
@@ -173,6 +143,56 @@ function handleCommand(command: string | number | object, chat: Chat) {
}
}
}
+
+const passwordRef = ref()
+const dialogVisiblePassword = ref(false)
+const password = reactive({
+ name: '',
+ id: 0,
+})
+
+const passwordRules = {
+ name: [
+ {
+ required: true,
+ message: t('datasource.please_enter') + t('common.empty') + t('qa.conversation_title'),
+ trigger: 'blur',
+ },
+ ],
+}
+
+const handleClosePassword = () => {
+ passwordRef.value.clearValidate()
+ dialogVisiblePassword.value = false
+ password.id = 0
+ password.name = ''
+}
+const handleConfirmPassword = () => {
+ passwordRef.value.validate((res: any) => {
+ if (res) {
+ chatApi
+ .renameChat(password.id, password.name)
+ .then((res) => {
+ ElMessage({
+ type: 'success',
+ message: t('common.save_success'),
+ })
+ emits('chatRenamed', { id: password.id, brief: res })
+ handleClosePassword()
+ })
+ .catch((err) => {
+ ElMessage({
+ type: 'error',
+ message: err.message,
+ })
+ console.error(err)
+ })
+ .finally(() => {
+ _loading.value = false
+ })
+ }
+ })
+}
@@ -222,6 +242,41 @@ function handleCommand(command: string | number | object, chat: Chat) {
+