Skip to content

Allow user to provide a theme for audio lesson generation #502

@mircealungu

Description

@mircealungu

Idea

Let the user optionally provide a theme (a short phrase) when generating a daily audio lesson. The theme would be passed to the LLM prompt so it tries to set the dialogues in that context.

For example, a user learning Dutch could type "at the supermarket" and the generated lesson dialogues would use supermarket-related scenarios for the vocabulary words.

Implementation

Changes span both API and frontend (~20 lines of logic total):

API (this repo)

  1. Prompt template (audio_lessons/prompts/meaning_lesson--...v2.txt): Add a {theme} placeholder near the "brief scenario" instruction (line 12)
  2. Script generator (audio_lessons/script_generator.py): Add theme=None param to generate_lesson_script(), pass to template
  3. Generation pipeline: Thread theme through generate_daily_lesson endpoint → preparation dict → background thread → build_daily_lesson()generate_lesson_script()

Frontend (zeeguu/web)

  1. TodayAudio.js: Add an optional text input on the generate screen, send as form data

Notes

  • Theme should be optional — if not provided, behavior is unchanged
  • The prompt should treat the theme as a suggestion, not a hard requirement (some words may not fit the theme naturally)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions