wujingjing
2025-02-11 8c6fbc506e9a2c8cde56a794d8319cc55f4be666
src/components/chat/smallChat/index.vue
@@ -92,7 +92,7 @@
                           <template v-else>
                              <span
                                 v-if="(historyMessages[index+1].content as AssistantContent).isError"
                                 class="flex items-center ml-4 text-danger before:content-['('] after:content-[')']"
                                 class="flex items-center text-nowrap ml-4 text-danger before:content-['('] after:content-[')']"
                              >
                                 {{ (historyMessages[index + 1].content as AssistantContent).value }}
                                 <el-tooltip
@@ -105,7 +105,7 @@
                                    </el-icon>
                                 </el-tooltip>
                              </span>
                              <span v-else class="ml-4 text-success before:content-['('] after:content-[')']">
                              <span v-else class="ml-4 text-success text-nowrap before:content-['('] after:content-[')']">
                                 {{ (historyMessages[index + 1].content as AssistantContent).value }}
                              </span>
                           </template>
@@ -138,10 +138,8 @@
         </div>
      </div>
      <Teleport to="body">
         <WorkOrderDlg v-model="optDlgIsShow" :item="optDlgMapRow"></WorkOrderDlg>
         <WorkOrderDlg v-model="optDlgIsShow" :item="optDlgMapRow" @insert="submitDlg" @cancelSubmit="cancelSubmit"></WorkOrderDlg>
      </Teleport>
   </div>
</template>
@@ -182,7 +180,12 @@
      x: 200,
   },
});
const cancelSubmit = (reason) => {
   refreshAssistantMessage({ reason: reason });
};
const submitDlg = () => {
   refreshAssistantMessage({ value: `成功`, isError: false });
};
const historyMessages = ref<ChatMessage[]>([]);
const isInit = computed(() => historyMessages.value.length === 0);
const initQuestionList = ref([
@@ -190,6 +193,7 @@
   { title: '地图缩放', question: '放大' },
   { title: '设备显隐', question: '隐藏设备' },
   { title: '设备聚焦', question: '聚焦设备' },
   { title: '创建工单', question: '松福大道DN800松岗联通监测设备没有数据,创建一个设备维修工单,请及时派人维修。' },
]);
const chatContentRef = ref<HTMLDivElement>(null);
@@ -208,10 +212,7 @@
   optDlgIsShow.value = true;
};
const submit = () => {
};
const submit = () => {};
//#endregion
const mockCommand = (question: string) => {
@@ -236,10 +237,20 @@
   }
};
const handleCreateWorkOrder = (formData: any) => {
   openOptDlg(formData ?? {});
};
const startStream = (question: string) => {
   if (lastIsInit) {
      showHistory.value = false;
   }
   // if (question === '松福大道DN800松岗联通监测设备没有数据,创建一个设备维修工单,请及时派人维修。') {
   //    setTimeout(() => {
   //       openOptDlg();
   //    }, 400);
   //    return;
   // }
   // mockCommand(question);
   // return;
@@ -257,6 +268,12 @@
            if (chunkRes.type === 'string') {
               const jsonData = JSON.parse(chunkRes.value);
               handleMapCommand(jsonData);
            }
         } else if (chunkRes.mode === 'create_work_order') {
            haveMapOperate = true;
            if(chunkRes.type==='string'){
               const jsonData = JSON.parse(chunkRes.value);
               handleCreateWorkOrder(jsonData)
            }
         }
         if (chunkRes.mode === 'finish') {
@@ -318,7 +335,7 @@
         if (equipOverlay) {
            equipOverlay.isVisible = true;
            // 强制触发更新
            props.olMap.layerInfo.value = props.olMap.layerInfo.value.concat([])
            props.olMap.layerInfo.value = props.olMap.layerInfo.value.concat([]);
            // props.olMap.toggleMarkerOverlayVisible(true);
         }
         break;
@@ -327,9 +344,8 @@
         if (equipOverlay1) {
            equipOverlay1.isVisible = false;
            // 强制触发更新
            props.olMap.layerInfo.value = props.olMap.layerInfo.value.concat([])
            props.olMap.layerInfo.value = props.olMap.layerInfo.value.concat([]);
            // props.olMap.toggleMarkerOverlayVisible(false);
         }
         break;
      case '聚焦设备':