|
@@ -366,12 +366,15 @@ const selectConversation = async (id: number) => {
|
|
|
}
|
|
|
|
|
|
// 删除会话
|
|
|
-const deleteConversation = async (id: number) => {
|
|
|
- const res = assist.session
|
|
|
+const currentDeletingConversation = ref(-1)
|
|
|
+const { loading: loadingDeleteConversation, doLoading: deleteConversation } = useLoading(async (id: number) => {
|
|
|
+ currentDeletingConversation.value = id
|
|
|
+ const res = await assist.session
|
|
|
.del([id])
|
|
|
- .then(() => {})
|
|
|
- .catch(() => undefined)
|
|
|
- if (res === undefined) {
|
|
|
+ .then(() => true)
|
|
|
+ .catch(() => false)
|
|
|
+ .finally(() => (currentDeletingConversation.value = -1))
|
|
|
+ if (!res) {
|
|
|
return
|
|
|
}
|
|
|
ElMessage.success('删除成功')
|
|
@@ -380,7 +383,7 @@ const deleteConversation = async (id: number) => {
|
|
|
}
|
|
|
await nextTick()
|
|
|
await doLoadConversations()
|
|
|
-}
|
|
|
+})
|
|
|
|
|
|
// 创建新对话
|
|
|
const { loading: creatingConversation, doLoading: createConversationAndSetItActive } = useLoading(async () => {
|
|
@@ -420,7 +423,7 @@ const editSummary = (id: number) => {
|
|
|
}
|
|
|
}
|
|
|
// 确认编辑
|
|
|
-const { doLoading: confirmEdit,loading: loadingConfirmEdit } = useLoading(async (id: number) => {
|
|
|
+const { doLoading: confirmEdit, loading: loadingConfirmEdit } = useLoading(async (id: number) => {
|
|
|
const conversation = conversations.value.find((conv) => conv.session_id === id)
|
|
|
if (conversation && editingTitle.value.trim()) {
|
|
|
const edit = await assist.session
|
|
@@ -511,6 +514,7 @@ const redirectToModelManager = () => router.push('manage/model')
|
|
|
type="danger"
|
|
|
size="small"
|
|
|
:icon="Delete"
|
|
|
+ :loading="loadingDeleteConversation && currentDeletingConversation == conv.session_id"
|
|
|
@click.stop="deleteConversation(conv.session_id)"
|
|
|
class="action-btn delete-btn"
|
|
|
title="删除对话"
|
|
@@ -524,17 +528,14 @@ const redirectToModelManager = () => router.push('manage/model')
|
|
|
<el-button
|
|
|
type="success"
|
|
|
size="small"
|
|
|
- @click.stop="confirmEdit(conv.session_id)"
|
|
|
+ :icon="Check"
|
|
|
:loading="loadingConfirmEdit"
|
|
|
+ @click.stop="confirmEdit(conv.session_id)"
|
|
|
class="action-btn confirm-btn"
|
|
|
title="确认修改"
|
|
|
plain
|
|
|
circle
|
|
|
- >
|
|
|
- <el-icon>
|
|
|
- <Check />
|
|
|
- </el-icon>
|
|
|
- </el-button>
|
|
|
+ />
|
|
|
<el-button
|
|
|
type="info"
|
|
|
size="small"
|