How lihuithe/podlm-public works
Project Type and Purpose
• This is a full‑stack Python web application that:
• Presents a simple HTML/JS frontend (index.html, list.html, del.html)
• Exposes HTTP endpoints (api.py)
• Runs a background task processor (server.py / server_pro.py)
• Invokes an LLM + TTS service (via ffmpeg)
• Persists task metadata locally (task_list.json)
• Optionally publishes final audio to 小宇宙 via their API
File Structure
• Top‐level scripts:
• api.py – the Flask/FastAPI (or similar) web/API server
• server.py – multi‑threaded task executor
• server_pro.py – same as server.py with extra Xiao宇宙 publishing logic
• config.demo.py – template for config.py (LLM & TTS credentials, endpoints)
• Static/UI assets:
• index.html, list.html, del.html
• resources/css/styles.css
• resources/js/manage.js
• Dependencies & config:
• requirements.txt
• config.py (copied from config.demo.py)
• Storage:
• task_list.json (maintains records of all conversions)
README for Additional Insights
• Long‑running services: api.py and server(.py|_pro).py must both run concurrently.
• External prerequisites: ffmpeg in PATH, LLM & TTS service endpoints.
• Access patterns: browser → API → background worker → LLM/TTS → output → UI / external publish.
a. Frontend (Client‑side)
• Components: index.html, list.html, del.html + CSS/JS
• Technology: HTML5, CSS, vanilla JS or jQuery
b. API Layer
• Component: api.py (Flask/FastAPI)
• Responsibilities:
– Receives user requests (trigger conversion, list tasks, delete tasks)
– Stores/reads task metadata in task_list.json
– Returns status to frontend
c. Task Processor
• Component: server.py / server_pro.py
• Responsibilities:
– Polls or listens for new tasks
– Spawns threads to:
1. Fetch & parse URL content via LLM
2. Generate audio via TTS service + ffmpeg
3. Save resulting audio file
4. Update task_list.json
5. (server_pro only) Push audio file to 小宇宙 API
d. External Services
• LLM Service (e.g., OpenAI, local model endpoint)
• TTS Service (e.g., Azure Cognitive, Google Cloud TTS)
• 小宇宙 Publishing API (only in server_pro.py)
e. Local Storage
• task_list.json (JSON file acting as simple DB)
• Audio file directory (not shown but implied)
Architectural Patterns / Design Principles
• Layered separation:
1. Presentation (Frontend)
2. API (api.py)
3. Worker / Business Logic (server.py)
4. Persistence (task_list.json + file storage)
5. External Integration (LLM, TTS, Xiao宇宙)
• Async / multi‑threaded processing for long‑running tasks
• Configuration externalization (config.py)