Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/core/src/agents/writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ export class WriterAgent extends BaseAgent {
const chaptersDir = join(bookDir, "chapters");
const storyDir = join(bookDir, "story");
await mkdir(chaptersDir, { recursive: true });
await mkdir(storyDir, { recursive: true });

const paddedNum = String(output.chapterNumber).padStart(4, "0");
const filename = `${paddedNum}_${this.sanitizeFilename(output.title)}.md`;
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/pipeline/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ export class PipelineRunner {

// Update truth files
const storyDir = join(bookDir, "story");
await mkdir(storyDir, { recursive: true });
if (reviseOutput.updatedState !== "(状态卡未更新)") {
await writeFile(join(storyDir, "current_state.md"), reviseOutput.updatedState, "utf-8");
}
Expand Down Expand Up @@ -581,6 +582,7 @@ export class PipelineRunner {

// Update state files from revision
const storyDir = join(bookDir, "story");
await mkdir(storyDir, { recursive: true });
if (reviseOutput.updatedState !== "(状态卡未更新)") {
await writeFile(join(storyDir, "current_state.md"), reviseOutput.updatedState, "utf-8");
}
Expand All @@ -596,6 +598,7 @@ export class PipelineRunner {

// 4. Save chapter (original or revised)
const chaptersDir = join(bookDir, "chapters");
await mkdir(chaptersDir, { recursive: true });
const paddedNum = String(chapterNumber).padStart(4, "0");
const title = output.title;
const filename = `${paddedNum}_${title.replace(/[/\\?%*:|"<>]/g, "").replace(/\s+/g, "_").slice(0, 50)}.md`;
Expand Down