try to fix live RT updates on ANNOTATE
This commit is contained in:
@@ -80,7 +80,15 @@
|
||||
|
||||
<button class="btn btn-success btn-sm w-100" id="start-inference-btn">
|
||||
<i class="fas fa-play"></i>
|
||||
Start Live Inference
|
||||
Start Live Inference (No Training)
|
||||
</button>
|
||||
<button class="btn btn-info btn-sm w-100 mt-1" id="start-inference-pivot-btn">
|
||||
<i class="fas fa-chart-line"></i>
|
||||
Live Inference + Pivot Training
|
||||
</button>
|
||||
<button class="btn btn-primary btn-sm w-100 mt-1" id="start-inference-candle-btn">
|
||||
<i class="fas fa-graduation-cap"></i>
|
||||
Live Inference + Per-Candle Training
|
||||
</button>
|
||||
<button class="btn btn-danger btn-sm w-100 mt-1" id="stop-inference-btn" style="display: none;">
|
||||
<i class="fas fa-stop"></i>
|
||||
@@ -511,7 +519,8 @@
|
||||
document.getElementById('active-steps').textContent = steps;
|
||||
});
|
||||
|
||||
document.getElementById('start-inference-btn').addEventListener('click', function () {
|
||||
// Helper function to start inference with different modes
|
||||
function startInference(enableLiveTraining, trainEveryCandle) {
|
||||
const modelName = document.getElementById('model-select').value;
|
||||
|
||||
if (!modelName) {
|
||||
@@ -519,9 +528,8 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Get primary timeframe and prediction steps
|
||||
const primaryTimeframe = document.getElementById('primary-timeframe-select').value;
|
||||
const predictionSteps = parseInt(document.getElementById('prediction-steps-slider').value);
|
||||
// Get timeframe
|
||||
const timeframe = document.getElementById('primary-timeframe-select').value;
|
||||
|
||||
// Start real-time inference
|
||||
fetch('/api/realtime-inference/start', {
|
||||
@@ -530,8 +538,9 @@
|
||||
body: JSON.stringify({
|
||||
model_name: modelName,
|
||||
symbol: appState.currentSymbol,
|
||||
primary_timeframe: primaryTimeframe,
|
||||
prediction_steps: predictionSteps
|
||||
timeframe: timeframe,
|
||||
enable_live_training: enableLiveTraining,
|
||||
train_every_candle: trainEveryCandle
|
||||
})
|
||||
})
|
||||
.then(response => response.json())
|
||||
@@ -541,6 +550,8 @@
|
||||
|
||||
// Update UI
|
||||
document.getElementById('start-inference-btn').style.display = 'none';
|
||||
document.getElementById('start-inference-pivot-btn').style.display = 'none';
|
||||
document.getElementById('start-inference-candle-btn').style.display = 'none';
|
||||
document.getElementById('stop-inference-btn').style.display = 'block';
|
||||
document.getElementById('inference-status').style.display = 'block';
|
||||
document.getElementById('inference-controls').style.display = 'block';
|
||||
@@ -558,7 +569,10 @@
|
||||
// Start polling for signals
|
||||
startSignalPolling();
|
||||
|
||||
showSuccess('Real-time inference started - Charts now updating live');
|
||||
const trainingMode = data.training_mode || 'inference-only';
|
||||
const modeText = trainingMode === 'per-candle' ? ' with per-candle training' :
|
||||
(trainingMode === 'pivot-based' ? ' with pivot training' : '');
|
||||
showSuccess('Real-time inference started' + modeText);
|
||||
} else {
|
||||
showError('Failed to start inference: ' + data.error.message);
|
||||
}
|
||||
@@ -566,6 +580,19 @@
|
||||
.catch(error => {
|
||||
showError('Network error: ' + error.message);
|
||||
});
|
||||
}
|
||||
|
||||
// Button handlers for different inference modes
|
||||
document.getElementById('start-inference-btn').addEventListener('click', function () {
|
||||
startInference(false, false); // No training
|
||||
});
|
||||
|
||||
document.getElementById('start-inference-pivot-btn').addEventListener('click', function () {
|
||||
startInference(true, false); // Pivot-based training
|
||||
});
|
||||
|
||||
document.getElementById('start-inference-candle-btn').addEventListener('click', function () {
|
||||
startInference(false, true); // Per-candle training
|
||||
});
|
||||
|
||||
document.getElementById('stop-inference-btn').addEventListener('click', function () {
|
||||
@@ -582,6 +609,8 @@
|
||||
if (data.success) {
|
||||
// Update UI
|
||||
document.getElementById('start-inference-btn').style.display = 'block';
|
||||
document.getElementById('start-inference-pivot-btn').style.display = 'block';
|
||||
document.getElementById('start-inference-candle-btn').style.display = 'block';
|
||||
document.getElementById('stop-inference-btn').style.display = 'none';
|
||||
document.getElementById('inference-status').style.display = 'none';
|
||||
document.getElementById('inference-controls').style.display = 'none';
|
||||
|
||||
Reference in New Issue
Block a user