【解决todo】AI Chat 增加清理 message
This commit is contained in:
parent
d603f1edd0
commit
561d60bccd
@ -60,8 +60,14 @@ export const ChatMessageApi = {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 发送 send 消息
|
// 删除消息
|
||||||
delete: async (id: string) => {
|
delete: async (id: string) => {
|
||||||
return await request.delete({ url: `/ai/chat/message/delete?id=${id}` })
|
return await request.delete({ url: `/ai/chat/message/delete?id=${id}` })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 删除消息 - 对话所有消息
|
||||||
|
deleteByConversationId: async (conversationId: string) => {
|
||||||
|
return await request.delete({ url: `/ai/chat/message/delete-by-conversation-id?conversationId=${conversationId}` })
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
1
src/assets/ai/clear.svg
Normal file
1
src/assets/ai/clear.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1716342375293" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2604" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M899.1 869.6l-53-305.6H864c14.4 0 26-11.6 26-26V346c0-14.4-11.6-26-26-26H618V138c0-14.4-11.6-26-26-26H432c-14.4 0-26 11.6-26 26v182H160c-14.4 0-26 11.6-26 26v192c0 14.4 11.6 26 26 26h17.9l-53 305.6c-0.3 1.5-0.4 3-0.4 4.4 0 14.4 11.6 26 26 26h723c1.5 0 3-0.1 4.4-0.4 14.2-2.4 23.7-15.9 21.2-30zM204 390h272V182h72v208h272v104H204V390z m468 440V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H416V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H202.8l45.1-260H776l45.1 260H672z" p-id="2605" fill="#8a8a8a"></path></svg>
|
After Width: | Height: | Size: 844 B |
@ -19,7 +19,9 @@
|
|||||||
<span v-html="activeConversation?.modelName"></span>
|
<span v-html="activeConversation?.modelName"></span>
|
||||||
<Icon icon="ep:setting" style="margin-left: 10px"/>
|
<Icon icon="ep:setting" style="margin-left: 10px"/>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="small" :icon="User" class="btn" />
|
<el-button size="small" class="btn" @click="handlerMessageClear">
|
||||||
|
<img src="@/assets/ai/clear.svg" style="height: 14px;" />
|
||||||
|
</el-button>
|
||||||
<el-button size="small" :icon="Download" class="btn" />
|
<el-button size="small" :icon="Download" class="btn" />
|
||||||
<el-button size="small" :icon="Top" class="btn" @click="handlerGoTop" />
|
<el-button size="small" :icon="Top" class="btn" @click="handlerGoTop" />
|
||||||
</div>
|
</div>
|
||||||
@ -93,7 +95,7 @@ import {ChatMessageApi, ChatMessageVO} from '@/api/ai/chat/message'
|
|||||||
import {ChatConversationApi, ChatConversationVO} from '@/api/ai/chat/conversation'
|
import {ChatConversationApi, ChatConversationVO} from '@/api/ai/chat/conversation'
|
||||||
import {useClipboard} from '@vueuse/core'
|
import {useClipboard} from '@vueuse/core'
|
||||||
import ChatConversationUpdateForm from "@/views/ai/chat/components/ChatConversationUpdateForm.vue";
|
import ChatConversationUpdateForm from "@/views/ai/chat/components/ChatConversationUpdateForm.vue";
|
||||||
import {Download, Top, User} from "@element-plus/icons-vue";
|
import {Download, Top} from "@element-plus/icons-vue";
|
||||||
|
|
||||||
const route = useRoute() // 路由
|
const route = useRoute() // 路由
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
@ -488,6 +490,22 @@ const handlerGoTop = async () => {
|
|||||||
await messageRef.value.handlerGoTop()
|
await messageRef.value.handlerGoTop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* message 清除
|
||||||
|
*/
|
||||||
|
const handlerMessageClear = async () => {
|
||||||
|
if (!activeConversationId.value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 确认提示
|
||||||
|
await message.delConfirm("确认清空对话消息?")
|
||||||
|
// 清空对话
|
||||||
|
await ChatMessageApi.deleteByConversationId(activeConversationId.value as string)
|
||||||
|
// 刷新 message 列表
|
||||||
|
await getMessageList()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** 初始化 **/
|
/** 初始化 **/
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user