feat: 支持长篇小说分层架构(卷/弧/章三级结构)

This commit is contained in:
voocel
2026-03-12 16:27:15 +08:00
parent 3d65afa276
commit bce0adeff1
19 changed files with 1045 additions and 16 deletions

View File

@@ -25,6 +25,49 @@ type Character struct {
Tier string `json:"tier,omitempty"` // core / important / secondary / decorative默认 important
}
// VolumeOutline 卷级大纲(长篇分层模式)。
type VolumeOutline struct {
Index int `json:"index"`
Title string `json:"title"`
Theme string `json:"theme"` // 本卷核心冲突/主题
Arcs []ArcOutline `json:"arcs"`
}
// ArcOutline 弧级大纲。
type ArcOutline struct {
Index int `json:"index"` // 卷内弧序号
Title string `json:"title"`
Goal string `json:"goal"` // 弧目标(起承转合)
Chapters []OutlineEntry `json:"chapters"`
}
// TotalChapters 计算分层大纲的总章节数。
func TotalChapters(volumes []VolumeOutline) int {
n := 0
for _, v := range volumes {
for _, a := range v.Arcs {
n += len(a.Chapters)
}
}
return n
}
// FlattenOutline 将分层大纲展开为扁平章节列表,保持全局章节号连续。
func FlattenOutline(volumes []VolumeOutline) []OutlineEntry {
var result []OutlineEntry
ch := 1
for _, v := range volumes {
for _, a := range v.Arcs {
for _, e := range a.Chapters {
e.Chapter = ch
result = append(result, e)
ch++
}
}
}
return result
}
// WorldRule 世界观规则条目。
type WorldRule struct {
Category string `json:"category"` // magic / technology / geography / society / other