2025-12-04 07:41:54 -05:00
|
|
|
import { StudyListResponse, HistoryResponse, PruningResponse, StudyStatus } from '../types';
|
feat: Major update with validators, skills, dashboard, and docs reorganization
- Add validation framework (config, model, results, study validators)
- Add Claude Code skills (create-study, run-optimization, generate-report,
troubleshoot, analyze-model)
- Add Atomizer Dashboard (React frontend + FastAPI backend)
- Reorganize docs into structured directories (00-09)
- Add neural surrogate modules and training infrastructure
- Add multi-objective optimization support
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 19:23:58 -05:00
|
|
|
|
|
|
|
|
const API_BASE = '/api';
|
|
|
|
|
|
|
|
|
|
class ApiClient {
|
|
|
|
|
async getStudies(): Promise<StudyListResponse> {
|
|
|
|
|
const response = await fetch(`${API_BASE}/optimization/studies`);
|
|
|
|
|
if (!response.ok) throw new Error('Failed to fetch studies');
|
|
|
|
|
return response.json();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getStudyStatus(studyId: string): Promise<StudyStatus> {
|
|
|
|
|
const response = await fetch(`${API_BASE}/optimization/studies/${studyId}/status`);
|
|
|
|
|
if (!response.ok) throw new Error('Failed to fetch study status');
|
|
|
|
|
return response.json();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getStudyHistory(studyId: string): Promise<HistoryResponse> {
|
|
|
|
|
const response = await fetch(`${API_BASE}/optimization/studies/${studyId}/history`);
|
|
|
|
|
if (!response.ok) throw new Error('Failed to fetch study history');
|
|
|
|
|
return response.json();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getStudyPruning(studyId: string): Promise<PruningResponse> {
|
|
|
|
|
const response = await fetch(`${API_BASE}/optimization/studies/${studyId}/pruning`);
|
|
|
|
|
if (!response.ok) throw new Error('Failed to fetch pruning data');
|
|
|
|
|
return response.json();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async createStudy(config: any): Promise<{ study_id: string }> {
|
|
|
|
|
const response = await fetch(`${API_BASE}/optimization/studies`, {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: { 'Content-Type': 'application/json' },
|
|
|
|
|
body: JSON.stringify(config),
|
|
|
|
|
});
|
|
|
|
|
if (!response.ok) throw new Error('Failed to create study');
|
|
|
|
|
return response.json();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getStudyReport(studyId: string): Promise<{ content: string }> {
|
|
|
|
|
const response = await fetch(`${API_BASE}/optimization/studies/${studyId}/report`);
|
|
|
|
|
if (!response.ok) throw new Error('Failed to fetch report');
|
|
|
|
|
return response.json();
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-04 07:41:54 -05:00
|
|
|
async getConsoleOutput(studyId: string, lines: number = 200): Promise<{
|
|
|
|
|
lines: string[];
|
|
|
|
|
total_lines: number;
|
|
|
|
|
displayed_lines: number;
|
|
|
|
|
log_file: string | null;
|
|
|
|
|
timestamp: string;
|
|
|
|
|
message?: string;
|
|
|
|
|
}> {
|
|
|
|
|
const response = await fetch(`${API_BASE}/optimization/studies/${studyId}/console?lines=${lines}`);
|
|
|
|
|
if (!response.ok) throw new Error('Failed to fetch console output');
|
|
|
|
|
return response.json();
|
|
|
|
|
}
|
|
|
|
|
|
feat: Major update with validators, skills, dashboard, and docs reorganization
- Add validation framework (config, model, results, study validators)
- Add Claude Code skills (create-study, run-optimization, generate-report,
troubleshoot, analyze-model)
- Add Atomizer Dashboard (React frontend + FastAPI backend)
- Reorganize docs into structured directories (00-09)
- Add neural surrogate modules and training infrastructure
- Add multi-objective optimization support
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 19:23:58 -05:00
|
|
|
// Future endpoints for control
|
|
|
|
|
async startOptimization(studyId: string): Promise<void> {
|
|
|
|
|
const response = await fetch(`${API_BASE}/optimization/studies/${studyId}/start`, { method: 'POST' });
|
|
|
|
|
if (!response.ok) throw new Error('Failed to start optimization');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async stopOptimization(studyId: string): Promise<void> {
|
|
|
|
|
const response = await fetch(`${API_BASE}/optimization/studies/${studyId}/stop`, { method: 'POST' });
|
|
|
|
|
if (!response.ok) throw new Error('Failed to stop optimization');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const apiClient = new ApiClient();
|