From f5ed0a509a58f812bd34b8b90ccb0b4aa1cface4 Mon Sep 17 00:00:00 2001 From: ylj20011123 Date: Fri, 20 Jun 2025 19:29:11 +0800 Subject: [PATCH] update --- src/components/deepseek/index.vue | 185 ++++++++++++++++++++++-------- 1 file changed, 139 insertions(+), 46 deletions(-) diff --git a/src/components/deepseek/index.vue b/src/components/deepseek/index.vue index 4c9c2a5..274bdb0 100644 --- a/src/components/deepseek/index.vue +++ b/src/components/deepseek/index.vue @@ -145,7 +145,7 @@ let routerRole = ref({ onMounted(async () => { - + let param1: string = "" if (/Mobi|Android/i.test(navigator.userAgent)) { console.log("是手机"); isPhone.value = true; @@ -162,7 +162,7 @@ onMounted(async () => { } } else { const urlParams = new URLSearchParams(window.location.search); - const param1 = urlParams.get('comeForm'); + param1 = urlParams.get('comeForm') || ""; console.log("comeForm", param1); if (param1 === 'YNMap') { pageType.value = 1 @@ -215,6 +215,11 @@ onMounted(async () => { }); } + // 如果是云南大屏 就先清除路由解析中的文字 + if (param1 === 'YNMap') { + routerRole.value.content = "" + } + console.log("YSRole", YSRole); console.log("routerRole", routerRole); }); @@ -510,6 +515,11 @@ const handleAskDirectlyDeepseek = async () => { } }; +// 判断是否有大屏两个字 +const containsDaping = (input: string) => { + return /大屏/.test(input); +} + // 发送问题 const handleSendRequest = async (bigObj?: any) => { // 点击刷新 还是会来问问题 bigObj 控制只有一个进行刷新 @@ -518,16 +528,16 @@ const handleSendRequest = async (bigObj?: any) => { return; } + // 把提问输入框里面的内容 给存起来 然后清空 输入框的内容 let thisQuestion: string = ""; let mapQuestion: string = ""; thisQuestion = JSON.parse(JSON.stringify(userInput.value)); userInput.value = ""; + + + console.log('modalTypeDataList', modalTypeDataList); + // 找到当前选择的模型 添加问题的数据 modalTypeDataList.forEach((item: any) => { - if (bigObj.value) { - if (item.value !== bigObj.value) { - return; - } - } if (item.isShow) { let list: any = item.messageList; list.push({ @@ -536,6 +546,8 @@ const handleSendRequest = async (bigObj?: any) => { index: list && list.length > 0 ? list.length : 0, }); item.messageList = list; + console.log('listlistlistlist', JSON.parse(JSON.stringify(list))) + handleScrollToBottomID("gjldBox" + item.value); } }); @@ -546,6 +558,80 @@ const handleSendRequest = async (bigObj?: any) => { return; } + // 判断一下 是不是被内嵌到别人那边的 内嵌的话 就走这儿 不走下面的了 + if (pageType.value === 1 && containsDaping(thisQuestion)) { + // 内嵌云南大屏的内嵌规则 是内嵌 且要有大屏 两个字 + // 这样就进来 不去调用后面的内容 + + modalTypeDataList.forEach((item: any) => { + if (bigObj.value) { + if (item.value !== bigObj.value) { + return; + } + } + if (item.isShow) { + let list: any = item.messageList; + console.log("list", list); + list.push({ + role: "default", + content: "", + index: list && list.length > 0 ? list.length : 0, + noHiden: omitProcess.value ? 0 : 1, + }); + item.messageList = list; + } + }); + + console.log('newRuleTextnewRuleTextnewRuleText', newRuleText.value); + console.log('routerRolerouterRolerouterRolerouterRole', routerRole.value); + console.log('thisQuestionthisQuestionthisQuestionthisQuestion', thisQuestion); + + + let YNMapData: any = await handleGetYNMapData() + + + + // 配置问题内容 + mapQuestion = `#云南大屏直接进行路由角色说明解析#
+ #路由角色解析#
+ ${routerRole.value.content}
+ #用户提问#
+ ${thisQuestion || ""}
+ #接口数据说明#
+ ${YNMapData} + `; + + console.log('mapQuestionmapQuestionmapQuestion', mapQuestion); + + + for (let i = 0; i < modalTypeDataList.length; i++) { + if (modalTypeDataList[i].isShow) { + let list: any = modalTypeDataList[i].messageList; + + console.log('listlistlistlist', JSON.parse(JSON.stringify(list))); + + list[list.length - 1] = { + ...list[list.length - 1], + content: mapQuestion, + loading: false, + }; + modalTypeDataList[i].messageList = list; + } + } + console.log('modalTypeDataListmodalTypeDataListmodalTypeDataList', JSON.parse(JSON.stringify(modalTypeDataList))); + + // let nowShowIdList: any = []; + // for (let i = 0; i < modalTypeDataList.length; i++) { + // if (modalTypeDataList[i].isShow) { + // nowShowIdList.push(modalTypeDataList[i].value) + // } + // } + // handleOnceMoreModal(nowShowIdList); + return + } + + + if (useMapData) { modalTypeDataList.forEach((item: any) => { if (bigObj.value) { @@ -585,12 +671,13 @@ const handleSendRequest = async (bigObj?: any) => { console.log("modalTypeDataList[i].isShow", modalTypeDataList[i].isShow); if (modalTypeDataList[i].isShow) { + // 调用自己的语义 const mapData: any = await RobotDialogueBoxRef.value.handleSubmit( thisQuestion, modalTypeDataList[i].value ); - console.log("mapData5555", mapData); - console.log("modalTypeDataList", modalTypeDataList); + console.log('atatatat', mapData); + // 判断自己的语义是否成功 let userSemanticsIsSuccess: boolean = true; @@ -632,8 +719,6 @@ const handleSendRequest = async (bigObj?: any) => { tabHeader += `
`; dataStr += `${tabHeader}`; } - console.log("tabHeader", tabHeader); - console.log("item.RESPONSE_FIELD", obj); } else if (item.columns && item.columns.length > 0) { item.columns.forEach((subItem: any) => { if (subItem.prop) { @@ -654,18 +739,14 @@ const handleSendRequest = async (bigObj?: any) => { } dataStr += str; } - console.log("showColumnsList", showColumnsList); dataStr += `
`; } - console.log("columnsTypeListfdsfasdfsa", columnsTypeList); - console.log("columnsObjcolumnsObjcolumnsObj", columnsObj); if (item.tableData && item.tableData.length > 0) { item.tableData.forEach((subItem: any) => { let str: string = ""; let obj: any = JSON.parse(JSON.stringify(subItem)); obj = handleChangObjType(obj); - console.log("handleChangObjType", obj); if (obj) { let text: string = handleTableDataToStr( @@ -695,8 +776,6 @@ const handleSendRequest = async (bigObj?: any) => { // 驿商语义解析 的替换 如果规则id只有一个 且这个的id配置了大模型输出规范字段 那么就替换 let newContent: string = ""; - console.log("allStr", allStr); - if ( mapData && mapData.length === 1 && @@ -726,7 +805,8 @@ const handleSendRequest = async (bigObj?: any) => { userSemanticsIsSuccess = false; } - console.log("mapQuestion", mapQuestion); + console.log('mapQuestionmapQuestionmapQuestion', mapQuestion); + if ( bigObj.value @@ -764,10 +844,6 @@ const handleSendRequest = async (bigObj?: any) => { } } - console.log("modalTypeSelect", modalTypeSelect.value); - console.log("modalTypeDataList", modalTypeDataList); - console.log("bigObj", bigObj); - let nowShowIdList: any = []; // modalTypeDataList 的isShow为true的 就是需要添加内容的 @@ -808,30 +884,9 @@ const handleSendRequest = async (bigObj?: any) => { // handleOnceMoreModal([item.value]); } }); - - // modalTypeDataList.forEach((item: any) => { - // if (item.isShow) { - // item.messageList.push({ - // role: "user", - // content: thisQuestion, - // mapContent: mapQuestion, - // }); - // handleScrollToBottomID("gjldBox" + item.value); - // handleOnceMoreModal([item.value]); - // } - // }); } - // messageList.push({ role: "user", content: thisQuestion }); - // // aliyunMessageList.push({ role: "user", content: thisQuestion }); - // deepseekMessageList.push({ role: "user", content: thisQuestion }); - // handleScrollToBottom(); - // // handleAliyunScrollToBottom(); - // handleDeepseekScrollToBottom(); - - // handleGetDeepseek(thisQuestion); - // handleAnswerText(thisQuestion); - // // aLiYunGetDeepSeek(thisQuestion); + console.log('nowShowIdListnowShowIdListnowShowIdList', nowShowIdList); // 判断一下 是不是开启了 省略过程 那就是直接去调用ai深度分析 if (omitProcess.value) { @@ -928,6 +983,15 @@ const handleTableDataToStr = ( // 角色说明分析 const handleUseRoleQuestion = async (bigObj: any, obj: any) => { + if (pageType.value === 1) { + handleOnceMoreModal(modalTypeSelect.value); + } + + + console.log('bigObj3232', bigObj); + + + // 最后显示的文字 let mapQuestion: string = ""; let thisQuestion: string = ""; @@ -1302,7 +1366,7 @@ const handleOnceMoreModal = async (typeList: number[]) => { const handleGetAnswerID = async (obj: any) => { // 最新的相应文本 // let responseText: string = ""; - console.log("obj", obj); + console.log("obj2222", obj); let oldMessage: any = []; // 当对话列表小于3时 说明是第一次问问题 那么就直接找user就好了 @@ -1904,6 +1968,34 @@ const handleStreamChunkID = async (chunk: any, obj: any) => { }); }; +// 拿到云南大屏的数据 +const handleGetYNMapData = async () => { + let obj: any = { + "服务区况述": sessionStorage.getItem("OverviewOfServiceAreaAI") || "", + "服务区承载": sessionStorage.getItem("OverviewOfServiceAreaBusinessAI") || "", + "特情事件": sessionStorage.getItem("TradingAlertAI") || "", + "实时营收": sessionStorage.getItem("CoreBusinessDataAI") || "", + "断面流量": sessionStorage.getItem("TrendOfTrafficFlowYesAI") || "", + "入区车流": sessionStorage.getItem("VehiclesEnteringAI") || "", + "对客营收": sessionStorage.getItem("VehiclesEntering2") || "", + "经营效益": sessionStorage.getItem("VehicleModelStayAI") || "", + "年龄": sessionStorage.getItem("CustomerAgeGroupAI") || "", + "性别": sessionStorage.getItem("GenderCustomerGroupAI") || "", + "偏好类型": sessionStorage.getItem("PreferenceTypeAI") || "", + "客群特征分析": sessionStorage.getItem("CustomerGroupAI") || "", + "客群消费偏好": sessionStorage.getItem("CustomerConsumptionPreferencesAI") || "", + "消费转化对比图": sessionStorage.getItem("ConsumptionConversionAI") || "", + "消费水平": sessionStorage.getItem("ConsumptionLevelAI") || "", + "消费时段分析": sessionStorage.getItem("ConsumptionPeriodAI") || "", + "品牌消费水平": sessionStorage.getItem("BrandConsumptionLevelAI") || "", + "营收特征分析": sessionStorage.getItem("BusinessCaseAI") || "", + "区域营收占比": sessionStorage.getItem("RegionalRevenueAI") || "", + "业态结构占比": sessionStorage.getItem("BusinessStructureAI") || "", + "节假日营收分析": sessionStorage.getItem("FestivalRevenueSumInfoAI") || "", + } + return JSON.stringify(obj) +} + // 处理数据流 const handleStreamChunk = async (chunk: any) => { const lines = chunk.split("\n").filter((line: any) => line.trim() !== ""); @@ -2841,7 +2933,8 @@ const handleChangeProcess = (e: any) => { -
+