From 03c6a6ce59361cfcf6850eedc37c5845487077c1 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Fri, 24 May 2024 10:32:08 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=A7=A3=E5=86=B3todo=E3=80=91Chat=20?= =?UTF-8?q?message=20=E5=A2=9E=E5=8A=A0=E5=88=B7=E6=96=B0=E5=92=8C?= =?UTF-8?q?=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/chat/Message.vue | 24 ++++++++++++++++++++++-- src/views/ai/chat/index.vue | 18 +++++++++++++++++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/views/ai/chat/Message.vue b/src/views/ai/chat/Message.vue index 1a33b4bd..20277562 100644 --- a/src/views/ai/chat/Message.vue +++ b/src/views/ai/chat/Message.vue @@ -43,6 +43,12 @@ + + + + + + @@ -59,7 +65,7 @@ import MarkdownView from "@/components/MarkdownView/index.vue"; import {ChatMessageApi, ChatMessageVO} from "@/api/ai/chat/message"; import {useClipboard} from "@vueuse/core"; import {PropType} from "vue"; -import {ArrowDownBold} from "@element-plus/icons-vue"; +import {ArrowDownBold, Edit, RefreshRight} from "@element-plus/icons-vue"; const {copy} = useClipboard() // 初始化 copy 到粘贴板 // 判断 消息列表 滚动的位置(用于判断是否需要滚动到消息最下方) @@ -125,6 +131,20 @@ const onDelete = async (id) => { emits('onDeleteSuccess') } +/** + * 刷新 + */ +const onRefresh = async (message: ChatMessageVO) => { + emits('onRefresh', message) +} + +/** + * 编辑 + */ +const onEdit = async (message: ChatMessageVO) => { + emits('onEdit', message) +} + /** * 回到底部 */ @@ -151,7 +171,7 @@ watch(list, async (newValue, oldValue) => { defineExpose({scrollToBottom, handlerGoTop}) // 定义 emits -const emits = defineEmits(['onDeleteSuccess']) +const emits = defineEmits(['onDeleteSuccess', 'onRefresh', 'onEdit']) // onMounted onMounted(async () => { diff --git a/src/views/ai/chat/index.vue b/src/views/ai/chat/index.vue index a1366272..ac97e1ec 100644 --- a/src/views/ai/chat/index.vue +++ b/src/views/ai/chat/index.vue @@ -39,7 +39,9 @@ + @on-delete-success="handlerMessageDelete" + @on-edit="handlerMessageEdit" + @on-refresh="handlerMessageRefresh"/> @@ -513,6 +515,20 @@ const handlerMessageDelete = async () => { await getMessageList() } +/** + * 编辑 message + */ +const handlerMessageEdit = async (message: ChatMessageVO) => { + prompt.value = message.content +} + +/** + * 编辑 message + */ +const handlerMessageRefresh = async (message: ChatMessageVO) => { + await doSend(message.content) +} + /** * 回到顶部 */