ppt-tool/backend/api/v1/ppt/endpoints/content.py
Vadym Samoilenko e8295d6e71 Phase 4: Fix critical bugs, improve document parsing, add vision OCR
- Fix SSE stream 500: use async_session_maker inside StreamingResponse generator
  (Depends session closes when endpoint returns, before streaming starts)
- Fix template application: store template_name in prepare endpoint so worker
  uses the selected custom template instead of defaulting to "general"
- Fix OverlayLoader: replace loading.gif with HamsterLoader component
- Fix parse_mode default: change from "slides" to "layouts" to avoid 70+ layouts
- Update Gemini Flash model to gemini-3.1-flash-image-preview
- Improve DOCX parsing: python-docx for structured table extraction, OCR enabled
- Add vision-based image text extraction via Gemini for uploaded images
- Add LayoutParser integration for slide layout structure analysis
- Add Phase 4 MVP features: transfer ownership, URL input, follow-up questions,
  attachment-to-slide mapping, content router

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 14:07:00 +00:00

25 lines
919 B
Python

from typing import List
from fastapi import APIRouter, Body, Depends, HTTPException
from models.sql.user import UserModel
from services.content_intelligence_service import ContentIntelligenceService
from utils.auth_dependencies import get_current_user
CONTENT_ROUTER = APIRouter(prefix="/content", tags=["Content"])
@CONTENT_ROUTER.post("/follow-up-questions")
async def follow_up_questions(
content: str = Body(..., embed=True),
_current_user: UserModel = Depends(get_current_user),
):
"""Classify content and return follow-up questions if the brief is thin."""
if not content or not content.strip():
raise HTTPException(status_code=400, detail="Content is required")
ci_service = ContentIntelligenceService()
classified = await ci_service.classify(content)
questions: List[str] = await ci_service.ask_followup_questions(classified) or []
return {"questions": questions}