| | |
| | | </div> |
| | | <!-- 操作 --> |
| | | <div |
| | | v-if="item.role === RoleEnum.user && item.content?.values && chatDisplayMode === 'default' && !isShareCheck" |
| | | v-if="item.role === RoleEnum.user && item.content?.values && !isSharePage && !isShareCheck" |
| | | class="absolute flex items-center right-0 mr-4 space-x-2" |
| | | > |
| | | <el-tooltip effect="dark" content="复制" placement="top"> |
| | |
| | | </el-tooltip> |
| | | </div> |
| | | <div |
| | | v-if="item.role === RoleEnum.assistant && item.content?.values && chatDisplayMode === 'default' && !isShareCheck" |
| | | v-if="item.role === RoleEnum.assistant && item.content?.values && !isSharePage && !isShareCheck" |
| | | class="absolute flex items-center right-0 mr-4 mt-2 space-x-2" |
| | | > |
| | | <div |
| | |
| | | |
| | | <div |
| | | class="sticky bottom-0 w-full p-6 bg-[rgb(247,248,250)] flex justify-center" |
| | | v-if="chatDisplayMode === 'default' && !isShareCheck" |
| | | v-if="!isSharePage && !isShareCheck" |
| | | > |
| | | <PlayBar |
| | | v-model:voicePageIsShow="voicePageIsShow" |
| | |
| | | :setCommonQuestionInfo="setCommonQuestionInfo" |
| | | ></PlayBar> |
| | | </div> |
| | | <div class="sticky bottom-0 w-full p-6 bg-[rgb(247,248,250)] flex justify-center" v-if="isShareCheck"> |
| | | </div> |
| | | <div class="sticky bottom-0 w-full p-6 bg-[rgb(247,248,250)] flex justify-center" v-if="isShareCheck"></div> |
| | | </div> |
| | | <CustomDrawer v-model:isShow="drawerIsShow" @updateChatInput="updateChatInput" /> |
| | | </div> |
| | |
| | | import FeedbackPanel from './components/FeedbackPanel.vue'; |
| | | import { useAssistantContentOpt } from './hooks/useAssistantContentOpt'; |
| | | import { useQueryProcess } from './hooks/useQueryProcess'; |
| | | import { convertProcessItem, useScrollLoad } from './hooks/useScrollLoad'; |
| | | import { convertProcessItem, convertProcessToStep, useScrollLoad } from './hooks/useScrollLoad'; |
| | | import { useScrollToBottom } from './hooks/useScrollToBottom'; |
| | | import type { ChatContent, StepItem } from './model/types'; |
| | | import { AnswerState, AnswerType, RoleEnum, answerTypeMapCom, roleImageMap, stepEnumMap, type ChatMessage } from './model/types'; |
| | | import { extCallQuery, questionStreamByPost, shareChatHistoryByPost } from '/@/api/ai/chat'; |
| | | import { extCallQuery, getShareChatJsonByPost, questionStreamByPost, shareChatHistoryByPost } from '/@/api/ai/chat'; |
| | | import PlayBar from '/@/components/chat/components/playBar/PlayBar.vue'; |
| | | import CustomDrawer from '/@/components/drawer/CustomDrawer.vue'; |
| | | import { Logger } from '/@/model/logger/Logger'; |
| | |
| | | activeRoomId, |
| | | activeSampleId, |
| | | activeSectionAId, |
| | | chatDisplayMode, |
| | | isSharePage, |
| | | getRoomConfig, |
| | | roomConfig, |
| | | } from '/@/stores/chatRoom'; |
| | |
| | | import { ElMessage } from 'element-plus'; |
| | | import useClipboard from 'vue-clipboard3'; |
| | | import { toMyFixed, toPercent } from '/@/utils/util'; |
| | | import { SERVE_URL } from '/@/constants'; |
| | | const chatWidth = '75%'; |
| | | const voicePageIsShow = ref(false); |
| | | let isTalking = ref(false); |
| | |
| | | messageList.value.at(-1).createTime = currentTime; |
| | | } |
| | | }; |
| | | |
| | | |
| | | const { loadRangeData, onChatListScroll, moreIsLoading, nextUserMsgEndIndex } = useScrollLoad({ |
| | | isSharePage: isSharePage, |
| | | container: chatListDom, |
| | | historyGroupId: currentRouteId, |
| | | messageList, |
| | |
| | | |
| | | const chatListLoading = ref(false); |
| | | |
| | | const { scrollToBottom } = useScrollToBottom({ |
| | | const { scrollToBottom, scrollToTop } = useScrollToBottom({ |
| | | chatListDom: chatListDom, |
| | | }); |
| | | |
| | | onMounted(async () => { |
| | | |
| | | messageList.value = []; |
| | | // 加载初始数据 |
| | | chatListLoading.value = true; |
| | |
| | | if (messageList.value.length === 0) { |
| | | messageContent.value = { |
| | | type: AnswerType.Text, |
| | | values: activeChatRoom.value.title, |
| | | values: activeChatRoom.value?.title, |
| | | }; |
| | | |
| | | sendChatMessage(); |
| | | } else { |
| | | if (isSharePage.value) { |
| | | setTimeout(() => { |
| | | // 滚动到顶部 |
| | | scrollToTop(); |
| | | }, 300); |
| | | } else { |
| | | setTimeout(() => { |
| | | // 初始状态滚一下 |
| | |
| | | chatListDom.value.addEventListener('scroll', onChatListScroll); |
| | | }, 300); |
| | | }, 300); |
| | | } |
| | | } |
| | | }); |
| | | //#region ====================== 关联查询 ====================== |
| | |
| | | // isShareCheck.value = true; |
| | | |
| | | const url = await generateShareUrl(); |
| | | ElMessage.success('已复制分享链接') |
| | | toClipboard(url) |
| | | ElMessage.success('已复制分享链接'); |
| | | toClipboard(url); |
| | | }; |
| | | |
| | | const shareCheckChange = (isChecked: boolean, item: ChatMessage) => { |
| | |
| | | if(!res.values) return; |
| | | const shareId = Object.values(res.values)[0]; |
| | | if(!shareId) return; |
| | | |
| | | return `${shareId}` |
| | | const relativeHref = router.resolve(`share?id=${shareId}`).href; |
| | | const shareLink = `${SERVE_URL}${relativeHref}`; |
| | | return shareLink; |
| | | }; |
| | | |
| | | //#endregion |