人脸识别与大模型问答

This commit is contained in:
jiang 2024-08-26 17:48:44 +08:00
parent fcfa7fcb02
commit 21dbc43674
7 changed files with 78 additions and 21 deletions

View File

@ -44,3 +44,15 @@ export function recognition(formData) {
})
}
/**
* 获取识别结果
* @returns {*}
*/
export function getListFaceResult() {
return request({
url: '/ai/faceResult/selectAllAiFaceRecognizeResults',
method: 'post',
isRepeatSubmit: true
})
}

View File

@ -63,7 +63,7 @@ service.interceptors.request.use(
cache.session.setJSON('sessionObj', requestObj)
} else {
const { url, data, time } = sessionObj
const interval = 1000 // 间隔时间(ms),小于此时间视为重复提交
const interval = 0 // 间隔时间(ms),小于此时间视为重复提交
if (data === requestObj.data && requestObj.time - time < interval && url === requestObj.url) {
const message = '数据正在处理,请勿重复提交'

View File

@ -60,10 +60,10 @@ import faceListShowPic from "@/views/updateFace/faceListShowPic.vue";
const validationRules = {
name: [
{required: true, message: '人员名称不能为空', trigger: 'blur'},
{min: 2, max: 20, message: '用户名称长度必须介于 2 和 4 之间', trigger: 'blur'},
{min: 2, max: 20, message: '用户名称长度必须介于 2 和 10 之间', trigger: 'blur'},
{
validator: (rule, value, callback) => {
const chineseNamePattern = /^[\u4e00-\u9fa5]{2,4}$/;
const chineseNamePattern = /^[\u4e00-\u9fa5]{2,10}$/;
if (!chineseNamePattern.test(value)) {
callback(new Error('姓名只能包含中文字符'));
} else {
@ -168,6 +168,7 @@ export default {
},
close() {
this.visible = false;
faceListShowPic.methods.getList();
this.$emit('input', this.visible);
},
confirm() {
@ -179,6 +180,13 @@ export default {
handleFileChange(event) {
const file = event.target.files[0];
if (file) {
const maxSizeInMB = 20; // MB
const maxSizeInBytes = maxSizeInMB * 1024 * 1024;
if (file.size > maxSizeInBytes) {
this.$message.error(`文件大小不能超过 ${maxSizeInMB} MB`);
return;
}
this.imageUrl = URL.createObjectURL(file);
this.form.file = file;
}

View File

@ -5,17 +5,17 @@
<tr class="faceListResWatchRow">
<th class="faceListResWatchColume faceListResWatchColumeSort">序号</th>
<th class="faceListResWatchColume faceListResWatchColumeIPAddr">访问地址</th>
<th class="faceListResWatchColume faceListResWatchColumeDate">访问时间</th>
<th class="faceListResWatchColume faceListResWatchColumeIPAddr">访问时间</th>
<th class="faceListResWatchColume faceListResWatchColumeTime">响应时长</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in faceRecognition2" :key="index"
<tr v-for="(item, index) in faceRecognition" :key="index"
:class="{ 'faceContentRowEven': index % 2 === 0, 'faceContentRowPrime': index % 2 !== 0 }">
<td class="faceListResWatchColume faceListResWatchColumeSort">{{ index + 1 }}</td>
<td class="faceListResWatchColume faceListResWatchColumeIPAddr">{{ item.ip }}</td>
<td class="faceListResWatchColume faceListResWatchColumeDate">{{ item.returnTime }}</td>
<td class="faceListResWatchColume faceListResWatchColumeTime">{{ item.responseTime }}</td>
<td class="faceListResWatchColume faceListResWatchColumeIPAddr">{{ item.invokeIp }}</td>
<td class="faceListResWatchColume faceListResWatchColumeIPAddr">{{ item.recognizeTime }}</td>
<td class="faceListResWatchColume faceListResWatchColumeTime">{{ item.responseLong+"ms" }}</td>
</tr>
</tbody>
</table>
@ -23,11 +23,25 @@
</template>
<script>
import {getListFaceResult} from '@/api/updateFace/updateFace'
export default {
name: 'faceListResWatch',
data() {
return {
faceRecognition2: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
faceRecognition: [],
}
},
mounted() {
this.getListFaceResult();
}, methods: {
getListFaceResult() {
getListFaceResult().then(res => {
if (res.code === 200) {
this.faceRecognition = res.data;
}
})
}
}
}
@ -113,7 +127,7 @@ tbody {
.faceListResWatchColumeSort {
flex: 1
flex: 0.5
}
.faceListResWatchColumeIPAddr {

View File

@ -6,16 +6,18 @@
<th class="faceListRecoResultColume faceListRecoResultColumeSort">序号</th>
<th class="faceListRecoResultColume faceListRecoResultColumeIPAddr">访问地址</th>
<th class="faceListRecoResultColume faceListRecoResultColumeDate">访问时间</th>
<th class="faceListRecoResultColume faceListRecoResultColumeTime">响应时长</th>
<th class="faceListRecoResultColume faceListRecoResultColumeTime">响应状态</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in faceRecognition" :key="index"
:class="{ 'faceContentRowEven': index % 2 === 0, 'faceContentRowPrime': index % 2 !== 0 }">
<td class="faceListRecoResultColume faceListRecoResultColumeSort">{{ index + 1 }}</td>
<td class="faceListRecoResultColume faceListRecoResultColumeIPAddr">{{ item.ip }}</td>
<td class="faceListRecoResultColume faceListRecoResultColumeDate">{{ item.returnTime }}</td>
<td class="faceListRecoResultColume faceListRecoResultColumeTime">{{ item.responseTime }}</td>
<td class="faceListRecoResultColume faceListRecoResultColumeIPAddr">{{ item.invokeIp }}</td>
<td class="faceListRecoResultColume faceListRecoResultColumeDate">{{ item.recognizeTime }}</td>
<td class="faceListRecoResultColume faceListRecoResultColumeTime">{{
item.resultStatus === '0' ? "成功" : "失败"
}}</td>
</tr>
</tbody>
</table>
@ -23,11 +25,25 @@
</template>
<script>
import {getListFaceResult} from '@/api/updateFace/updateFace'
export default {
name: 'faceListResultCount',
data() {
return {
faceRecognition: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
faceRecognition: [],
}
},
mounted() {
this.getListFaceResult();
}, methods: {
getListFaceResult() {
getListFaceResult().then(res => {
if (res.code === 200) {
this.faceRecognition = res.data;
}
})
}
}
}
@ -113,7 +129,7 @@ tbody {
.faceListRecoResultColumeSort {
flex: 1
flex: 0.5
}
.faceListRecoResultColumeIPAddr {

View File

@ -21,7 +21,6 @@ export default {
},
mounted() {
this.getList();
},
methods: {
getList() {

View File

@ -17,7 +17,7 @@
<div class="main-bottom-right-bg">
<input
type="file"
accept="image/jpeg"
accept="image/jpeg,image/png"
style="display: none"
ref="fileInput"
@change="handleFileChange"
@ -65,7 +65,7 @@
/>
<i
v-else
class="el-icon-plus avatar-uploader-icon"
class=" avatar-uploader-icon"
></i>
<div class="content">
<span v-if="name">姓名:{{ name }}</span>
@ -85,6 +85,9 @@
import addFace from "@/views/updateFace/addFace.vue";
import {recognition} from '@/api/updateFace/updateFace'
import faceListShowPic from "@/views/updateFace/faceListShowPic.vue";
import faceListResultCount from "@/views/updateFace/faceListResultCount.vue";
import faceListResWatch from "@/views/updateFace/faceListResWatch.vue";
export default {
components: {
addFace
@ -102,7 +105,7 @@ export default {
showModal(val) {
console.log(val)
if (!val) {
faceListShowPic.methods.getList();
}
}
},
@ -118,15 +121,20 @@ export default {
this.sex = data.sex;
this.$message.success(res.msg)
} else {
this.faceUrl = '';
this.name = '';
this.sex = '';
this.$message.error(res.msg)
}
faceListResultCount.methods.getListFaceResult();
faceListResWatch.methods.getListFaceResult();
})
},
update() {
this.showModal = true
},
handleVisibleChange(newVal) {
console.log(newVal);
faceListShowPic.methods.getList();
this.showModal = newVal;
},
selectFile() {