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

@@ -33,6 +33,7 @@ import {BookTags} from "@/lib/models/Book";
import {AIUsageContext, AIUsageContextProps} from "@/context/AIUsageContext";
import {configs} from "@/lib/configs";
import OfflineContext, {OfflineContextType} from "@/context/OfflineContext";
import AdvancedGenerationOptions from "@/components/form/AdvancedGenerationOptions";
interface CompanionContent {
version: number;
@@ -95,6 +96,9 @@ export default function DraftCompanion() {
const [showObjectSuggestions, setShowObjectSuggestions] = useState<boolean>(false);
const [showWorldElementSuggestions, setShowWorldElementSuggestions] = useState<boolean>(false);
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) && !isCurrentlyOffline() && !book?.localBook;
@@ -222,7 +226,9 @@ export default function DraftCompanion() {
locations: taguedLocations,
objects: taguedObjects,
worldElements: taguedWorldElements,
}
},
useExplicit: useExplicit,
useSmart: useSmart,
}),
});
@@ -432,7 +438,7 @@ export default function DraftCompanion() {
return element ? element.label : value;
}
if (showEnhancer && hasAccess && book?.quillsenseEnabled !== false) {
if (showEnhancer && book?.quillsenseEnabled !== false) {
return (
<div className="flex flex-col h-full min-h-0 overflow-hidden">
<div
@@ -539,6 +545,13 @@ export default function DraftCompanion() {
}
/>
</div>
<AdvancedGenerationOptions
useExplicit={useExplicit}
setUseExplicit={setUseExplicit}
useSmart={useSmart}
setUseSmart={setUseSmart}
/>
</div>
<div