Improve AI logic
This commit is contained in:
@@ -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);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user