diff --git a/frontend/src/api/report.js b/frontend/src/api/report.js new file mode 100644 index 0000000..e4eefa2 --- /dev/null +++ b/frontend/src/api/report.js @@ -0,0 +1,43 @@ +import service, { requestWithRetry } from './index' + +/** + * 开始报告生成 + * @param {Object} data - { simulation_id, force_regenerate? } + */ +export const generateReport = (data) => { + return requestWithRetry(() => service.post('/api/report/generate', data), 3, 1000) +} + +/** + * 获取报告生成状态 + * @param {string} reportId + */ +export const getReportStatus = (reportId) => { + return service.get(`/api/report/generate/status`, { params: { report_id: reportId } }) +} + +/** + * 获取 Agent 日志(增量) + * @param {string} reportId + * @param {number} fromLine - 从第几行开始获取 + */ +export const getAgentLog = (reportId, fromLine = 0) => { + return service.get(`/api/report/${reportId}/agent-log`, { params: { from_line: fromLine } }) +} + +/** + * 获取控制台日志(增量) + * @param {string} reportId + * @param {number} fromLine - 从第几行开始获取 + */ +export const getConsoleLog = (reportId, fromLine = 0) => { + return service.get(`/api/report/${reportId}/console-log`, { params: { from_line: fromLine } }) +} + +/** + * 获取报告详情 + * @param {string} reportId + */ +export const getReport = (reportId) => { + return service.get(`/api/report/${reportId}`) +} diff --git a/frontend/src/components/Step3Simulation.vue b/frontend/src/components/Step3Simulation.vue index cbaeab6..a692442 100644 --- a/frontend/src/components/Step3Simulation.vue +++ b/frontend/src/components/Step3Simulation.vue @@ -93,10 +93,12 @@