【web】 ai提问api修改

dev
Wangxin 8 months ago
parent fbef639ab4
commit 1f5e8cc85b
  1. 6
      ALOps_sys_fe/alops-ui/src/views/QandA/Aiassistant/index.vue
  2. 1
      ALOps_sys_fe/alops-ui/src/views/device/deviceInformation/index.vue
  3. 176
      ALOps_sys_fe/alops-ui/src/views/inMonitoring/devicesState/detail.vue
  4. 4
      ALOps_sys_fe/alops-ui/src/views/inMonitoring/inMonitor/message/index.vue
  5. 6
      ALOps_sys_fe/alops-ui/src/views/inMonitoring/inMonitor/rules/index.vue
  6. 4
      ALOps_sys_fe/alops-ui/src/views/message/index.vue

@ -79,21 +79,23 @@ export default {
methods: { methods: {
sendMessage() { sendMessage() {
if (!this.newMessage.trim()) return; if (!this.newMessage.trim()) return;
console.log("%c 🍃: sendMessage -> this.newMessage ", "font-size:16px;background-color:#46f583;color:black;", this.newMessage)
// //
this.messages.push({ this.messages.push({
text: this.newMessage, text: this.newMessage,
sender: 'customer', sender: 'customer',
time: this.formatTime(new Date()) time: this.formatTime(new Date())
}); });
let newMessageContent = this.newMessage;
// //
setTimeout(() => { setTimeout(() => {
this.autoReply(this.newMessage); this.autoReply(newMessageContent);
}, 1000); }, 1000);
this.newMessage = ''; this.newMessage = '';
}, },
async autoReply(userMessage) { async autoReply(userMessage) {
console.log("%c 🇱🇺: autoReply -> userMessage ", "font-size:16px;background-color:#c70b31;color:white;", userMessage)
let replyText = ''; let replyText = '';
let res = await knowledgeAsk({question: userMessage }); let res = await knowledgeAsk({question: userMessage });
if (res.code == 200) { if (res.code == 200) {

@ -21,6 +21,7 @@
<el-col :span="24"> <el-col :span="24">
<el-form-item label="采集间隔" prop="frequency"> <el-form-item label="采集间隔" prop="frequency">
<el-input-number v-model="queryParams.frequency" controls-position="right" :min="1"></el-input-number> <el-input-number v-model="queryParams.frequency" controls-position="right" :min="1"></el-input-number>
<span> 分钟</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">

@ -247,7 +247,7 @@ export default {
components: { History, Interface, Vlan, Routing, LineChart, Veneer}, components: { History, Interface, Vlan, Routing, LineChart, Veneer},
data() { data() {
return { return {
DateValue: [dayjs().subtract(1, 'month').format('YYYY-MM-DD HH:mm:ss'),dayjs().format('YYYY-MM-DD HH:mm:ss')], DateValue: [dayjs().subtract(1, 'week').format('YYYY-MM-DD HH:mm:ss'),dayjs().format('YYYY-MM-DD HH:mm:ss')],
selectedTab: 1, selectedTab: 1,
tabs: [ tabs: [
{ name: '历史预警' }, { name: '历史预警' },
@ -447,62 +447,73 @@ mounted() {
} }
] ]
}) })
const value = this.details.cpuUtilization / 100;
usedmemory3.setOption({ usedmemory3.setOption({
series: [
{
type: 'liquidFill',
radius: '47%',
center: ['25%', '45%'],
color: [
{
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: '#446bf5',
},
{
offset: 1,
color: '#2ca3e2',
},
],
globalCoord: false,
},
],
data: [value, value], // data
backgroundStyle: {
borderWidth: 1,
color: 'RGBA(51, 66, 127, 0.7)',
},
label: {
normal: {
textStyle: {
fontSize: 50,
color: '#fff',
},
formatter: function(params) {
return Math.round(params.value * 100) + '%';
}
},
},
outline: {
// show: false
borderDistance: 0,
itemStyle: {
borderWidth: 2,
borderColor: '#112165',
},
},
}
],
title: [ title: [
{ {
text: 'CPU占用', text: 'CPU占用',
left: '45%', left: '25%',
top: '55%', top: '75%',
textAlign: 'center', textAlign: 'center',
textStyle: { textStyle: {
fontSize: '14', fontSize: '14',
fontWeight: '400', fontWeight: '400',
color: '#6AA0E4', color: '#6AA0E4',
textAlign: 'center', textAlign: 'center',
textShadowColor: '#000',
}, },
}, },
], ]
series: {
type: 'pie',
radius: ['90%', "100%"],
hoverAnimation: false,
data: [
{
value: this.details.cpuUtilization,
label: {
normal: {
color: '#6AA0E4',
fontSize: 22,
fontWeight: 'bold',
formatter: function(params) {
return params.value + '%';
},
position: 'center',
show: true,
}
},
itemStyle: {
normal: {
color: '#6AA0E4'
}
}
},{
value: 100-this.details.cpuUtilization,
name: '',
labelLine: {
show: false
},
itemStyle: {
normal: {
color: '#D8D8D8'
},
emphasis:{
color:'#D8D8D8'
}
}
}]
}
}) })
usedmemory4.setOption({ usedmemory4.setOption({
title: [ title: [
@ -602,42 +613,20 @@ mounted() {
params.forEach(function(item) { params.forEach(function(item) {
let value = item.value; let value = item.value;
let unit = ''; let unit = '';
// //
if (item.seriesName === '设备温度') { if (item.seriesName === '设备温度') {
unit = '℃'; unit = '℃';
} else if (item.seriesName === '健康度') { } else {
// - 访 unit = '%';
// }
let originalValue;
switch(value) {
case 100: originalValue = 1; break;
case 75: originalValue = 2; break;
case 50: originalValue = 3; break;
case 25: originalValue = 4; break;
default: originalValue = 0;
}
let statusText = '';
switch(originalValue) {
case 1: statusText = '健康'; break;
case 2: statusText = '良好'; break;
case 3: statusText = '一般'; break;
case 4: statusText = '需维护'; break;
default: statusText = '未知';
}
result += item.marker + item.seriesName + ': ' + value + '% (' + statusText + ')<br/>';
return;
} else {
unit = '%';
}
result += item.marker + item.seriesName + ': ' + value + unit + '<br/>'; result += item.marker + item.seriesName + ': ' + value + unit + '<br/>';
}); });
return result; return result;
} }
}, },
legend: { legend: {
data: ['设备温度', 'CPU使用率', '内存使用率', '健康度'], data: ['设备温度', 'CPU使用率', '内存使用率'],
textStyle: { textStyle: {
color: '#718096' color: '#718096'
} }
@ -764,43 +753,6 @@ mounted() {
}] }]
} }
} }
},
{
name: '健康度',
type: 'bar',
// 1->100, 2->75, 3->50, 4->25
// 使
data: details.healthList.map(value => {
const valueMap = {1: 100, 2: 75, 3: 50, 4: 25};
// 使value
return {
value: valueMap[value] || 0,
originalValue: value
};
}),
itemStyle: {
color: function(params) {
//
const originalValue = params.data && params.data.originalValue !== undefined ?
params.data.originalValue : params.value;
// 使switchcasebreak
switch(originalValue) {
case 1: return '#48bb78'; // - 绿
case 2: return '#4299e1'; // -
case 3: return '#ed8936'; // -
case 4: return '#f56565'; // -
default: return '#a0aec0'; //
}
}
},
barWidth: '40%',
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
} }
] ]
}); });

