|
@@ -30,7 +30,8 @@ const answerResult = ref([]);
|
|
|
const flowParams = {
|
|
|
feedback: '',
|
|
|
category: '',
|
|
|
- warningId: ''
|
|
|
+ warningId: '',
|
|
|
+ simulate: null
|
|
|
};
|
|
|
|
|
|
const answerLoading = ref(false);
|
|
@@ -43,6 +44,8 @@ const csTableData = ref([]);
|
|
|
|
|
|
const visible = ref(false);
|
|
|
|
|
|
+const modalData = ref({});
|
|
|
+
|
|
|
const renderRowDom = ({ row, key }) => {
|
|
|
const { exceed, value } = row[key] || {};
|
|
|
const cls = exceed ? 'text-[#F44C49] font-bold' : 'text-[1A2029]'
|
|
@@ -117,7 +120,7 @@ const handleLoad = () => {
|
|
|
}
|
|
|
|
|
|
const handleModelVisible = () => {
|
|
|
- visible.value = true
|
|
|
+ visible.value = true;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -141,8 +144,6 @@ const handleOpenContent = async ({ id, category }) => {
|
|
|
|
|
|
answerResult.value = [];
|
|
|
|
|
|
- console.log( answerObjItem.biz );
|
|
|
-
|
|
|
const textWhiteList = [
|
|
|
{ label: '报警时间', realKey: '报警时间', value: '', isWarning: false },
|
|
|
{ label: '报警值', realKey: '报警值', value: 'mg/L', isWarning: true },
|
|
@@ -158,7 +159,7 @@ const handleOpenContent = async ({ id, category }) => {
|
|
|
const answerContent = answer.map(item => {
|
|
|
const itemParse = JSON.parse(item);
|
|
|
return itemParse.message;
|
|
|
- }).join();
|
|
|
+ }).join("");
|
|
|
|
|
|
answerResult.value.push({
|
|
|
biz: 'DECISION_REPORT',
|
|
@@ -173,7 +174,6 @@ const handleOpenContent = async ({ id, category }) => {
|
|
|
result.message = Object.keys(result.message).map(key => ({ ...result.message[key], isActive: null }));
|
|
|
return result;
|
|
|
})
|
|
|
- console.log( parseAnswer?.message );
|
|
|
answerResult.value.push({
|
|
|
biz: 'DECISION_ALERT',
|
|
|
loading: false,
|
|
@@ -182,8 +182,9 @@ const handleOpenContent = async ({ id, category }) => {
|
|
|
list: parseAnswer?.message
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+ console.log( basic );
|
|
|
textDataSources.value = format.textSorting(basic, textWhiteList);
|
|
|
- console.log( "textDataSources", textDataSources );
|
|
|
|
|
|
jsTableData.value = [jsData];
|
|
|
csTableData.value = [csData];
|
|
@@ -203,16 +204,19 @@ const onRegenerate = async () => {
|
|
|
|
|
|
answerLoading.value = true;
|
|
|
|
|
|
- const list = [ {biz: 'DECISION_REPORT', list: []} ]
|
|
|
-
|
|
|
const len = answerResult.value.length ? answerResult.value.length : 0;
|
|
|
-
|
|
|
+
|
|
|
const tempReport = {
|
|
|
biz: 'DECISION_REPORT',
|
|
|
answer: '',
|
|
|
loading: true,
|
|
|
delayLoading: true,
|
|
|
};
|
|
|
+
|
|
|
+ let tempSimulate = null;
|
|
|
+
|
|
|
+ answerLoading.value = true;
|
|
|
+
|
|
|
const params = {
|
|
|
body: JSON.stringify(flowParams),
|
|
|
errorHandler: () => {
|
|
@@ -239,12 +243,28 @@ const onRegenerate = async () => {
|
|
|
isAllSelect: false,
|
|
|
list
|
|
|
})
|
|
|
-
|
|
|
}
|
|
|
|
|
|
if (item.biz === 'DECISION_SIMULATE') {
|
|
|
- console.log( item );
|
|
|
- alert("DECISION_SIMULATE")
|
|
|
+ const lastAnswerItem = answerResult.value[len - 1];
|
|
|
+
|
|
|
+ if ( lastAnswerItem.biz === 'DECISION_TABLE' ) {
|
|
|
+ answerResult.value[len - 1] = {
|
|
|
+ ...lastAnswerItem,
|
|
|
+ content: JSON.parse(item.message).pred.join(",")
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ const { off, on, pred } = JSON.parse(item.message);
|
|
|
+ tempSimulate = {
|
|
|
+ biz: 'DECISION_SIMULATE',
|
|
|
+ off,
|
|
|
+ on,
|
|
|
+ pred,
|
|
|
+ isDisable: false
|
|
|
+ }
|
|
|
+ modalData.value = tempSimulate;
|
|
|
+ }
|
|
|
+ console.log("DECISION_SIMULATE")
|
|
|
}
|
|
|
|
|
|
scrollToBottomIfAtBottom();
|
|
@@ -259,6 +279,9 @@ const onRegenerate = async () => {
|
|
|
answerItem.loading = false;
|
|
|
answerItem.delayLoading = false;
|
|
|
}
|
|
|
+ if (tempSimulate) {
|
|
|
+ answerResult.value.push(tempSimulate);
|
|
|
+ }
|
|
|
}
|
|
|
catch(error) {
|
|
|
console.log("exist error .....", error);
|
|
@@ -290,11 +313,30 @@ const handlerAlertOptions = (item, val, index) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 开始预测
|
|
|
+const handleSendSimulate = ({ simulate, table }) => {
|
|
|
+ const len = answerResult.value.length;
|
|
|
+
|
|
|
+ flowParams.simulate = simulate;
|
|
|
+ answerResult.value[len - 1].isDisable = false;
|
|
|
+
|
|
|
+ answerResult.value.push({
|
|
|
+ biz: 'DECISION_TABLE',
|
|
|
+ loading: true,
|
|
|
+ delayLoading: true,
|
|
|
+ table,
|
|
|
+ isDisable: false
|
|
|
+ })
|
|
|
+
|
|
|
+ onRegenerate();
|
|
|
+}
|
|
|
+
|
|
|
// 欢迎页提交
|
|
|
const handleWelcomeRecommend = question => {
|
|
|
chatStore.setChatQuestion(question);
|
|
|
router.push('/answer');
|
|
|
}
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
@@ -325,14 +367,14 @@ const handleWelcomeRecommend = question => {
|
|
|
|
|
|
<ChatWelcome title="您好,我是LibraAI工艺管控助手" card-title="常见处理方案:"
|
|
|
:sub-title="[
|
|
|
- '报警分析功能具备实时监测与预警机制,检测到异常情况立即触发多种报警方式,推送相关',
|
|
|
- '工作人员确保问题及时处理。报警时间为每小时警报,请大家及时处理。'
|
|
|
+ '报警分析功能具备实时监测与预警机制,检测到异常情况推送相关工作人员确保问题及时处理。',
|
|
|
+ '报警时间为每小时警报,请大家及时处理。'
|
|
|
]"
|
|
|
:card-content="recommendList"
|
|
|
@on-click="handleWelcomeRecommend"
|
|
|
v-if="!textDataSources"
|
|
|
/>
|
|
|
-
|
|
|
+
|
|
|
<ChatBaseCard v-if="textDataSources">
|
|
|
<div class="waring-answer-wrapper">
|
|
|
<dl class="message-inner warning-info_medium ">
|
|
@@ -360,8 +402,6 @@ const handleWelcomeRecommend = question => {
|
|
|
</div>
|
|
|
</ChatBaseCard>
|
|
|
|
|
|
- <!-- {{ answerResult.length }} -->
|
|
|
-
|
|
|
<section v-for="item,index in answerResult" :key="index">
|
|
|
<template v-if="item.biz === 'DECISION_REPORT'">
|
|
|
<ChatAnswer
|
|
@@ -393,6 +433,55 @@ const handleWelcomeRecommend = question => {
|
|
|
</ul>
|
|
|
</ChatBaseCard>
|
|
|
</template>
|
|
|
+
|
|
|
+ <template v-if="item.biz === 'DECISION_SIMULATE'">
|
|
|
+ <button class="
|
|
|
+ px-[30px] py-[10px] mb-[20px]
|
|
|
+ rounded-[8px]
|
|
|
+ bg-white text-[13px]
|
|
|
+ text-[#5E5E5E] hover:text-[#2454FF]"
|
|
|
+ :disabled="item.isDisable"
|
|
|
+ @click="handleModelVisible"
|
|
|
+ >
|
|
|
+ 水质预测推演
|
|
|
+ </button>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-if="item.biz === 'DECISION_TABLE'">
|
|
|
+ <ChatAnswer
|
|
|
+ :loading="item.loading"
|
|
|
+ :delay-loading="item.delayLoading"
|
|
|
+ :toggleVisibleIcons="false"
|
|
|
+ >
|
|
|
+ <div class="markdown-body text-[15px] break-all">
|
|
|
+ <strong class="block mb-[16px]">推荐指标调整:</strong>
|
|
|
+ <table>
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th v-for="text in item.table.header" :key="text">{{ text }}</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <td v-for="text in item.table.body" :key="text">{{ text }}</td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ <strong class="block mb-[16px]">预测推演结果:</strong>
|
|
|
+ <span>出水硝酸盐:{{ item.content }}</span>
|
|
|
+ </div>
|
|
|
+ </ChatAnswer>
|
|
|
+ <button class="
|
|
|
+ px-[30px] py-[10px] mb-[20px]
|
|
|
+ rounded-[8px]
|
|
|
+ bg-white text-[13px]
|
|
|
+ text-[#5E5E5E] hover:text-[#2454FF]"
|
|
|
+ :disabled="item.isDisable"
|
|
|
+ @click="handleModelVisible"
|
|
|
+ >
|
|
|
+ 水质预测推演
|
|
|
+ </button>
|
|
|
+ </template>
|
|
|
</section>
|
|
|
|
|
|
<ChatAnswer
|
|
@@ -402,19 +491,13 @@ const handleWelcomeRecommend = question => {
|
|
|
v-show="answerLoading"
|
|
|
></ChatAnswer>
|
|
|
|
|
|
- <!-- <button class="
|
|
|
- px-[30px] py-[10px] mb-[20px]
|
|
|
- rounded-[8px]
|
|
|
- bg-white text-[13px]
|
|
|
- text-[#5E5E5E] hover:text-[#2454FF]"
|
|
|
- @click="handleModelVisible"
|
|
|
- >
|
|
|
- 水质预测推演
|
|
|
- </button> -->
|
|
|
-
|
|
|
</TheChatView>
|
|
|
</section>
|
|
|
|
|
|
- <CustomModal v-model:visible="visible"></CustomModal>
|
|
|
+ <CustomModal
|
|
|
+ v-model:visible="visible"
|
|
|
+ :current-data="modalData"
|
|
|
+ @on-submit="handleSendSimulate"
|
|
|
+ ></CustomModal>
|
|
|
|
|
|
</template>
|