How doguto/writer-elyza works
Project type and purpose
• From the README (“writer-elyza: 日本語の学習がされたLLMであるELYZAを用い、全自動でアルファポリスに投稿を行ってくれるアプリです”), this is a full-stack automation tool. It uses an LLM (ELYZA) to generate Japanese novel text, then posts it automatically to the Alphapolis web service.
File structure
Top-level:
• src/main.py – the entrypoint/orchestrator
• src/novel/novel.py – novel‐domain model
• src/writer – modules handling AI prompts, installer, writer logic
– ai.py, prompts.py, writer.py, installer.py
• src/web_operation_py – modules handling web automation (Selenium)
• src/test – unit tests
• works/ – output folder for generated and posted files
Patterns:
• Clear separation between “Novel generation” (writer + novel) and “Web operation” (posting).
• A CLI (main.py) that ties together AI, domain model, file storage, and web automation.
README for additional insights
• Dependencies implied: an LLM client library, Selenium (or similar), a file system for intermediate storage.
Main components and their interactions
a. Components:
1) Orchestrator (src/main.py)
2) Novel Domain (src/novel/novel.py)
3) Writer Service
– prompts.py: constructs LLM prompts
– ai.py: calls the LLM API (ELYZA)
– writer.py: high-level orchestration of generate→serialize
– installer.py: installs/configures any needed local resources/plugins
4) Storage (works/ directory)
5) Web Automation (src/web_operation_py)
– alphapolis_operater.py: login + post flows
– selenium_sample.py: sample reference code
6) External LLM Service (ELYZA API)
7) External Web Service (Alphapolis)
b. Relationships & data flow:
1) CLI → Writer Service (via prompts & ai) → Novel objects
2) Novel objects → Serialized to works/ folder
3) CLI → Web Automation Component reads works/ → drives browser to Alphapolis
4) External calls: LLM API ← ai.py, Alphapolis website ← Selenium driver
c. Architectural patterns/design principles:
• Single-responsibility: each module handles one concern (prompting, AI call, web posting)
• Layered: CLI orchestrator, domain model, service layer, infrastructure (storage, Selenium)
• Plug-in friendly: installer.py could register additional LLMs
d. Key technologies/frameworks:
• Python 3
• LLM API client (ELYZA)
• Selenium (web driver) for Alphapolis posting
• pytest for tests
Elements
• Internal modules (blue)
• External services (green)
• Data stores (yellow)