diff --git a/app/constants.ts b/app/constants.ts index 0ee28bbc..85c8951a 100644 --- a/app/constants.ts +++ b/app/constants.ts @@ -4,7 +4,7 @@ import path from "path" export const localhost = "http://0.0.0.0" -export const isDev = !app.isPackaged; +export const isDev = false; export const baseDir = app.getAppPath(); export const fastapiDir = isDev ? path.join(baseDir, "servers/fastapi") : path.join(baseDir, "resources/fastapi"); export const nextjsDir = isDev ? path.join(baseDir, "servers/nextjs") : path.join(baseDir, "resources/nextjs"); diff --git a/servers/nextjs/app/(presentation-generator)/components/ImageEditor.tsx b/servers/nextjs/app/(presentation-generator)/components/ImageEditor.tsx index 8ed712a6..b058be46 100644 --- a/servers/nextjs/app/(presentation-generator)/components/ImageEditor.tsx +++ b/servers/nextjs/app/(presentation-generator)/components/ImageEditor.tsx @@ -234,27 +234,7 @@ const ImageEditor = ({ } }; - const handleSearchImage = async () => { - const presentation_id = path.split("/")[2]; - try { - setIsSearching(true); - setError(null); - - const response = await PresentationGenerationApi.imageSearch({ - presentation_id: presentation_id, - query: searchQuery, - page: 1, - limit: 20, - }); - - setSearchedImages(response.urls); - } catch (err) { - setError("Failed to fetch images. Please try again."); - } finally { - setIsSearching(false); - } - }; const handleFileUpload = async ( event: React.ChangeEvent @@ -527,13 +507,7 @@ const ImageEditor = ({ AI Generate - - Web Images - + Upload @@ -599,58 +573,6 @@ const ImageEditor = ({ - - -
{ - e.preventDefault(); - handleSearchImage(); - }} - > -
- - setSearchQuery(e.target.value)} - className="pl-10" - /> -
- -
- {error &&

{error}

} - -
- {isSearching - ? Array.from({ length: 6 }).map((_, index) => ( - - )) - : searchedImages.map((imgSrc, index) => ( -
handleImageChange(imgSrc)} - className="aspect-[4/3] cursor-pointer group relative rounded-lg overflow-hidden" - > - {`Search -
-
- ))} -
- -
{ const textareaRef = useRef(null); // Redux state - const { config, reports, documents, images, charts, tables } = useSelector( + const { config, documents, images, charts, tables } = useSelector( (state: RootState) => state.pptGenUpload ); @@ -68,10 +68,9 @@ const DocumentsPreviewPage: React.FC = () => { }); // Memoized values - const reportKeys = useMemo(() => Object.keys(reports), [reports]); const documentKeys = useMemo(() => Object.keys(documents), [documents]); const imageKeys = useMemo(() => Object.keys(images), [images]); - const allSources = useMemo(() => [...reportKeys, ...documentKeys, ...imageKeys], [reportKeys, documentKeys, imageKeys]); + const allSources = useMemo(() => [...documentKeys, ...imageKeys], [documentKeys, imageKeys]); @@ -96,14 +95,7 @@ const DocumentsPreviewPage: React.FC = () => { } }); - // Process reports - reportKeys.forEach(key => { - if (!(key in textContents)) { - newDocuments.push(key); - // @ts-ignore - promises.push(window.electron.readFile(reports[key])); - } - }); + if (promises.length > 0) { setDownloadingDocuments(newDocuments); @@ -148,13 +140,11 @@ const DocumentsPreviewPage: React.FC = () => { }); const documentPaths = documentKeys.map(key => documents[key]); - const researchReportPath = reports['research_report_content']; const createResponse = await PresentationGenerationApi.getQuestions({ prompt: config?.prompt ?? "", n_slides: config?.slides ? parseInt(config.slides) : null, documents: documentPaths, images: imageKeys, - research_reports: researchReportPath ? [researchReportPath] : [], language: config?.language ?? "", }); @@ -219,10 +209,9 @@ const DocumentsPreviewPage: React.FC = () => { if (!selectedDocument) return null; const isDocument = documentKeys.includes(selectedDocument); - const isReport = reportKeys.includes(selectedDocument); const hasTablesAndCharts = documentTablesAndCharts().length > 0; - if (!isDocument && !isReport) return null; + if (!isDocument) return null; return (
@@ -271,24 +260,7 @@ const DocumentsPreviewPage: React.FC = () => { size={20} /> - {reportKeys.length > 0 && ( -
updateSelectedDocument(reportKeys[0])} - className={`${selectedDocument === reportKeys[0] - ? styles.selected_border - : styles.unselected_border - } ${styles.report_icon_box} flex justify-center items-center rounded-lg w-full h-32 cursor-pointer`} - > -
- Research Report -

Research Report

-
-
- )} + {documentKeys.length > 0 && (
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 6c4f0cc6..738c1140 100644 --- a/servers/nextjs/app/(presentation-generator)/services/api/presentation-generation.ts +++ b/servers/nextjs/app/(presentation-generator)/services/api/presentation-generation.ts @@ -64,34 +64,7 @@ export class PresentationGenerationApi { } } - static async generateResearchReport(prompt: string, language: string | null) { - const apiBody = { - query: prompt, - language: language, - }; - try { - const response = await fetch( - `${BASE_URL}/ppt/report/generate`, - { - method: "POST", - headers: getHeader(), - body: JSON.stringify(apiBody), - cache: "no-cache", - } - ); - - if (response.status === 200) { - const data = await response.json(); - - return data; - } else { - throw new Error(`Failed to generate report: ${response.statusText}`); - } - } catch (error) { - console.error("Error in Generate Research Report", error); - throw error; - } - } + static async decomposeDocuments(documentKeys: string[], imageKeys: string[]) { try { @@ -452,7 +425,6 @@ export class PresentationGenerationApi { n_slides, documents, images, - research_reports, language, }: { @@ -460,7 +432,6 @@ export class PresentationGenerationApi { n_slides: number | null; documents?: string[]; images?: string[]; - research_reports?: string[]; language: string | null; }) { @@ -475,7 +446,6 @@ export class PresentationGenerationApi { n_slides, language, documents, - research_reports, images, }), diff --git a/servers/nextjs/app/(presentation-generator)/upload/components/PromptInput.tsx b/servers/nextjs/app/(presentation-generator)/upload/components/PromptInput.tsx index 21860d2a..71b10e8c 100644 --- a/servers/nextjs/app/(presentation-generator)/upload/components/PromptInput.tsx +++ b/servers/nextjs/app/(presentation-generator)/upload/components/PromptInput.tsx @@ -1,20 +1,17 @@ import { Textarea } from "@/components/ui/textarea"; import { useState } from "react"; -import * as Switch from "@radix-ui/react-switch"; -import styles from "../styles/main.module.css"; + interface PromptInputProps { value: string; onChange: (value: string) => void; - researchMode: boolean; - setResearchMode: (value: boolean) => void; + } export function PromptInput({ value, onChange, - researchMode, - setResearchMode, + }: PromptInputProps) { const [showHint, setShowHint] = useState(false); const handleChange = (value: string) => { @@ -23,33 +20,7 @@ export function PromptInput({ }; return (
-
-

- Prompt -

-
-
- Research Mode - setResearchMode(val)} - className={`${styles.SwitchRoot}`} - data-testid="research-mode-switch" - > - - -
-
-
- {researchMode && ( -

- Research mode searches the web to gather the latest information based - on your prompt and documents. -

- )} +