@ -52,7 +52,7 @@
<el-table-column label="设备名称" align="center" key="name" prop="name" width="150" :show-overflow-tooltip="true" /> <el-table-column label="设备名称" align="center" key="name" prop="name" width="150" :show-overflow-tooltip="true" />
<el-table-column label="预警时间" align="center" key="occurTime" prop="occurTime" :show-overflow-tooltip="true" /> <el-table-column label="预警时间" align="center" key="occurTime" prop="occurTime" :show-overflow-tooltip="true" />
<el-table-column label="预警等级" align="center" key="level" prop="level" :show-overflow-tooltip="true" /> <el-table-column label="预警等级" align="center" key="level" prop="level" :show-overflow-tooltip="true" />
<el-table-column label="预警信息" align="center" key="message" prop="message" width="200" :show-overflow-tooltip="true"> <el-table-column label="预警信息" align="left" key="message" prop="message" width="200" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span @click="showContentDialog('预警信息', scope.row.message)" class="clickable-cell">{{ scope.row.message || '--' }}</span> <span @click="showContentDialog('预警信息', scope.row.message)" class="clickable-cell">{{ scope.row.message || '--' }}</span>
</template> </template>
@ -72,7 +72,7 @@
<span>{{ parseTime(scope.row.handleTime) || '--' }}</span> <span>{{ parseTime(scope.row.handleTime) || '--' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="解决方案" align="center" key="solution" prop="solution" :show-overflow-tooltip="true" > <el-table-column label="解决方案" align="left" key="solution" prop="solution" :show-overflow-tooltip="true" >
<template slot-scope="scope"> <template slot-scope="scope">
<span @click="showContentDialog('解决方案', scope.row.solution)" class="clickable-cell">{{ scope.row.solution || '--'}}</span> <span @click="showContentDialog('解决方案', scope.row.solution)" class="clickable-cell">{{ scope.row.solution || '--'}}</span>
</template> </template>

@ -34,8 +34,8 @@
type="index" type="index"
></el-table-column> ></el-table-column>
<el-table-column label="名称" align="center" key="ruleName" prop="ruleName" width="120"/> <el-table-column label="名称" align="center" key="ruleName" prop="ruleName" width="120"/>
<el-table-column label="描述" align="center" key="description" prop="description" width="240" :show-overflow-tooltip="true" /> <el-table-column label="描述" align="left" key="description" prop="description" width="240" :show-overflow-tooltip="true" />
<el-table-column label="触发条件" align="center" key="alertTemplate" prop="alertTemplate" width="240" :show-overflow-tooltip="true" > <el-table-column label="触发条件" align="left" key="alertTemplate" prop="alertTemplate" width="240" :show-overflow-tooltip="true" >
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.paramName">{{ findParamName(scope.row.paramName) }} {{ scope.row.operator }} {{ scope.row.compareValue }}</span> <span v-if="scope.row.paramName">{{ findParamName(scope.row.paramName) }} {{ scope.row.operator }} {{ scope.row.compareValue }}</span>
<span v-else></span> <span v-else></span>
@ -43,7 +43,7 @@
</el-table-column> </el-table-column>
<el-table-column label="预警级别" align="center" key="severity" prop="severity" width="120" /> <el-table-column label="预警级别" align="center" key="severity" prop="severity" width="120" />
<el-table-column label="预警方式" align="center" key="alertWay" prop="alertWay" width="120" :show-overflow-tooltip="true" /> <el-table-column label="预警方式" align="center" key="alertWay" prop="alertWay" width="120" :show-overflow-tooltip="true" />
<el-table-column label="预警邮箱" align="center" key="alertStation" prop="alertStation" width="200" :show-overflow-tooltip="true" /> <el-table-column label="预警邮箱" align="left" key="alertStation" prop="alertStation" width="200" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['inMonitoring:alertRule:edit']">修改</el-button> <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['inMonitoring:alertRule:edit']">修改</el-button>

@ -14,7 +14,7 @@
></el-table-column> ></el-table-column>
<el-table-column label="消息ID" align="center" key="id" prop="id" width="80" /> <el-table-column label="消息ID" align="center" key="id" prop="id" width="80" />
<el-table-column label="用户ID" align="center" key="userId" prop="userId" width="80" /> <el-table-column label="用户ID" align="center" key="userId" prop="userId" width="80" />
<el-table-column label="消息内容" align="center" key="content" prop="content" :show-overflow-tooltip="true"> <el-table-column label="消息内容" align="left" key="content" prop="content" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.content || '--' }}</span> <span>{{ scope.row.content || '--' }}</span>
</template> </template>
@ -26,7 +26,7 @@
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="标题" align="center" key="title" prop="title" :show-overflow-tooltip="true"> <el-table-column label="标题" align="left" key="title" prop="title" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.title || '--' }}</span> <span>{{ scope.row.title || '--' }}</span>
</template> </template>

Loading…
Cancel
Save