人脸识别与大模型问答

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

View File

@ -60,10 +60,10 @@ import faceListShowPic from "@/views/updateFace/faceListShowPic.vue";
const validationRules = { const validationRules = {
name: [ name: [
{required: true, message: '人员名称不能为空', trigger: 'blur'}, {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) => { validator: (rule, value, callback) => {
const chineseNamePattern = /^[\u4e00-\u9fa5]{2,4}$/; const chineseNamePattern = /^[\u4e00-\u9fa5]{2,10}$/;
if (!chineseNamePattern.test(value)) { if (!chineseNamePattern.test(value)) {
callback(new Error('姓名只能包含中文字符')); callback(new Error('姓名只能包含中文字符'));
} else { } else {
@ -168,6 +168,7 @@ export default {
}, },
close() { close() {
this.visible = false; this.visible = false;
faceListShowPic.methods.getList();
this.$emit('input', this.visible); this.$emit('input', this.visible);
}, },
confirm() { confirm() {
@ -179,6 +180,13 @@ export default {
handleFileChange(event) { handleFileChange(event) {
const file = event.target.files[0]; const file = event.target.files[0];
if (file) { 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.imageUrl = URL.createObjectURL(file);
this.form.file = file; this.form.file = file;
} }

View File

@ -5,17 +5,17 @@
<tr class="faceListResWatchRow"> <tr class="faceListResWatchRow">
<th class="faceListResWatchColume faceListResWatchColumeSort">序号</th> <th class="faceListResWatchColume faceListResWatchColumeSort">序号</th>
<th class="faceListResWatchColume faceListResWatchColumeIPAddr">访问地址</th> <th class="faceListResWatchColume faceListResWatchColumeIPAddr">访问地址</th>
<th class="faceListResWatchColume faceListResWatchColumeDate">访问时间</th> <th class="faceListResWatchColume faceListResWatchColumeIPAddr">访问时间</th>
<th class="faceListResWatchColume faceListResWatchColumeTime">响应时长</th> <th class="faceListResWatchColume faceListResWatchColumeTime">响应时长</th>
</tr> </tr>
</thead> </thead>
<tbody> <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 }"> :class="{ 'faceContentRowEven': index % 2 === 0, 'faceContentRowPrime': index % 2 !== 0 }">
<td class="faceListResWatchColume faceListResWatchColumeSort">{{ index + 1 }}</td> <td class="faceListResWatchColume faceListResWatchColumeSort">{{ index + 1 }}</td>
<td class="faceListResWatchColume faceListResWatchColumeIPAddr">{{ item.ip }}</td> <td class="faceListResWatchColume faceListResWatchColumeIPAddr">{{ item.invokeIp }}</td>
<td class="faceListResWatchColume faceListResWatchColumeDate">{{ item.returnTime }}</td> <td class="faceListResWatchColume faceListResWatchColumeIPAddr">{{ item.recognizeTime }}</td>
<td class="faceListResWatchColume faceListResWatchColumeTime">{{ item.responseTime }}</td> <td class="faceListResWatchColume faceListResWatchColumeTime">{{ item.responseLong+"ms" }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -23,11 +23,25 @@
</template> </template>
<script> <script>
import {getListFaceResult} from '@/api/updateFace/updateFace'
export default { export default {
name: 'faceListResWatch', name: 'faceListResWatch',
data() { data() {
return { 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 { .faceListResWatchColumeSort {
flex: 1 flex: 0.5
} }
.faceListResWatchColumeIPAddr { .faceListResWatchColumeIPAddr {

View File

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

View File

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

View File

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