57 lines
1.6 KiB
TypeScript
57 lines
1.6 KiB
TypeScript
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());
|
|
}
|