mirror of
https://github.com/JimLiu/baoyu-skills.git
synced 2026-07-12 13:59:47 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ec5f4ffcc9 | |||
| d206e1674d |
@@ -6,7 +6,7 @@
|
||||
},
|
||||
"metadata": {
|
||||
"description": "Skills shared by Baoyu for improving daily work efficiency",
|
||||
"version": "1.99.0"
|
||||
"version": "1.99.1"
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
English | [中文](./CHANGELOG.zh.md)
|
||||
|
||||
## 1.99.1 - 2026-04-11
|
||||
|
||||
### Fixes
|
||||
- `baoyu-article-illustrator`: omit `model` field from batch tasks when `--model` is not specified, letting `baoyu-imagine` resolve the default from env/config
|
||||
|
||||
## 1.99.0 - 2026-04-10
|
||||
|
||||
### Features
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
[English](./CHANGELOG.md) | 中文
|
||||
|
||||
## 1.99.1 - 2026-04-11
|
||||
|
||||
### 修复
|
||||
- `baoyu-article-illustrator`:未指定 `--model` 时,批处理任务中不再写入 `model` 字段,改由 `baoyu-imagine` 从环境变量或配置中解析默认值
|
||||
|
||||
## 1.99.0 - 2026-04-10
|
||||
|
||||
### 新功能
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
import assert from "node:assert/strict";
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { execFile } from "node:child_process";
|
||||
import { promisify } from "node:util";
|
||||
import test from "node:test";
|
||||
|
||||
const execFileAsync = promisify(execFile);
|
||||
const repoRoot = path.resolve(import.meta.dirname, "..", "..", "..");
|
||||
const scriptPath = path.join(repoRoot, "skills", "baoyu-article-illustrator", "scripts", "build-batch.ts");
|
||||
|
||||
async function makeFixture(): Promise<{
|
||||
root: string;
|
||||
outlinePath: string;
|
||||
promptsDir: string;
|
||||
outputPath: string;
|
||||
}> {
|
||||
const root = await fs.mkdtemp(path.join(os.tmpdir(), "baoyu-article-illustrator-build-batch-"));
|
||||
const outlinePath = path.join(root, "outline.md");
|
||||
const promptsDir = path.join(root, "prompts");
|
||||
const outputPath = path.join(root, "batch.json");
|
||||
|
||||
await fs.mkdir(promptsDir, { recursive: true });
|
||||
await fs.writeFile(
|
||||
outlinePath,
|
||||
`## Illustration 1
|
||||
**Position**: demo
|
||||
**Purpose**: demo
|
||||
**Visual Content**: demo
|
||||
**Filename**: 01-demo.png
|
||||
`,
|
||||
);
|
||||
await fs.writeFile(path.join(promptsDir, "01-demo.md"), "A demo prompt\n");
|
||||
|
||||
return { root, outlinePath, promptsDir, outputPath };
|
||||
}
|
||||
|
||||
async function runBuildBatch(args: string[]): Promise<void> {
|
||||
await execFileAsync(process.execPath, ["--import", "tsx", scriptPath, ...args], {
|
||||
cwd: repoRoot,
|
||||
});
|
||||
}
|
||||
|
||||
test("build-batch omits default model so baoyu-imagine can resolve env or EXTEND defaults", async () => {
|
||||
const fixture = await makeFixture();
|
||||
|
||||
await runBuildBatch([
|
||||
"--outline",
|
||||
fixture.outlinePath,
|
||||
"--prompts",
|
||||
fixture.promptsDir,
|
||||
"--output",
|
||||
fixture.outputPath,
|
||||
]);
|
||||
|
||||
const batch = JSON.parse(await fs.readFile(fixture.outputPath, "utf8")) as {
|
||||
tasks: Array<Record<string, unknown>>;
|
||||
};
|
||||
|
||||
assert.equal(batch.tasks.length, 1);
|
||||
assert.equal(batch.tasks[0]?.provider, "replicate");
|
||||
assert.equal(Object.hasOwn(batch.tasks[0]!, "model"), false);
|
||||
});
|
||||
|
||||
test("build-batch preserves explicit model overrides", async () => {
|
||||
const fixture = await makeFixture();
|
||||
|
||||
await runBuildBatch([
|
||||
"--outline",
|
||||
fixture.outlinePath,
|
||||
"--prompts",
|
||||
fixture.promptsDir,
|
||||
"--output",
|
||||
fixture.outputPath,
|
||||
"--model",
|
||||
"acme/custom-model",
|
||||
]);
|
||||
|
||||
const batch = JSON.parse(await fs.readFile(fixture.outputPath, "utf8")) as {
|
||||
tasks: Array<Record<string, unknown>>;
|
||||
};
|
||||
|
||||
assert.equal(batch.tasks[0]?.model, "acme/custom-model");
|
||||
});
|
||||
@@ -8,7 +8,7 @@ type CliArgs = {
|
||||
outputPath: string | null;
|
||||
imagesDir: string | null;
|
||||
provider: string;
|
||||
model: string;
|
||||
model: string | null;
|
||||
aspectRatio: string;
|
||||
quality: string;
|
||||
jobs: number | null;
|
||||
@@ -30,7 +30,7 @@ Options:
|
||||
--output <path> Path to output batch.json
|
||||
--images-dir <path> Directory for generated images
|
||||
--provider <name> Provider for baoyu-imagine batch tasks (default: replicate)
|
||||
--model <id> Model for baoyu-imagine batch tasks (default: google/nano-banana-pro)
|
||||
--model <id> Explicit model for baoyu-imagine batch tasks (default: resolved by baoyu-imagine config/env)
|
||||
--ar <ratio> Aspect ratio for all tasks (default: 16:9)
|
||||
--quality <level> Quality for all tasks (default: 2k)
|
||||
--jobs <count> Recommended worker count metadata (optional)
|
||||
@@ -44,7 +44,7 @@ function parseArgs(argv: string[]): CliArgs {
|
||||
outputPath: null,
|
||||
imagesDir: null,
|
||||
provider: "replicate",
|
||||
model: "google/nano-banana-pro",
|
||||
model: null,
|
||||
aspectRatio: "16:9",
|
||||
quality: "2k",
|
||||
jobs: null,
|
||||
@@ -132,15 +132,16 @@ async function main(): Promise<void> {
|
||||
}
|
||||
|
||||
const imageDir = args.imagesDir ?? path.dirname(args.outputPath);
|
||||
tasks.push({
|
||||
const task: Record<string, unknown> = {
|
||||
id: `illustration-${String(entry.index).padStart(2, "0")}`,
|
||||
promptFiles: [promptFile],
|
||||
image: path.join(imageDir, entry.filename),
|
||||
provider: args.provider,
|
||||
model: args.model,
|
||||
ar: args.aspectRatio,
|
||||
quality: args.quality,
|
||||
});
|
||||
};
|
||||
if (args.model) task.model = args.model;
|
||||
tasks.push(task);
|
||||
}
|
||||
|
||||
const output: Record<string, unknown> = { tasks };
|
||||
|
||||
Reference in New Issue
Block a user