mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-01-20 02:18:07 -05:00
make logic more straight forward
This commit is contained in:
@@ -11,7 +11,7 @@ export const DisabledModelWarning = () => {
|
||||
const model = useAppSelector(selectModel);
|
||||
|
||||
const accountSettingsLink = useStore($accountSettingsLink);
|
||||
const isChatGPT4oHighModelDisabled = useIsModelDisabled('chatGPT4oHigh');
|
||||
const { isChatGPT4oHighModelDisabled } = useIsModelDisabled();
|
||||
|
||||
if (!model || !isChatGPT4oHighModelDisabled(model)) {
|
||||
return null;
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
import type { AppFeature } from 'app/types/invokeai';
|
||||
import type { ParameterModel } from 'features/parameters/types/parameterSchemas';
|
||||
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
export const useIsModelDisabled = (feature: AppFeature) => {
|
||||
const isEnabled = useFeatureStatus(feature);
|
||||
export const useIsModelDisabled = () => {
|
||||
const isChatGPT4oHighEnabled = useFeatureStatus('chatGPT4oHigh');
|
||||
|
||||
const isModelDisabled = useCallback(
|
||||
const isChatGPT4oHighModelDisabled = useCallback(
|
||||
(model: ParameterModel) => {
|
||||
return model?.base === 'chatgpt-4o' && model.name.toLowerCase().includes('high') && !isEnabled;
|
||||
return model?.base === 'chatgpt-4o' && model.name.toLowerCase().includes('high') && !isChatGPT4oHighEnabled;
|
||||
},
|
||||
[isEnabled]
|
||||
[isChatGPT4oHighEnabled]
|
||||
);
|
||||
|
||||
return isModelDisabled;
|
||||
return { isChatGPT4oHighModelDisabled };
|
||||
};
|
||||
|
||||
@@ -153,7 +153,7 @@ export const useReadinessWatcher = () => {
|
||||
const canvasIsSelectingObject = useStore(canvasManager?.stateApi.$isSegmenting ?? $true);
|
||||
const canvasIsCompositing = useStore(canvasManager?.compositor.$isBusy ?? $true);
|
||||
const isInPublishFlow = useStore($isInPublishFlow);
|
||||
const isChatGPT4oHighModelDisabled = useIsModelDisabled('chatGPT4oHigh');
|
||||
const { isChatGPT4oHighModelDisabled } = useIsModelDisabled();
|
||||
|
||||
useEffect(() => {
|
||||
debouncedUpdateReasons(
|
||||
|
||||
Reference in New Issue
Block a user