From d0eea9398b7a82ff244a40531f69989f1bc2c76c Mon Sep 17 00:00:00 2001 From: Max Krieger Date: Sun, 14 Apr 2024 13:07:03 -0700 Subject: [PATCH] chore: add default actions --- src/hooks/trainer/useTrainer.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hooks/trainer/useTrainer.ts b/src/hooks/trainer/useTrainer.ts index 6c1906a..a7ca6ee 100644 --- a/src/hooks/trainer/useTrainer.ts +++ b/src/hooks/trainer/useTrainer.ts @@ -181,13 +181,17 @@ export default function useTrainer(): TrainerAPI { return { ...trainingState, actions: { reset: onReset } }; } + const trainingActions = { + downloadEmbeddings: onDownloadEmbeddings, + reset: onReset, + }; + if (trainingState.type === "pretrained") { return { ...trainingState, actions: { + ...trainingActions, train: onTrain, - downloadEmbeddings: onDownloadEmbeddings, - reset: onReset, }, }; } @@ -198,10 +202,7 @@ export default function useTrainer(): TrainerAPI { ) { return { ...trainingState, - actions: { - downloadEmbeddings: onDownloadEmbeddings, - reset: onReset, - }, + actions: trainingActions, }; } @@ -209,9 +210,8 @@ export default function useTrainer(): TrainerAPI { return { ...trainingState, actions: { - downloadEmbeddings: onDownloadEmbeddings, + ...trainingActions, train: onTrain, - reset: onReset, }, }; }