improve error messages

This commit is contained in:
josc146
2023-06-16 00:35:39 +08:00
parent b1d5b84dd6
commit b06e292989
2 changed files with 4 additions and 8 deletions

View File

@@ -196,7 +196,7 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean
model: modelPath,
strategy: getStrategy(modelConfig),
customCuda: customCudaFile !== ''
}).then((r) => {
}).then(async (r) => {
if (r.ok) {
commonStore.setStatus({ status: ModelStatus.Working });
toastWithButton(t('Startup Completed'), t('Chat'), () => {
@@ -206,14 +206,11 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean
toast(t('Loading Model'), { type: 'info' });
} else {
commonStore.setStatus({ status: ModelStatus.Offline });
toast(t('Failed to switch model'), { type: 'error' });
toast(t('Failed to switch model') + ' - ' + await r.text(), { type: 'error' });
}
}).catch(() => {
}).catch((e) => {
commonStore.setStatus({ status: ModelStatus.Offline });
if (commonStore.platform === 'windows')
toast(t('Failed to switch model, please try starting the program with administrator privileges or increasing your virtual memory.'), { type: 'error' });
else
toast(t('Failed to switch model'), { type: 'error' });
toast(t('Failed to switch model') + ' - ' + e.message || e, { type: 'error' });
});
}
}).catch(() => {