|
@@ -1,5 +1,5 @@
|
|
|
<script setup>
|
|
|
-import { ref, unref, computed, onUnmounted, h } from 'vue';
|
|
|
+import { ref, unref, computed, provide, onUnmounted } from 'vue';
|
|
|
import { useMessage, NDatePicker, NTabs, NTab, NRadioGroup, NRadio, NCheckboxGroup, NCheckbox, NDataTable } from 'naive-ui';
|
|
|
import { BaseButton, RecodeCardItem, TheSubMenu, TheChatView, ChatWelcome, SvgIcon } from '@/components';
|
|
|
import { ChatAsk, ChatAnswer } from '@/components/Chat';
|
|
@@ -14,7 +14,7 @@ import dayjs from 'dayjs';
|
|
|
import { useInfinite, useScroll, useChat } from '@/composables';
|
|
|
|
|
|
const { recordList, isFetching, onScrolltolower, onReset } = useInfinite('/front/bigModel/qa/pageList', { module: 1 });
|
|
|
-const { scrollRef, scrollToBottom, scrollToBottomIfAtBottom } = useScroll();
|
|
|
+const { scrollRef, scrollToBottom, scrollToBottomIfAtBottom, scrollToTop } = useScroll();
|
|
|
const { chatDataSource, addChat, updateChat, clearChat, updateById } = useChat();
|
|
|
|
|
|
let controller = new AbortController();
|
|
@@ -42,10 +42,17 @@ const recordActive = ref(null);
|
|
|
|
|
|
const currenSessionId = ref(null);
|
|
|
|
|
|
+const catalogData = ref([]);
|
|
|
+
|
|
|
const isExistInHistory = computed(() => (recordList.value.findIndex(({ sessionId: sId }) => sId === unref(currenSessionId)) === -1));
|
|
|
const isChart = computed(() => tabActive.value == 'customDaily');
|
|
|
const chatDataSourceItem = computed(() => unref(chatDataSource)[chatDataSource.value.length - 1]);
|
|
|
|
|
|
+// 目录版块
|
|
|
+provide('updateCatalog', (val) => {
|
|
|
+ catalogData.value = val;
|
|
|
+})
|
|
|
+
|
|
|
const resetFormData = () => {
|
|
|
workOrderParams.value = {
|
|
|
timeBegin: null,
|
|
@@ -80,6 +87,8 @@ const handleCreateDialog = async () => {
|
|
|
if (!unref(chatDataSource).length) {
|
|
|
return message.info('已切换最新会话');
|
|
|
}
|
|
|
+
|
|
|
+ catalogData.value = [];
|
|
|
|
|
|
resetState();
|
|
|
}
|
|
@@ -114,7 +123,7 @@ const handleChatDetail = async ({ sessionId }) => {
|
|
|
|
|
|
resetFormData();
|
|
|
|
|
|
- scrollToBottom();
|
|
|
+ scrollToTop();
|
|
|
}
|
|
|
|
|
|
// 请求
|
|
@@ -330,6 +339,7 @@ const formatData = (data) => {
|
|
|
|
|
|
// 返回
|
|
|
const handleback = async () => {
|
|
|
+ catalogData.value = [];
|
|
|
clearInterval(timer);
|
|
|
await chatApi.getStopChatStream(currenSessionId.value);
|
|
|
resetState();
|
|
@@ -338,6 +348,7 @@ const handleback = async () => {
|
|
|
// 删除历史对话
|
|
|
const handeChatDelete = async (id) => {
|
|
|
await chatApi.deleteHistory(id);
|
|
|
+ catalogData.value = [];
|
|
|
onReset();
|
|
|
clearChat();
|
|
|
message.success('删除成功');
|
|
@@ -390,12 +401,17 @@ onUnmounted(() => {
|
|
|
</div>
|
|
|
</TheSubMenu>
|
|
|
|
|
|
- <TheChatView ref="scrollRef" :is-footer="false" :is-back-btn="!!chatDataSource.length" @on-click-back="handleback">
|
|
|
+ <TheChatView ref="scrollRef" :is-footer="false" :is-back-btn="!!chatDataSource.length" @on-click-back="handleback" :catalog-data="catalogData">
|
|
|
+
|
|
|
+ <template #catalog>
|
|
|
+ <ChatTree :data="catalogData"></ChatTree>
|
|
|
+ </template>
|
|
|
+
|
|
|
<ChatWelcome title="您好,我是LibraAI智慧工单助手" :sub-title="[
|
|
|
'基于大语言模型的智能工单分析助手,可以为您实现数据分析及数据解读',
|
|
|
'选择日期并为您生成日报分析'
|
|
|
]" v-if="!chatDataSource.length" />
|
|
|
-
|
|
|
+
|
|
|
<div class="conversation-item" v-show="chatDataSource.length">
|
|
|
<div v-for="item in chatDataSource" :key="item.sessionId">
|
|
|
<ChatAsk :content="item.showVal" :sessionId="item.sessionId"></ChatAsk>
|