sync active training with UI if running
This commit is contained in:
@@ -1241,6 +1241,48 @@ class AnnotationDashboard:
|
||||
}
|
||||
})
|
||||
|
||||
@self.server.route('/api/active-training', methods=['GET'])
|
||||
def get_active_training():
|
||||
"""
|
||||
Get currently active training session (if any)
|
||||
Allows UI to resume tracking after page reload or across multiple clients
|
||||
"""
|
||||
try:
|
||||
if not self.training_adapter:
|
||||
return jsonify({
|
||||
'success': False,
|
||||
'active': False,
|
||||
'error': {
|
||||
'code': 'TRAINING_UNAVAILABLE',
|
||||
'message': 'Real training adapter not available'
|
||||
}
|
||||
})
|
||||
|
||||
active_session = self.training_adapter.get_active_training_session()
|
||||
|
||||
if active_session:
|
||||
return jsonify({
|
||||
'success': True,
|
||||
'active': True,
|
||||
'session': active_session
|
||||
})
|
||||
else:
|
||||
return jsonify({
|
||||
'success': True,
|
||||
'active': False
|
||||
})
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting active training: {e}")
|
||||
return jsonify({
|
||||
'success': False,
|
||||
'active': False,
|
||||
'error': {
|
||||
'code': 'ACTIVE_TRAINING_ERROR',
|
||||
'message': str(e)
|
||||
}
|
||||
})
|
||||
|
||||
# Live Training API Endpoints
|
||||
@self.server.route('/api/live-training/start', methods=['POST'])
|
||||
def start_live_training():
|
||||
|
||||
Reference in New Issue
Block a user