mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-29 09:44:47 +00:00
feat: 错误提示
This commit is contained in:
@@ -120,11 +120,15 @@ const ModelDetail = () => {
|
||||
try {
|
||||
await putModelTrainingStatus(model._id);
|
||||
loadModel();
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
toast({
|
||||
title: error.message || '更新失败',
|
||||
status: 'error'
|
||||
});
|
||||
}
|
||||
setLoading(false);
|
||||
}, [setLoading, loadModel, model]);
|
||||
}, [model, setLoading, loadModel, toast]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@@ -10,10 +10,12 @@ import { useScreen } from '@/hooks/useScreen';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useLoading } from '@/hooks/useLoading';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { useToast } from '@/hooks/useToast';
|
||||
|
||||
const CreateModel = dynamic(() => import('./components/CreateModel'));
|
||||
|
||||
const ModelList = () => {
|
||||
const { toast } = useToast();
|
||||
const { isPc } = useScreen();
|
||||
const router = useRouter();
|
||||
const [models, setModels] = useState<ModelType[]>([]);
|
||||
@@ -43,12 +45,16 @@ const ModelList = () => {
|
||||
router.push(`/chat?chatId=${chatId}`, undefined, {
|
||||
shallow: true
|
||||
});
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
console.error(err);
|
||||
toast({
|
||||
title: err.message || '出现一些异常',
|
||||
status: 'error'
|
||||
});
|
||||
}
|
||||
setIsLoading(false);
|
||||
},
|
||||
[router, setIsLoading]
|
||||
[router, setIsLoading, toast]
|
||||
);
|
||||
|
||||
return (
|
||||
|
Reference in New Issue
Block a user