gerson
2024-07-07 d5f17f079d4af2a173015dc86a4d6d472731fac6
src/components/chat/Chat.vue
@@ -57,7 +57,7 @@
import { GetHistoryAnswer, QueryHistoryDetail, QuestionAi, SetHistoryAnswerState, getQuestionProcess } from '/@/api/ai/chat';
import PlayBar from '/@/components/chat/components/playBar/PlayBar.vue';
import router from '/@/router';
import { activeChatRoom, activeLLMId, activeRoomId, activeSampleId, activeSectionAId } from '/@/stores/chatRoom';
import { activeChatRoom, activeLLMId, activeRoomId, activeSampleId, activeSectionAId, roomConfig } from '/@/stores/chatRoom';
import { v4 as uuidv4 } from 'uuid';
let isTalking = ref(false);
@@ -159,6 +159,7 @@
      // FIXME: 暂时这样
      section_a_id: currentSectionId,
      history_group_id: currentRouteId,
      raw_mode: roomConfig.value?.[currentRouteId]?.isAnswerByLLM ?? false,
   } as any;
   if (currentSampleId) {
@@ -191,14 +192,16 @@
let currentSampleId = null;
let currentLLMId = null;
const getAnswerById = async (historyId: string) => {
   return await GetHistoryAnswer({
      history_id: historyId,
   });
};
const sendChatMessage = async (content: ChatContent = messageContent.value) => {
   if (!messageContent.value?.values) return;
   if (messageList.value.length===0) {
   if (messageList.value.length === 0) {
      if (activeSampleId.value) {
         currentSampleId = activeSampleId.value;
      }
@@ -243,7 +246,6 @@
      messageList.value.at(-1).content = content;
   }
};
onMounted(async () => {
   const res = await QueryHistoryDetail({
@@ -297,10 +299,10 @@
   }
);
onActivated(()=>{
onActivated(() => {
   if (forbidScroll) return;
   nextTick(() => scrollToBottom());
})
});
//#region ====================== 聊天内容操作 ======================