feat(server): 完善 LLM 集成基础设施与规则配置

This commit is contained in:
2026-06-16 11:41:07 +08:00
parent fe2b569046
commit 66c0eb27c8
5 changed files with 207 additions and 8 deletions
+94
View File
@@ -68,3 +68,97 @@ export const detectionApi = {
})
}
}
// ============================================================
// MVP-2 / MVP-3 扩展 API: 摄像头管理 / 规则配置 / LLM 状态
// ============================================================
/**
* 摄像头 (RTSP 流) 管理 API (MVP-2 / D11-D14)
*/
export const cameraApi = {
list() {
return api.get('/rtsp/streams')
},
get(streamId) {
return api.get(`/rtsp/streams/${encodeURIComponent(streamId)}`)
},
add(payload) {
return api.post('/rtsp/streams', payload)
},
remove(streamId) {
return api.delete(`/rtsp/streams/${encodeURIComponent(streamId)}`)
},
start(streamId) {
return api.post(`/rtsp/streams/${encodeURIComponent(streamId)}/start`)
},
stop(streamId) {
return api.post(`/rtsp/streams/${encodeURIComponent(streamId)}/stop`)
},
updateConfig(streamId, payload) {
return api.put(`/rtsp/streams/${encodeURIComponent(streamId)}/config`, payload)
},
startAll() {
return api.post('/rtsp/start-all')
},
stopAll() {
return api.post('/rtsp/stop-all')
},
health() {
return api.get('/rtsp/health')
}
}
/**
* 规则配置 API (MVP-3 / D33)
*/
export const ruleApi = {
list() {
return api.get('/rules')
},
get(name) {
return api.get(`/rules/${encodeURIComponent(name)}`)
},
create(payload) {
return api.post('/rules', payload)
},
update(name, payload) {
return api.put(`/rules/${encodeURIComponent(name)}`, payload)
},
remove(name) {
return api.delete(`/rules/${encodeURIComponent(name)}`)
},
reload() {
return api.post('/rules/reload')
},
stats() {
return api.get('/rules/_stats')
}
}
/**
* LLM 状态 / 成本 / 控制 API (MVP-3 / D29-D34)
*/
export const llmApi = {
status() {
return api.get('/llm/status')
},
cost() {
return api.get('/llm/cost')
},
costHistory(days = 7) {
return api.get('/llm/cost/history', { params: { days } })
},
costRecords(limit = 20) {
return api.get('/llm/cost/records', { params: { limit } })
},
enable() {
return api.post('/llm/enable')
},
disable() {
return api.post('/llm/disable')
},
reset() {
return api.post('/llm/reset')
}
}