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) +} + /** * 回到顶部 */