diff --git a/servers/nextjs/app/(presentation-generator)/documents-preview/components/DocumentPreviewPage.tsx b/servers/nextjs/app/(presentation-generator)/documents-preview/components/DocumentPreviewPage.tsx index 78bf7f06..68612808 100644 --- a/servers/nextjs/app/(presentation-generator)/documents-preview/components/DocumentPreviewPage.tsx +++ b/servers/nextjs/app/(presentation-generator)/documents-preview/components/DocumentPreviewPage.tsx @@ -147,12 +147,19 @@ const DocumentsPreviewPage: React.FC = () => { (fileItem: FileItem) => fileItem.file_path ); trackEvent(MixpanelEvent.DocumentsPreview_Create_Presentation_API_Call); - const createResponse = await PresentationGenerationApi.createPresentation( + const createResponse = await PresentationGenerationApi.createPresentation( { content: config?.prompt ?? "", n_slides: config?.slides ? parseInt(config.slides) : null, file_paths: documentPaths, language: config?.language ?? "", + tone: config?.tone, + verbosity: config?.verbosity, + instructions: config?.instructions || null, + include_table_of_contents: !!config?.includeTableOfContents, + include_title_slide: !!config?.includeTitleSlide, + web_search: !!config?.webSearch, + image_type: config?.imageType, } ); diff --git a/servers/nextjs/app/(presentation-generator)/services/api/presentation-generation.ts b/servers/nextjs/app/(presentation-generator)/services/api/presentation-generation.ts index 3b3f3b0f..e249ba9c 100644 --- a/servers/nextjs/app/(presentation-generator)/services/api/presentation-generation.ts +++ b/servers/nextjs/app/(presentation-generator)/services/api/presentation-generation.ts @@ -49,16 +49,30 @@ export class PresentationGenerationApi { } } - static async createPresentation({ + static async createPresentation({ content, n_slides, file_paths, language, + tone, + verbosity, + instructions, + include_table_of_contents, + include_title_slide, + web_search, + image_type, }: { content: string; n_slides: number | null; file_paths?: string[]; language: string | null; + tone?: string | null; + verbosity?: string | null; + instructions?: string | null; + include_table_of_contents?: boolean; + include_title_slide?: boolean; + web_search?: boolean; + image_type?: string | null; }) { try { const response = await fetch( @@ -71,6 +85,13 @@ export class PresentationGenerationApi { n_slides, file_paths, language, + tone, + verbosity, + instructions, + include_table_of_contents, + include_title_slide, + web_search, + image_type, }), cache: "no-cache", } diff --git a/servers/nextjs/app/(presentation-generator)/upload/components/ConfigurationSelects.tsx b/servers/nextjs/app/(presentation-generator)/upload/components/ConfigurationSelects.tsx index 563f092e..be86a274 100644 --- a/servers/nextjs/app/(presentation-generator)/upload/components/ConfigurationSelects.tsx +++ b/servers/nextjs/app/(presentation-generator)/upload/components/ConfigurationSelects.tsx @@ -5,9 +5,9 @@ import { SelectTrigger, SelectValue, } from "@/components/ui/select"; -import { LanguageType, PresentationConfig } from "../type"; +import { ImageType, LanguageType, PresentationConfig, ToneType, VerbosityType } from "../type"; import { useState } from "react"; -import { Check, ChevronsUpDown } from "lucide-react"; +import { Check, ChevronsUpDown, SlidersHorizontal } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Command, @@ -24,11 +24,15 @@ import { } from "@/components/ui/popover"; import { cn } from "@/lib/utils"; import { Input } from "@/components/ui/input"; +import { Switch } from "@/components/ui/switch"; +import { Textarea } from "@/components/ui/textarea"; +import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog"; +import ToolTip from "@/components/ToolTip"; // Types interface ConfigurationSelectsProps { config: PresentationConfig; - onConfigChange: (key: keyof PresentationConfig, value: string) => void; + onConfigChange: (key: keyof PresentationConfig, value: any) => void; } type SlideOption = "5" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" | "18" | "19" | "20"; @@ -192,9 +196,46 @@ export function ConfigurationSelects({ onConfigChange, }: ConfigurationSelectsProps) { const [openLanguage, setOpenLanguage] = useState(false); + const [openAdvanced, setOpenAdvanced] = useState(false); + + const [advancedDraft, setAdvancedDraft] = useState({ + tone: config.tone, + verbosity: config.verbosity, + imageType: config.imageType, + instructions: config.instructions, + includeTableOfContents: config.includeTableOfContents, + includeTitleSlide: config.includeTitleSlide, + webSearch: config.webSearch, + }); + + const handleOpenAdvancedChange = (open: boolean) => { + if (open) { + setAdvancedDraft({ + tone: config.tone, + verbosity: config.verbosity, + imageType: config.imageType, + instructions: config.instructions, + includeTableOfContents: config.includeTableOfContents, + includeTitleSlide: config.includeTitleSlide, + webSearch: config.webSearch, + }); + } + setOpenAdvanced(open); + }; + + const handleSaveAdvanced = () => { + onConfigChange("tone", advancedDraft.tone); + onConfigChange("verbosity", advancedDraft.verbosity); + onConfigChange("imageType", advancedDraft.imageType); + onConfigChange("instructions", advancedDraft.instructions); + onConfigChange("includeTableOfContents", advancedDraft.includeTableOfContents); + onConfigChange("includeTitleSlide", advancedDraft.includeTitleSlide); + onConfigChange("webSearch", advancedDraft.webSearch); + setOpenAdvanced(false); + }; return ( -