Skip to content

[FEAT] Add AI generation gateway endpoint in quiz_core #92

Description

@MikeNovikoff

Feature description

Expose a user-facing endpoint in the Go quiz_core service that accepts raw .txt study materials, proxies them to the internal llm-service, and returns generated cards. This endpoint acts as a gateway so the frontend never talks directly to the LLM service.

Scope

quiz_core/internal/api/handlers/llm/generate.go: Multipart form handler
quiz_core/internal/routes/routes.go: Register POST /core/quizzes/generate
quiz_core/internal/config/config.go: LLMService.URL from env (default http://llm-service:7000)

Acceptance Criteria

  • Accepts multipart/form-data with document (.txt only) and form fields card_type, count
  • Validates file size ≤ 1 MB and text length ≥ 10 characters
  • Forwards request to llm-service via internal HTTP client with 120s timeout
  • Returns 502 Bad Gateway with details if LLM service fails
  • Returns 200 OK with parsed GenerateCardsResponse on success
  • Properly closes file handles and uses io.LimitReader

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions