perf: 上下文分级裁剪与Agent完成性保障

This commit is contained in:
voocel
2026-03-15 22:52:17 +08:00
parent 568ef0b1d1
commit c913a49ffd
15 changed files with 358 additions and 112 deletions

View File

@@ -7,14 +7,15 @@ import (
// Config 小说应用配置。
type Config struct {
Prompt string // 用户的小说需求
NovelName string // 小说名(用作输出目录名)
OutputDir string // 输出根目录,默认 output/{NovelName}
Provider string // LLM 提供商openai / anthropic / gemini
ModelName string // LLM 模型名
APIKey string // API Key
BaseURL string // API Base URL可选
Style string // 写作风格default/suspense/fantasy/romance
Prompt string // 用户的小说需求
NovelName string // 小说名(用作输出目录名)
OutputDir string // 输出根目录,默认 output/{NovelName}
Provider string // LLM 提供商openai / anthropic / gemini
ModelName string // LLM 模型名
APIKey string // API Key
BaseURL string // API Base URL可选
Style string // 写作风格default/suspense/fantasy/romance
ContextWindow int // 模型上下文窗口大小token默认 128000
}
// Prompts 嵌入的提示词。
@@ -72,4 +73,7 @@ func (c *Config) FillDefaults() {
if c.Style == "" {
c.Style = "default"
}
if c.ContextWindow <= 0 {
c.ContextWindow = 128000
}
}