[Update/Refactor] Add link to notification component to guide users to get more information.
(handleAiModelsAvailability)
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
import { useStore_IsVrctAvailable } from "@store";
|
||||
import { useNotificationStatus } from "@logics_common";
|
||||
|
||||
export const useIsVrctAvailable = () => {
|
||||
const { currentIsVrctAvailable, updateIsVrctAvailable } = useStore_IsVrctAvailable();
|
||||
const { showNotification_Success, showNotification_Error } = useNotificationStatus();
|
||||
|
||||
const handleAiModelsAvailability = (is_ai_models_available) => {
|
||||
if (is_ai_models_available === false) {
|
||||
updateIsVrctAvailable(false);
|
||||
showNotification_Error("AI models have not been detected. Check the network connection and restart VRCT (it will download automatically, normally).", { hide_duration: null });
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
currentIsVrctAvailable,
|
||||
updateIsVrctAvailable,
|
||||
|
||||
handleAiModelsAvailability,
|
||||
};
|
||||
};
|
||||
33
src-ui/logics/common/useIsVrctAvailable.jsx
Normal file
33
src-ui/logics/common/useIsVrctAvailable.jsx
Normal file
@@ -0,0 +1,33 @@
|
||||
import { useStore_IsVrctAvailable } from "@store";
|
||||
import { useNotificationStatus } from "@logics_common";
|
||||
import { HomepageLinkButton } from "@common_components";
|
||||
|
||||
export const useIsVrctAvailable = () => {
|
||||
const { currentIsVrctAvailable, updateIsVrctAvailable } = useStore_IsVrctAvailable();
|
||||
const { showNotification_Success, showNotification_Error } = useNotificationStatus();
|
||||
|
||||
const handleAiModelsAvailability = (is_ai_models_available) => {
|
||||
if (is_ai_models_available === false) {
|
||||
updateIsVrctAvailable(false);
|
||||
const ErrorComponent = () => {
|
||||
return (
|
||||
<div>
|
||||
<p>AI models have not been detected. Check the network connection and restart VRCT (it will download automatically, normally).</p>
|
||||
<p>If this error occurs frequently, try the following:</p>
|
||||
<HomepageLinkButton
|
||||
homepage_link="https://github.com/misyaguziya/VRCT/wiki/Manual-Installation-of-AI-Model-Weights"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
showNotification_Error(ErrorComponent, { hide_duration: null });
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
currentIsVrctAvailable,
|
||||
updateIsVrctAvailable,
|
||||
|
||||
handleAiModelsAvailability,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user