From 4e18222a35efab24b267e6d1064e094ddf5d1df2 Mon Sep 17 00:00:00 2001 From: josc146 Date: Fri, 28 Jul 2023 12:45:13 +0800 Subject: [PATCH] improve RunButton prompt --- frontend/src/components/RunButton.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/RunButton.tsx b/frontend/src/components/RunButton.tsx index 7cc13b2..b43f0e2 100644 --- a/frontend/src/components/RunButton.tsx +++ b/frontend/src/components/RunButton.tsx @@ -149,9 +149,16 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean }).then(async (r) => { if (r.ok) { commonStore.setStatus({ status: ModelStatus.Working }); - toastWithButton(t('Startup Completed'), t('Chat'), () => { - navigate({ pathname: '/chat' }); - }, { type: 'success', autoClose: 3000 }); + let buttonNameMap = { + 'novel': 'Completion', + 'midi': 'Composition' + }; + let buttonName = 'Chat'; + buttonName = Object.entries(buttonNameMap).find(([key, value]) => modelName.toLowerCase().includes(key))?.[1] || buttonName; + const buttonFn = () => { + navigate({ pathname: '/' + buttonName.toLowerCase() }); + }; + toastWithButton(t('Startup Completed'), t(buttonName), buttonFn, { type: 'success', autoClose: 3000 }); } else if (r.status === 304) { toast(t('Loading Model'), { type: 'info' }); } else {