算法分析页面接入

This commit is contained in:
mmc
2026-05-21 12:55:07 +08:00
parent 0aad6659dd
commit bdaa0c352a
4 changed files with 783 additions and 1 deletions

56
src/api/aiAnalysis.ts Normal file
View File

@@ -0,0 +1,56 @@
import request from '../request';
// 检测服务 Base URL
const DETECT_BASE = 'http://50.50.50.117:10101';
// 热成像分割服务 Base URL
const SEGMENT_BASE = 'http://50.50.50.117:10102';
/**
* 获取检测模型列表
*/
export function getDetectModels() {
return fetch(`${DETECT_BASE}/api/v1/detect/models`).then(res => res.json());
}
/**
* 提交检测任务
* @param formData 包含 files, inputType, modelAlias, conf, iou, imgsz, device, maxDet, vidStride
*/
export function submitDetectJob(formData: FormData) {
return fetch(`${DETECT_BASE}/api/v1/detect/jobs`, {
method: 'POST',
body: formData
}).then(res => res.json());
}
/**
* 查询检测任务状态
*/
export function getDetectJobStatus(jobId: string) {
return fetch(`${DETECT_BASE}/api/v1/detect/jobs/${jobId}`).then(res => res.json());
}
/**
* 查询检测结果
*/
export function getDetectJobResult(jobId: string) {
return fetch(`${DETECT_BASE}/api/v1/detect/jobs/${jobId}/result`).then(res => res.json());
}
/**
* 提交热成像分析 (同步返回结果)
* @param formData 包含 thermal_file, array_mask_file, panel_geojson_file, threshold_c, min_area_px, max_regions, open_k, close_k, shrink_in, include_panel_segments
*/
export function submitSegmentationAnalyze(formData: FormData) {
return fetch(`${SEGMENT_BASE}/api/v1/segmentation/analyze`, {
method: 'POST',
body: formData
}).then(res => res.json());
}
/**
* 获取热成像分析报告历史
*/
export function getSegmentationHistory() {
return fetch(`${SEGMENT_BASE}/api/v1/segmentation/analyses/report`).then(res => res.json());
}