File size: 1,715 Bytes
801f06c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | import { useQuery } from '@tanstack/react-query';
import { api } from './client';
export const unavailable = {
dialogue:
'AI dialogue drafting is not functional at the moment for this MVP. You can write and save dialogue manually.',
animation:
'Talking video is unavailable until the GPU model service is ready and rendering is enabled. You can prepare a silent storyboard.',
speechStyle:
'Automatic speech-style controls are not functional at the moment for this MVP. Existing preferences are preserved.',
performance:
'Voice performance and gesture controls are not functional at the moment for this MVP. Existing settings are preserved.',
voiceDirection:
'Custom voice-direction instructions are not applied by the current speech model.',
worker: 'Rendering is unavailable at the moment because the render worker is offline.',
checking: 'Feature availability is being checked. Please try again shortly.',
disconnected: 'Feature availability could not be checked. Reconnect to the backend to render.',
};
export function useCapabilities() {
const status = useQuery({ queryKey: ['system'], queryFn: api.status, refetchInterval: 15000 });
const dialogue = status.data?.capabilities.ai_dialogue === true;
const animation = status.data?.capabilities.animated_video === true;
const workerReason = status.isError
? unavailable.disconnected
: status.isPending
? unavailable.checking
: !status.data?.worker
? unavailable.worker
: undefined;
return {
dialogue,
animation,
dialogueReason: dialogue ? undefined : unavailable.dialogue,
animationReason: animation ? undefined : unavailable.animation,
workerReason,
};
}
|