|
@@ -675,6 +675,7 @@ ${antiText}
|
|
|
|
|
|
|
|
// Auto-mode: auto-trigger generation on mount
|
|
// Auto-mode: auto-trigger generation on mount
|
|
|
const autoContentStartedRef = useRef(false);
|
|
const autoContentStartedRef = useRef(false);
|
|
|
|
|
+ const autoDeAIStartedRef = useRef(false);
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
if (autoMode && apiSettings && !autoContentStartedRef.current && !content && !isGenerating) {
|
|
if (autoMode && apiSettings && !autoContentStartedRef.current && !content && !isGenerating) {
|
|
|
autoContentStartedRef.current = true;
|
|
autoContentStartedRef.current = true;
|
|
@@ -682,15 +683,23 @@ ${antiText}
|
|
|
}
|
|
}
|
|
|
}, [autoMode]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
}, [autoMode]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
|
|
|
|
|
|
- // Auto-mode: auto-advance after generation completes
|
|
|
|
|
|
|
+ // Auto-mode: auto-run de-AI after generation, then auto-advance
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
- if (autoMode && hasGenerated && content.trim() && !isGenerating) {
|
|
|
|
|
|
|
+ if (!autoMode) return;
|
|
|
|
|
+ // Step 1: Content generated, now auto-run de-AI
|
|
|
|
|
+ if (hasGenerated && content.trim() && !isGenerating && !isDeAI && !autoDeAIStartedRef.current && apiSettings) {
|
|
|
|
|
+ autoDeAIStartedRef.current = true;
|
|
|
|
|
+ handleDeAI();
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ // Step 2: de-AI complete, auto-advance
|
|
|
|
|
+ if (hasGenerated && content.trim() && !isGenerating && !isDeAI && autoDeAIStartedRef.current) {
|
|
|
const timer = setTimeout(() => {
|
|
const timer = setTimeout(() => {
|
|
|
onNext(content);
|
|
onNext(content);
|
|
|
}, 2000);
|
|
}, 2000);
|
|
|
return () => clearTimeout(timer);
|
|
return () => clearTimeout(timer);
|
|
|
}
|
|
}
|
|
|
- }, [autoMode, hasGenerated, content, isGenerating, onNext]);
|
|
|
|
|
|
|
+ }, [autoMode, hasGenerated, content, isGenerating, isDeAI, onNext, apiSettings, handleDeAI]);
|
|
|
|
|
|
|
|
const handleNext = () => {
|
|
const handleNext = () => {
|
|
|
if (!content.trim()) return;
|
|
if (!content.trim()) return;
|