improve RunButton prompt

This commit is contained in:
josc146 2023-07-28 12:45:13 +08:00
parent daabcf58a0
commit 4e18222a35

View File

@ -149,9 +149,16 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean
}).then(async (r) => { }).then(async (r) => {
if (r.ok) { if (r.ok) {
commonStore.setStatus({ status: ModelStatus.Working }); commonStore.setStatus({ status: ModelStatus.Working });
toastWithButton(t('Startup Completed'), t('Chat'), () => { let buttonNameMap = {
navigate({ pathname: '/chat' }); 'novel': 'Completion',
}, { type: 'success', autoClose: 3000 }); '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) { } else if (r.status === 304) {
toast(t('Loading Model'), { type: 'info' }); toast(t('Loading Model'), { type: 'info' });
} else { } else {