Documentation
¶
Index ¶
- Constants
- func NovelSkillPath(novelID int64, name string) string
- type BatchTrace
- type BoundaryHint
- type BoundaryHintsOutput
- type ChapterSource
- type ChapterSummariesOutput
- type ChapterSummaryItem
- type Chunk
- type ChunkRoundTrace
- type ChunksOutput
- type ExtractPatternInput
- type ExtractPatternResult
- type Extractor
- type LLMStatus
- type Progress
- type SkillOutput
- type Trace
Constants ¶
View Source
const ( StageLoaded = "loaded" StageBoundaries = "boundaries" StageSummaries = "summaries" StageInitialChunks = "initial_chunks" StageCompressChunks = "compress_chunks" StageFinalizing = "finalizing" StageDone = "done" )
Pipeline stage names
View Source
const ( LLMThinking = llm.CallToolThinking // 模型正在推理/思考 LLMGenerating = llm.CallToolGenerating // 模型正在输出结果 )
Variables ¶
This section is empty.
Functions ¶
func NovelSkillPath ¶
Types ¶
type BatchTrace ¶
type BoundaryHint ¶
type BoundaryHint struct {
StartChapterID int64 `json:"start_chapter_id" jsonschema:"required,description=起始章节的稳定ID"`
EndChapterID int64 `json:"end_chapter_id" jsonschema:"required,description=结束章节的稳定ID"`
StartReadingNumber int `json:"-"`
EndReadingNumber int `json:"-"`
Hint string `json:"hint" jsonschema:"required,description=为什么这里可能是叙事阶段边界"`
}
type BoundaryHintsOutput ¶
type BoundaryHintsOutput struct {
Boundaries []BoundaryHint `json:"boundaries" jsonschema:"required,description=可能的叙事阶段边界列表"`
}
type ChapterSource ¶
ChapterSource 是从 DB 元数据和 git 正文拼出的章节数据传递对象
type ChapterSummariesOutput ¶
type ChapterSummariesOutput struct {
Summaries []ChapterSummaryItem `json:"summaries" jsonschema:"required,description=生成的章节摘要列表"`
}
type ChapterSummaryItem ¶
type Chunk ¶
type Chunk struct {
Name string `json:"name" jsonschema:"required,description=叙事阶段名称(如:崛起、转折)"`
StartChapterID int64 `json:"start_chapter_id" jsonschema:"required,description=起始章节的稳定ID"`
EndChapterID int64 `json:"end_chapter_id" jsonschema:"required,description=结束章节的稳定ID"`
StartReadingNumber int `json:"-"`
EndReadingNumber int `json:"-"`
Content string `json:"content" jsonschema:"required,description=100-200字的阶段叙事概括,覆盖核心事件与转折"`
}
type ChunkRoundTrace ¶
type ChunksOutput ¶
type ChunksOutput struct {
Chunks []Chunk `json:"chunks" jsonschema:"required,description=压缩后的叙事阶段块列表"`
}
type ExtractPatternInput ¶
type ExtractPatternResult ¶
type Extractor ¶
type Extractor struct {
Chapters *chapter.Store
LLMClient *llm.Client
DB *gorm.DB
Progress func(Progress)
}
func (*Extractor) Extract ¶
func (e *Extractor) Extract(ctx context.Context, input ExtractPatternInput) (*ExtractPatternResult, error)
Extract 执行完整的模式提取 Pipeline:Pre-step 边界分析 → Step 1 章节摘要 → Step 2 递归压缩 → Step 3 生成技能
type LLMStatus ¶
type LLMStatus = llm.CallToolStatus
LLMStatus 是 llm.CallToolStatus 的别名,保持 pattern 包对外类型兼容。
type Progress ¶
type Progress struct {
TaskID string `json:"task_id,omitempty"`
NovelID int64 `json:"novel_id"`
Stage string `json:"stage"`
Message string `json:"message"`
LLMStatus LLMStatus `json:"llm_status,omitempty"`
Round int `json:"round,omitempty"`
BatchIndex int `json:"batch_index,omitempty"`
BatchTotal int `json:"batch_total,omitempty"`
Tokens int `json:"tokens,omitempty"`
Boundaries []BoundaryHint `json:"boundaries,omitempty"`
Summaries []ChapterSummaryItem `json:"summaries,omitempty"`
Chunks []Chunk `json:"chunks,omitempty"`
}
type SkillOutput ¶
type Trace ¶
type Trace struct {
TaskID string `json:"task_id,omitempty"`
NovelID int64 `json:"novel_id"`
ChapterCount int `json:"chapter_count"`
ContextWindow int `json:"context_window"`
BatchBudget int `json:"batch_budget"`
Boundaries []BoundaryHint `json:"boundaries"`
Summaries []ChapterSummaryItem `json:"summaries"`
ChunkRounds []ChunkRoundTrace `json:"chunk_rounds"`
FinalTokens int `json:"final_tokens"`
}
Click to show internal directories.
Click to hide internal directories.