Implement comprehensive API documentation system

 Features:
- Comprehensive Pydantic response models with examples
- Enhanced FastAPI configuration with rich OpenAPI metadata
- Centralized error handling with standardized error codes
- Professional Swagger UI styling and branding
- Health check endpoints with detailed component status
- Type-safe request/response models for all endpoints

📊 Coverage:
- Agent Management API fully documented
- Standardized error responses across all endpoints
- Interactive API documentation with try-it-now functionality
- Custom OpenAPI schema with authentication schemes

🛠️ Technical Improvements:
- Created app/models/responses.py with comprehensive models
- Added app/core/error_handlers.py for centralized error handling
- Enhanced app/api/agents.py with detailed documentation
- Custom documentation configuration in app/docs_config.py
- Global exception handlers for consistent error responses

🌐 Access Points:
- Swagger UI: /docs
- ReDoc: /redoc
- OpenAPI JSON: /openapi.json

This establishes professional-grade API documentation that matches
Hive's technical excellence and provides developers with comprehensive,
interactive documentation for efficient integration.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
anthonyrawlins
2025-07-12 10:21:08 +10:00
parent 8619b75296
commit ca18476efc
16 changed files with 1868 additions and 152 deletions

File diff suppressed because one or more lines are too long

View File

@@ -61,7 +61,7 @@
}
}
</style>
<script type="module" crossorigin src="/assets/index-BsrGdklV.js"></script>
<script type="module" crossorigin src="/assets/index-CtgZ0k19.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CBw2HfAv.css">
</head>
<body>

View File

@@ -77,17 +77,17 @@ export class WebSocketService {
private reconnectDelay = 1000;
constructor() {
this.connect();
// Don't auto-connect - let the app connect when authenticated
}
private connect(): void {
private _connect(): void {
const token = localStorage.getItem('token');
if (!token) {
console.warn('No auth token found for WebSocket connection');
return;
}
const baseURL = process.env.VITE_API_BASE_URL || 'http://localhost:8087';
const baseURL = process.env.REACT_APP_SOCKETIO_URL || 'https://hive.home.deepblack.cloud';
this.socket = io(baseURL, {
auth: {
@@ -193,11 +193,27 @@ export class WebSocketService {
console.log(`Attempting to reconnect (${this.reconnectAttempts}/${this.maxReconnectAttempts}) in ${delay}ms`);
setTimeout(() => {
this.connect();
this._connect();
}, delay);
}
// Public methods
public connect(): void {
if (this.socket?.connected) {
console.log('WebSocket already connected');
return;
}
this._connect();
}
public disconnect(): void {
if (this.socket) {
this.socket.disconnect();
this.socket = null;
this.reconnectAttempts = 0;
}
}
public setEventHandlers(handlers: WebSocketEventHandlers): void {
this.handlers = { ...this.handlers, ...handlers };
}
@@ -218,10 +234,6 @@ export class WebSocketService {
this.socket?.emit(event, data);
}
public disconnect(): void {
this.socket?.disconnect();
this.socket = null;
}
public isConnected(): boolean {
return this.socket?.connected ?? false;