wujingjing
2024-12-14 1476d27514874e9c95002451a81878bd9bec8382
src/components/chat/Chat.vue
@@ -61,6 +61,7 @@
                                    <!-- #region ====================== 过程输出 ======================-->
                                    <el-steps v-show="item.stepIsShow" class="mt-3" direction="vertical" :active="activeStep">
                                       <el-step
                                          v-for="(subItem, index) in item.stepList"
                                          :title="subItem.title"
@@ -73,10 +74,26 @@
                                             <span class="ywifont ywicon-loading1 animate-spin !text-[24px]"></span>
                                          </template>
                                          <template #title>
                                             <span class=""
                                                >{{ subItem.title
                                                }}<span v-if="subItem.ms" class="text-green-600">{{ `(${subItem.ms})` }}</span></span
                                             <span class="">
                                                {{ subItem.title }}
                                                <span v-if="subItem.ms" class="text-green-600">{{ `(${subItem.ms})` }}</span></span
                                             >
                                          </template>
                                          <template #description v-if="subItem?.subStep?.length > 0">
                                             <div class="my-1 flex flex-col gap-1 text-[14px]">
                                                <component
                                                   :key="`${item.historyId}-${index + 1}-${multiChatIndex + 1}`"
                                                   v-for="(multiChatItem, multiChatIndex) in subItem.subStep"
                                                   :order="`${index + 1}-${multiChatIndex + 1}`"
                                                   :item="multiChatItem"
                                                   :is="multiChatTypeMapCom[multiChatItem.type]"
                                                   :disabled="!(index + 1 === item.stepList.length && isTalking && msgIndex === computedMessageList.length - 1)"
                                                />
                                             </div>
                                          </template>
                                       </el-step>
                                    </el-steps>
@@ -279,8 +296,11 @@
               </div>
            </div>
         </div>
         <div class="absolute right-28 bottom-40 " v-if="!isBottom">
            <div class="flex items-center justify-center size-[38px]  cursor-pointer hover:text-[#0284ff] border rounded-full hover:bg-[#f6f7f9] shadow bg-white" @click="scrollToBottom">
         <div class="absolute right-28 bottom-40" v-if="!isBottom">
            <div
               class="flex items-center justify-center size-[38px] cursor-pointer hover:text-[#0284ff] border rounded-full hover:bg-[#f6f7f9] shadow bg-white"
               @click="scrollToBottom"
            >
               <i class="ywifont ywicon-xiangxiajiantou !text-[20px]" />
            </div>
         </div>
@@ -346,12 +366,15 @@
   isSharePage,
   roomConfig,
} from '/@/stores/chatRoom';
import { multiChatTypeMapCom } from '/@/components/chat/chatComponents/multiChat';
import emitter from '/@/utils/mitt';
import { ErrorCode } from '/@/utils/request';
import { toMyFixed } from '/@/utils/util';
const chatWidth = '75%';
const voicePageIsShow = ref(false);
let isTalking = ref(false);
let messageContent = ref<ChatContent>({
   type: AnswerType.Text,
   values: '',
@@ -547,6 +570,20 @@
               computedMessageList.value.at(-1).conclusion = chunkRes.value;
               chunkRes.value = '分析结束';
            }
            if (chunkRes.mode === 'question') {
               const stepList = computedMessageList.value.at(-1).stepList;
               const lastStepItem = stepList.at(-1);
               if (!lastStepItem.subStep) {
                  lastStepItem.subStep = [];
               }
               lastStepItem.subStep.push({
                  type: chunkRes.value.type,
                  data: chunkRes.value,
               });
               scrollToBottom();
               return;
            }
            const stepList = computedMessageList.value.at(-1).stepList;
            const currentTimeStamp = new Date().getTime();
            const ms = toMyFixed(currentTimeStamp - lastTimestamp, 2) + ' ms';
@@ -560,10 +597,13 @@
               stepList.at(-1).ms = ms;
            }
            lastTimestamp = currentTimeStamp;
            const stepItem = convertProcessItem(chunkRes);
            stepList.push(stepItem);
            scrollToBottom();
            if (chunkRes.mode !== 'result') {
               scrollToBottom();
            }
         },
         {
            cancelToken: currentSource.token,
@@ -581,7 +621,7 @@
   });
   questionRes = await resultP;
   isTalking.value = false;
   // isTalking.value = false;
   const content = parseContent(res, true);
   return content;
@@ -945,10 +985,10 @@
   font-size: 16px !important;
}
:deep(.el-step__description) {
   height: 20px;
   min-height: 20px;
}
:deep(.el-step:last-of-type .el-step__description) {
   display: none;
   // display: none;
}
</style>