Improve AI logic

This commit is contained in:
Urtzi Alfaro
2025-11-05 13:34:56 +01:00
parent 5c87fbcf48
commit 394ad3aea4
218 changed files with 30627 additions and 7658 deletions

View File

@@ -370,24 +370,38 @@ const ModelsConfigPage: React.FC = () => {
handleStartTraining(status.ingredient);
}
}}
actions={[
// Primary action - View details or train model
{
label: status.hasModel ? 'Ver Detalles' : 'Entrenar',
icon: status.hasModel ? Eye : Play,
onClick: () => status.hasModel
? handleViewModelDetails(status.ingredient)
: handleStartTraining(status.ingredient),
priority: 'primary' as const
},
// Secondary action - Retrain if model exists
...(status.hasModel ? [{
label: 'Reentrenar',
icon: RotateCcw,
onClick: () => handleStartRetraining(status.ingredient),
priority: 'secondary' as const
}] : [])
]}
actions={
(() => {
if (status.hasModel) {
// For models that exist: prioritize retraining action as primary (text button)
// and details as secondary (icon button)
return [
{
label: 'Reentrenar',
icon: RotateCcw,
onClick: () => handleStartRetraining(status.ingredient),
priority: 'primary' as const
},
{
label: 'Ver Detalles',
icon: Eye,
onClick: () => handleViewModelDetails(status.ingredient),
priority: 'secondary' as const
}
];
} else {
// For models that don't exist: only train action
return [
{
label: 'Entrenar',
icon: Play,
onClick: () => handleStartTraining(status.ingredient),
priority: 'primary' as const
}
];
}
})()
}
/>
);
})
@@ -479,6 +493,12 @@ const ModelsConfigPage: React.FC = () => {
isOpen={showModelDetailsModal}
onClose={() => setShowModelDetailsModal(false)}
model={selectedModel}
onRetrain={handleRetrain}
onViewPredictions={(modelId) => {
// TODO: Navigate to forecast history or predictions view
// This should show historical predictions vs actual sales
console.log('View predictions for model:', modelId);
}}
/>
)}