wujingjing
2024-11-22 7385b6c2b3ba3b4a1a2e6482db9ff63be0c235c8
src/components/chat/Chat.vue
@@ -118,18 +118,18 @@
                                       <p class="text-red-500">
                                          {{ item.content.errMsg }}
                                       </p>
                                       <div class="mt-5 flex items-center" v-if="showFixQuestion(item)">
                                          <div class="text-gray-600 flex-0">
                                             {{ item.content.origin.err_json.fix_question.title + ':' }}
                                       <div class="mt-3 flex" v-if="showFixQuestion(item)">
                                          <div class="text-gray-600 flex-0 mb-auto py-3">
                                             {{ '猜你想问:' }}
                                          </div>
                                          <div class="ml-1 space-x-2 inline-flex flex-wrap">
                                          <div class="flex-auto space-x-2 space-y-1 inline-flex flex-wrap items-center">
                                             <div
                                                v-for="fixItem in item.content.origin.err_json.fix_question?.values"
                                                v-for="fixItem in item.content.origin?.sample_question"
                                                :key="fixItem"
                                                class="bg-gray-200 p-3 hover:bg-[#c5e0ff] hover:text-[#1c86ff] cursor-pointer rounded-lg"
                                                class="bg-gray-200 p-3 hover:bg-[#c5e0ff] hover:text-[#1c86ff] cursor-pointer rounded-lg first-of-type:ml-2 first-of-type:mt-1"
                                                @click="fixQuestionClick(fixItem, item.content.origin)"
                                             >
                                                {{ fixItem.title }}
                                                {{ fixItem }}
                                             </div>
                                          </div>
                                       </div>
@@ -239,7 +239,7 @@
                     <span class="text-[15px]"> 分享的对话不存在或已失效 </span>
                  </template>
               </el-empty>
               <div v-if="showAskMore && !isShareCheck" class="ml-4 mt-5 text-sm pb-10">
               <div v-if="showAskMore" class="ml-4 mt-5 text-sm pb-10">
                  <div class="text-gray-600 mb-5">你可以继续问我:</div>
                  <div class="space-y-2 inline-flex flex-col">
                     <div
@@ -276,7 +276,6 @@
<script setup lang="ts">
import { ElMessage } from 'element-plus';
import _ from 'lodash';
import moment from 'moment';
import { computed, onActivated, onMounted, ref } from 'vue';
import useClipboard from 'vue-clipboard3';
@@ -290,7 +289,7 @@
import { extCallQuery, questionStreamByPost, shareChatHistoryByPost } from '/@/api/ai/chat';
import PlayBar from '/@/components/chat/components/playBar/PlayBar.vue';
import CustomDrawer from '/@/components/drawer/CustomDrawer.vue';
import { SERVE_URL, SHARE_URL } from '/@/constants';
import { SHARE_URL } from '/@/constants';
import { Logger } from '/@/model/logger/Logger';
import router from '/@/router';
import {
@@ -304,9 +303,11 @@
   isSharePage,
   roomConfig,
} from '/@/stores/chatRoom';
import emitter from '/@/utils/mitt';
import { ErrorCode } from '/@/utils/request';
import { toMyFixed } from '/@/utils/util';
import emitter from '/@/utils/mitt';
import { findLast, orderBy } from 'lodash-es';
import { getCurrentPosition } from '/@/utils/brower';
const chatWidth = '75%';
const voicePageIsShow = ref(false);
let isTalking = ref(false);
@@ -379,7 +380,7 @@
         };
         break;
   }
   content.askMoreList = _.orderBy(res.context_history, [(item) => Number(item.radio)], ['desc']);
   content.askMoreList = orderBy(res.context_history, [(item) => Number(item.radio)], ['desc']);
   content.errCode = res?.err_code;
   content.errMsg = res?.json_msg;
   content.origin = res;
@@ -422,7 +423,7 @@
const DEFAULT_SECTION_A_ID = 'knowledge_base';
let questionRes = null;
let position = null;
let finalCalcSectionAId = null;
const questionAi = async (text) => {
   let judgeParams = null;
@@ -446,7 +447,7 @@
      currentSectionAId = activeSectionAId.value;
      activeSectionAId.value = '';
   } else {
      const lastSectionAItem = _.findLast(
      const lastSectionAItem = findLast(
         computedMessageList.value as any,
         (item) => item.role === RoleEnum.assistant && !!item.sectionAId
      );
@@ -463,6 +464,12 @@
      raw_mode: roomConfig.value?.[currentRouteId]?.isAnswerByLLM ?? false,
      ...judgeParams,
   } as any;
   if (position) {
      const longitude = position.coords.longitude;
      const latitude = position.coords.latitude;
      params.cur_pos = [longitude, latitude].join(',');
   }
   if (activeGroupType.value) {
      params.group_type = activeGroupType.value;
@@ -547,6 +554,7 @@
      ElMessage.warning('ai 正在回复中,请稍后尝试提问');
      return;
   }
   position = position ?? (await getCurrentPosition());
   const isNewChat = messageList.value.length === 0;
   if (isNewChat) {