| | |
| | | <template> |
| | | <div ref="messageContainer" class="h-100%"> |
| | | <div ref="messageContainer" class="h-100% relative"> |
| | | <div class="chat-list" v-for="(item, index) in list" :key="index"> |
| | | <!-- 靠左 message:system、assistant 类型 --> |
| | | <div class="left-message message-item" v-if="item.type !== 'user'"> |
| | |
| | | import MarkdownView from '@/components/MarkdownView/index.vue' |
| | | import { useClipboard } from '@vueuse/core' |
| | | import { ArrowDownBold} from '@element-plus/icons-vue' |
| | | import { ChatMessageApi, ChatMessageVO } from '@/api/ai/chat/message' |
| | | import { ChatMessageVO } from '@/api/ai/chat/message' |
| | | import { ChatConversationVO } from '@/api/ai/chat/conversation' |
| | | import { useUserStore } from '@/store/modules/user' |
| | | import {formatDate} from "@/utils/formatTime"; |
| | | |
| | | const message = useMessage() // 消息弹窗 |
| | | const { copy } = useClipboard() // 初始化 copy 到粘贴板 |
| | |
| | | scrollContainer.scrollTop = 0 |
| | | } |
| | | |
| | | defineExpose({ scrollToBottom, handlerGoTop }) // 提供方法给 parent 调用 |
| | | defineExpose({ scrollToBottom, handlerGoTop, handleGoBottom }) // 提供方法给 parent 调用 |
| | | |
| | | // ============ 处理消息操作 ============== |
| | | |
| | | /** 复制 */ |
| | | const copyContent = async (content) => { |
| | | await copy(content) |
| | | message.success('复制成功!') |
| | | } |
| | | |
| | | /** 删除 */ |
| | | const onDelete = async (id) => { |
| | | // 删除 message |
| | | await ChatMessageApi.deleteChatMessage(id) |
| | | message.success('删除成功!') |
| | | // 回调 |
| | | emits('onDeleteSuccess') |
| | | } |
| | | |
| | | /** 刷新 */ |
| | | const onRefresh = async (message: ChatMessageVO) => { |