diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json
index 383cddca..7f801fd3 100644
--- a/frontend/src/i18n/en.json
+++ b/frontend/src/i18n/en.json
@@ -114,7 +114,9 @@
"today": "Today",
"week": "This Week",
"earlier": "Earlier",
- "no_time": "No Time"
+ "no_time": "No Time",
+ "rename_conversation_title": "Rename conversation title",
+ "conversation_title": "Conversation title"
},
"ds": {
"title": "Data Source",
@@ -502,4 +504,4 @@
"back_community": "Restore to Community Edition",
"confirm_tips": "Are you sure to restore to Community Edition?"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/i18n/zh-CN.json b/frontend/src/i18n/zh-CN.json
index ca01a0fb..6b70d46a 100644
--- a/frontend/src/i18n/zh-CN.json
+++ b/frontend/src/i18n/zh-CN.json
@@ -117,7 +117,9 @@
"today": "今天",
"week": "7天内",
"earlier": "更早以前",
- "no_time": "没有时间"
+ "no_time": "没有时间",
+ "rename_conversation_title": "重命名对话标题",
+ "conversation_title": "对话标题"
},
"ds": {
"title": "数据源",
@@ -514,4 +516,4 @@
"back_community": "还原至社区版",
"confirm_tips": "确定还原至社区版?"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/views/chat/ChatList.vue b/frontend/src/views/chat/ChatList.vue
index 73780aae..adcd408c 100644
--- a/frontend/src/views/chat/ChatList.vue
+++ b/frontend/src/views/chat/ChatList.vue
@@ -4,7 +4,7 @@ import icon_expand_down_filled from '@/assets/embedded/icon_expand-down_filled.s
import rename from '@/assets/svg/icon_rename_outlined.svg'
import delIcon from '@/assets/svg/icon_delete.svg'
import { type Chat, chatApi } from '@/api/chat.ts'
-import { computed, ref } from 'vue'
+import { computed, nextTick, reactive, ref } from 'vue'
import dayjs from 'dayjs'
import { getDate } from '@/utils/utils.ts'
import { groupBy } from 'lodash-es'
@@ -107,39 +107,9 @@ function handleCommand(command: string | number | object, chat: Chat) {
if (chat && chat.id !== undefined) {
switch (command) {
case 'rename':
- ElMessageBox.prompt('Please enter new brief', 'Rename', {
- confirmButtonText: 'OK',
- cancelButtonText: 'Cancel',
- customStyle: { 'padding-left': 'unset', padding: 'var(--ed-messagebox-padding-primary)' },
- inputValue: chat.brief,
- inputValidator: (value: string) => {
- 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) {
+
+
+
+
+
+
+
+
+
+