余尚辉 10 meses atrás
pai
commit
5e10fe003b

+ 25 - 47
src/views/answer/AnswerView.vue

@@ -6,7 +6,7 @@ import { BaseButton, RecodeCardItem, TheSubMenu, TheChatView, ChatWelcome } from
 import { ChatAsk, ChatAnswer, ChatInput } from '@/components/Chat';
 import { chatApi } from '@/api/chat';
 
-import {useInfinite, useScroll, useChat, useRecommend} from '@/composables';
+import { useInfinite, useScroll, useChat, useRecommend } from '@/composables';
 
 const ANSWER_ID_KEY = '@@id@@';
 
@@ -17,7 +17,7 @@ const chatStore = useChatStore();
 const { recordList, isFetching, onScrolltolower, onReset } = useInfinite('/front/bigModel/qa/pageList', { module: 0 });
 const { scrollRef, scrollToBottom, scrollToBottomIfAtBottom } = useScroll();
 const { chatDataSource, addChat, updateChat, clearChat, updateById } = useChat();
-const { recommendList } = useRecommend({type: 0});
+const { recommendList } = useRecommend({ type: 0 });
 
 const message = useMessage();
 
@@ -63,7 +63,7 @@ const handleChatDetail = async ({ sessionId }) => {
 
   const { data } = await chatApi.getAnswerHistoryDetail({ sessionId });
 
-  chatDataSource.value = data.map(item => ({ ...item, loading: false,  }));
+  chatDataSource.value = data.map(item => ({ ...item, loading: false, }));
   currenSessionId.value = sessionId;
 
   scrollToBottom();
@@ -85,7 +85,7 @@ const onRegenerate = async ({ question, realQuestion }) => {
     onDownloadProgress: ({ event }) => {
       const xhr = event.target;
       const { responseText } = xhr;
-      const [ answer ] = responseText.split(ANSWER_ID_KEY);
+      const [answer] = responseText.split(ANSWER_ID_KEY);
 
       updateChat({
         sessionId,
@@ -100,9 +100,9 @@ const onRegenerate = async ({ question, realQuestion }) => {
   }
 
   try {
-    const { data  } = await chatApi.getChatStream(params);
- 
-    const [ answer, id ] = data.split(ANSWER_ID_KEY);
+    const { data } = await chatApi.getChatStream(params);
+
+    const [answer, id] = data.split(ANSWER_ID_KEY);
 
     updateChat({
       id,
@@ -112,10 +112,10 @@ const onRegenerate = async ({ question, realQuestion }) => {
       loading: false,
       delayLoading: false
     })
-    
+
     scrollToBottomIfAtBottom();
   }
-  catch (error){
+  catch (error) {
     console.log("取消了请求 - catch", error);
   }
   finally {
@@ -126,12 +126,12 @@ const onRegenerate = async ({ question, realQuestion }) => {
 // 提交问题
 const handleSubmit = async (question, realQuestion = '') => {
   // 用于模拟 - 内容生成前置等待状态
-  
+
   if (unref(isExistInHistory)) {
     const { data: sessionId } = await chatApi.getChatSessionTag();
     currenSessionId.value = sessionId;
   }
-  
+
   isLoading.value = true;
 
   addChat({
@@ -150,7 +150,7 @@ const handleSubmit = async (question, realQuestion = '') => {
 
 // 处理推荐问题
 const handleWelcomeRecommend = ({ question, realQuestion }) => {
-  handleSubmit( question, realQuestion );
+  handleSubmit(question, realQuestion);
 }
 
 // 删除历史对话
@@ -163,7 +163,7 @@ const handeChatDelete = async (id) => {
 
 onMounted(() => {
   const question = chatStore.chatQuestion;
-  if ( Object.keys(question).length ) {
+  if (Object.keys(question).length) {
     handleWelcomeRecommend(chatStore.chatQuestion);
     chatStore.clearChatQuestion();
   }
@@ -184,52 +184,30 @@ onUnmounted(() => {
       </template>
 
       <div class="pr-[4px] text-[#5e5e5e]">
-        <RecodeCardItem
-          v-for="item, index in recordList"
-          :key="item.sessionId + index"
-          :title="item.showVal"
-          :time="item.createTime"
-          :data-item="item"
-          :class="{'recode-card-item_active': recordActive === item.sessionId}"
-          @on-click="handleChatDetail"
-          @on-delete="handeChatDelete"
-        />
+        <RecodeCardItem v-for="item, index in recordList" :key="item.sessionId + index" :title="item.showVal"
+          :time="item.createTime" :data-item="item"
+          :class="{ 'recode-card-item_active': recordActive === item.sessionId }" @on-click="handleChatDetail"
+          @on-delete="handeChatDelete" />
       </div>
 
     </TheSubMenu>
 
     <TheChatView ref="scrollRef">
-      <ChatWelcome title="您好,我是LibraAI专家问答" card-title="您可以试着问我:"
-        :sub-title="[
-          '期待与您一同规划和完成未来的工作。有任何重点或需讨论的事项,随时告诉我'
-        ]" 
-        :card-content="recommendList"
-        v-if="!chatDataSource.length"
-        @on-click="handleWelcomeRecommend"
-      />
-      
+      <ChatWelcome title="您好,我是LibraAI专家问答" card-title="您可以试着问我:" :sub-title="[
+        '期待与您一同规划和完成未来的工作。有任何重点或需讨论的事项,随时告诉我'
+      ]" :card-content="recommendList" v-if="!chatDataSource.length" @on-click="handleWelcomeRecommend" />
+
       <div class="conversation-item" v-if="chatDataSource.length">
         <template v-for="item in chatDataSource" :key="item.id">
           <ChatAsk :content="item.question" :sessionId="item.sessionId"></ChatAsk>
-          <ChatAnswer
-            :id="item.id"
-            :content="item.answer"
-            :loading="item.loading"
-            :delay-loading="item.delayLoading"
-            :isSatisfied="item.isSatisfied"
-            @on-click-icon=" params => updateById(params)"
-          ></ChatAnswer>
+          <ChatAnswer :id="item.id" :content="item.answer" :loading="item.loading" :delay-loading="item.delayLoading"
+            :isSatisfied="item.isSatisfied" @on-click-icon="params => updateById(params)"></ChatAnswer>
         </template>
       </div>
 
       <template #footer>
-        <ChatInput
-          ref="inputRef"
-          v-model:loading="isLoading"
-          v-model:switch="switchActive"
-          @on-click="handleSubmit"
-          @on-enter="handleSubmit"
-        ></ChatInput>
+        <ChatInput ref="inputRef" v-model:loading="isLoading" v-model:switch="switchActive" @on-click="handleSubmit"
+          @on-enter="handleSubmit"></ChatInput>
       </template>
     </TheChatView>
   </section>

+ 1 - 0
src/views/screen/components/dataBox.vue

@@ -45,6 +45,7 @@ const content = '① 因房地产市场并不十分活跃和顺利运转,因
       .html-box {
         height: 22.6rem;
         overflow-y: auto;
+        font-size: 1.4rem;
       }
 
       .markdown-body {

+ 1 - 2
src/views/screen/components/shuizhi.vue

@@ -68,7 +68,7 @@ defineProps({
   }
 
   :deep(.main) {
-    padding: 1.8rem 4.8rem 1.6rem;
+    padding: 1.8rem 1.8rem 1.6rem;
 
     .box-wrap {
       display: grid;
@@ -85,7 +85,6 @@ defineProps({
       .cicle {
         height: 5.2rem;
         margin-bottom: 1rem;
-        width: 100%;
       }
 
       .name {

+ 4 - 4
src/views/user/index.vue

@@ -54,7 +54,7 @@ getInfo()
   }
 
   .chat-main {
-    height: calc(100vh - 175px) !important;
+    height: calc(100vh - 17.5rem) !important;
   }
 
   .m-auto {
@@ -83,9 +83,9 @@ getInfo()
   &-box {
     background: #fff;
     border-radius: 8px;
-    margin-top: 24px;
-    padding: 20px 24px;
-    height: calc(100vh - 260px);
+    margin-top: 2.4rem;
+    padding: 2rem 2.4rem;
+    height: calc(100vh - 36rem);
 
     .tab {
       padding: 5px 16px;