Add advanced generation options with Explicit and Smart modes

- Implemented `AdvancedGenerationOptions` component for toggling Explicit and Smart modes with confirmation dialogs.
- Integrated generation options into `GhostWriter`, `DraftCompanion`, and `ShortStoryGenerator`.
- Introduced `ToggleWithConfirmation` component for user interaction with alerts.
- Updated `InputField` to support centered alignment for better layout flexibility.
- Localized Explicit and Smart mode strings in English and French.
- Enhanced content preview logic to filter placeholder text before display.
- Added `autoUpdater` initialization checks and refactored updater setup for improved reliability.
This commit is contained in:
natreex
2026-01-17 23:26:22 -05:00
parent 0020b3abbd
commit c62a7eb0f7
11 changed files with 335 additions and 34 deletions

View File

@@ -34,6 +34,7 @@ import QuillSense, {AIGeneratedText} from "@/lib/models/QuillSense";
import {AIUsageContext, AIUsageContextProps} from "@/context/AIUsageContext";
import {LangContext} from "@/context/LangContext";
import {configs} from "@/lib/configs";
import AdvancedGenerationOptions from "@/components/form/AdvancedGenerationOptions";
export default function GhostWriter() {
const t = useTranslations();
@@ -61,7 +62,10 @@ export default function GhostWriter() {
const [taguedObjects, setTaguedObjects] = useState<string[]>([]);
const [taguedWorldElements, setTaguedWorldElements] = useState<string[]>([]);
const [abortController, setAbortController] = useState<ReadableStreamDefaultReader<Uint8Array> | null>(null);
const [useExplicit, setUseExplicit] = useState<boolean>(false);
const [useSmart, setUseSmart] = useState<boolean>(false);
const isGPTEnabled: boolean = QuillSense.isOpenAIEnabled(session);
const isSubTierTree: boolean = QuillSense.getSubLevel(session) === 3;
const hasAccess: boolean = isGPTEnabled || isSubTierTree;
@@ -147,6 +151,8 @@ export default function GhostWriter() {
objects: taguedObjects,
worldElements: taguedWorldElements,
},
useExplicit: useExplicit,
useSmart: useSmart,
}),
});
@@ -371,6 +377,13 @@ export default function GhostWriter() {
}
/>
</div>
<AdvancedGenerationOptions
useExplicit={useExplicit}
setUseExplicit={setUseExplicit}
useSmart={useSmart}
setUseSmart={setUseSmart}
/>
</div>
) : advanceSettings && (
<GhostWriterSettings advancedPrompt={advancedPrompt} setAdvancedPrompt={setAdvancedPrompt}/>
@@ -404,7 +417,7 @@ export default function GhostWriter() {
<FontAwesomeIcon icon={faTags} className={'w-5 h-5'}/>
<span>{t("ghostWriter.tags.addTagPlaceholder")}</span>
</button>
<SubmitButtonWLoading
callBackAction={handleGenerateGhostWriter}
isLoading={isGenerating}