Spaces:
Running
Running
removed raw Hf response
Browse files- app/api/presentations/generate/route.ts +0 -2
- components/editor/GoogleSlidesEditor.tsx +0 -17
- lib/generated-presentation.ts +0 -1
- public/next.svg +0 -1
- public/vercel.svg +0 -1
- public/window.svg +0 -1
app/api/presentations/generate/route.ts
CHANGED
|
@@ -346,7 +346,6 @@ export async function POST(req: NextRequest) {
|
|
| 346 |
const hf = new HFClient({ apiKey: hfToken, model: LLAMA_PRESENTATION_MODEL });
|
| 347 |
|
| 348 |
const responseText = await fetchModelResponse(hf, systemPrompt);
|
| 349 |
-
console.log('Raw HF response excerpt:', getResponseExcerpt(responseText));
|
| 350 |
|
| 351 |
if (!responseText.trim()) {
|
| 352 |
throw new PresentationGenerationError(
|
|
@@ -371,7 +370,6 @@ export async function POST(req: NextRequest) {
|
|
| 371 |
presentationName: parsed.presentationName || presentationName,
|
| 372 |
slides: slidesWithImages,
|
| 373 |
generationSource: 'model',
|
| 374 |
-
rawModelResponse: process.env.NODE_ENV !== 'production' ? responseText : undefined,
|
| 375 |
});
|
| 376 |
} catch (error) {
|
| 377 |
if (error instanceof PresentationGenerationError) {
|
|
|
|
| 346 |
const hf = new HFClient({ apiKey: hfToken, model: LLAMA_PRESENTATION_MODEL });
|
| 347 |
|
| 348 |
const responseText = await fetchModelResponse(hf, systemPrompt);
|
|
|
|
| 349 |
|
| 350 |
if (!responseText.trim()) {
|
| 351 |
throw new PresentationGenerationError(
|
|
|
|
| 370 |
presentationName: parsed.presentationName || presentationName,
|
| 371 |
slides: slidesWithImages,
|
| 372 |
generationSource: 'model',
|
|
|
|
| 373 |
});
|
| 374 |
} catch (error) {
|
| 375 |
if (error instanceof PresentationGenerationError) {
|
components/editor/GoogleSlidesEditor.tsx
CHANGED
|
@@ -44,7 +44,6 @@ export default function GoogleSlidesEditor() {
|
|
| 44 |
const [currentTheme, setCurrentTheme] = useState<keyof typeof themes>('neobrutalism'); // Active theme
|
| 45 |
const [isGenerating, setIsGenerating] = useState(false); // AI generation in progress
|
| 46 |
const [generationError, setGenerationError] = useState<string | null>(null); // AI errors
|
| 47 |
-
const [rawModelResponse, setRawModelResponse] = useState<string | null>(null); // Raw HF response for debugging
|
| 48 |
const [presentationTitle, setPresentationTitle] = useState('Untitled Presentation'); // Editable title
|
| 49 |
|
| 50 |
// EDITOR UI STATE
|
|
@@ -197,7 +196,6 @@ export default function GoogleSlidesEditor() {
|
|
| 197 |
if (isGeneratingFlag === 'true' && generationPrompt && generationModel) {
|
| 198 |
setIsGenerating(true);
|
| 199 |
setGenerationError(null);
|
| 200 |
-
setRawModelResponse(null);
|
| 201 |
|
| 202 |
// Call API to generate slides
|
| 203 |
const generateSlides = async () => {
|
|
@@ -232,11 +230,6 @@ export default function GoogleSlidesEditor() {
|
|
| 232 |
throw new Error('Generation returned an invalid response.');
|
| 233 |
}
|
| 234 |
|
| 235 |
-
if (typeof data.rawModelResponse === 'string' && data.rawModelResponse.trim()) {
|
| 236 |
-
setRawModelResponse(data.rawModelResponse);
|
| 237 |
-
console.log('Raw HF response:', data.rawModelResponse);
|
| 238 |
-
}
|
| 239 |
-
|
| 240 |
if (data.slides.length === 0) {
|
| 241 |
throw new Error('Generation returned no slides.');
|
| 242 |
}
|
|
@@ -1498,16 +1491,6 @@ export default function GoogleSlidesEditor() {
|
|
| 1498 |
<button onClick={() => setGenerationError(null)} className="ml-4 font-bold">×</button>
|
| 1499 |
</div>
|
| 1500 |
)}
|
| 1501 |
-
{rawModelResponse && (
|
| 1502 |
-
<details className="absolute top-20 right-4 z-50 w-[min(32rem,calc(100%-2rem))] rounded border border-zinc-300 bg-white/95 shadow-lg">
|
| 1503 |
-
<summary className="cursor-pointer px-4 py-3 text-sm font-medium text-zinc-900">
|
| 1504 |
-
Raw HF response
|
| 1505 |
-
</summary>
|
| 1506 |
-
<pre className="max-h-80 overflow-auto border-t border-zinc-200 px-4 py-3 text-xs leading-5 text-zinc-800 whitespace-pre-wrap">
|
| 1507 |
-
{rawModelResponse}
|
| 1508 |
-
</pre>
|
| 1509 |
-
</details>
|
| 1510 |
-
)}
|
| 1511 |
<div className="min-h-full flex items-center justify-center p-4 md:p-6 lg:p-10">
|
| 1512 |
<div className="relative" style={{ transform: `scale(${zoom})`, transformOrigin: 'center' }}>
|
| 1513 |
{/* Unified canvas: template background (if applicable) + draggable elements */}
|
|
|
|
| 44 |
const [currentTheme, setCurrentTheme] = useState<keyof typeof themes>('neobrutalism'); // Active theme
|
| 45 |
const [isGenerating, setIsGenerating] = useState(false); // AI generation in progress
|
| 46 |
const [generationError, setGenerationError] = useState<string | null>(null); // AI errors
|
|
|
|
| 47 |
const [presentationTitle, setPresentationTitle] = useState('Untitled Presentation'); // Editable title
|
| 48 |
|
| 49 |
// EDITOR UI STATE
|
|
|
|
| 196 |
if (isGeneratingFlag === 'true' && generationPrompt && generationModel) {
|
| 197 |
setIsGenerating(true);
|
| 198 |
setGenerationError(null);
|
|
|
|
| 199 |
|
| 200 |
// Call API to generate slides
|
| 201 |
const generateSlides = async () => {
|
|
|
|
| 230 |
throw new Error('Generation returned an invalid response.');
|
| 231 |
}
|
| 232 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
if (data.slides.length === 0) {
|
| 234 |
throw new Error('Generation returned no slides.');
|
| 235 |
}
|
|
|
|
| 1491 |
<button onClick={() => setGenerationError(null)} className="ml-4 font-bold">×</button>
|
| 1492 |
</div>
|
| 1493 |
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1494 |
<div className="min-h-full flex items-center justify-center p-4 md:p-6 lg:p-10">
|
| 1495 |
<div className="relative" style={{ transform: `scale(${zoom})`, transformOrigin: 'center' }}>
|
| 1496 |
{/* Unified canvas: template background (if applicable) + draggable elements */}
|
lib/generated-presentation.ts
CHANGED
|
@@ -21,7 +21,6 @@ export interface PresentationGenerateSuccessResponse {
|
|
| 21 |
presentationName?: string;
|
| 22 |
slides: PresentationApiSlide[];
|
| 23 |
generationSource: 'model';
|
| 24 |
-
rawModelResponse?: string;
|
| 25 |
}
|
| 26 |
|
| 27 |
export interface PresentationGenerateErrorResponse {
|
|
|
|
| 21 |
presentationName?: string;
|
| 22 |
slides: PresentationApiSlide[];
|
| 23 |
generationSource: 'model';
|
|
|
|
| 24 |
}
|
| 25 |
|
| 26 |
export interface PresentationGenerateErrorResponse {
|
public/next.svg
DELETED
public/vercel.svg
DELETED
public/window.svg
DELETED