Update README for batch jobs workflow

This commit is contained in:
2026-03-21 14:07:48 +08:00
parent 6ceeeff907
commit 7534c6bdf3

View File

@@ -15,7 +15,7 @@ cp .env.example .env
To run:
```bash
bun run src/index.ts "A tiny banana robot exploring a neon greenhouse"
bun run src/index.ts
```
What it does:
@@ -23,8 +23,10 @@ What it does:
- Reads `FLOW2API_BASE_URL`, `FLOW2API_API_KEY`, and `FLOW2API_MODEL` from `.env`
- Accepts either a root endpoint or a `/v1` endpoint and normalizes root URLs to the OpenAI-compatible `/v1` base URL automatically
- Also accepts older `GEMINI_MODEL` and `OPENAI_MODEL` env names for compatibility
- Uses AI SDK's `streamText` for streaming text, then downloads the generated image from the streamed Markdown image link
- Saves the generated image into `images/` with a timestamp-based filename
- Reads batch jobs from `src/jobs.ts`, where each item can define `name`, `prompt`, `images`, and `enabled`
- Treats relative `images` entries in each job as files under the local `images/` directory
- Sends `prompt` plus any local input images through AI SDK's `streamText`, then downloads the generated image from the streamed Markdown image link
- Saves each generated image into `output/` with a job-based timestamp filename
- Keeps runtime code under `src/` and uses the `@/*` TypeScript alias for internal imports
This project was created using `bun init` in bun v1.3.11. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.