Comparing The-Pocket:main...RR9-cn:main · The-Pocket/PocketFlow-Template-Python

Commits on Oct 5, 2025

  1. feat: 实现 AI 小说自动生成系统

    主要功能:
    - 基于 PocketFlow 框架实现小说自动生成工作流
    - 集成 Google Gemini API 进行内容生成
    - 添加流式输出支持,避免超时问题
    - 实现多重质量验证机制
    
    技术改进:
    - 修复 Python f-string 语法错误
    - 修复正则表达式 \p{P} 不兼容问题
    - 添加代理自动检测和配置
    - 优化 API 调用的错误处理
    
    新增文件:
    - utils/call_gemini.py: Gemini API 调用(支持流式)
    - utils/prompt_builder.py: 随机提示词构建
    - utils/novel_parser.py: 小说内容解析
    - utils/validator.py: 内容质量验证
    - config/: 配置文件目录(标签、命令、事件)
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>

    and claude committed

    Oct 5, 2025
    Configuration menu

    Browse the repository at this point in the history

  2. fix: 优化小说保存格式,匹配 ai-novel 输出规范

    修复内容:
    1. 修复节点 f-string 语法错误(嵌套引号)
    2. 修复验证器正则表达式错误(Python 不支持 \p{P})
    3. 平台格式去除章节标题(## 开头的行)
    4. 新增完整格式文件(保留章节标题,用于阅读)
    
    输出文件:
    - output/{title}.txt - 平台粘贴格式(无章节标题)
    - output/full/{title}.txt - 完整阅读格式(含章节标题)
    - output/intro/{title}.txt - 标签+简介
    - output/novel/{title}.json - 完整 JSON 数据
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>

    chenjunjie and claude committed

    Oct 5, 2025
    Configuration menu

    Browse the repository at this point in the history

  3. Configuration menu

    Browse the repository at this point in the history

  4. feat: 更新写作提示词模板

    添加完整的 AI 写作指南,包括:
    - 四步创作法:灵感饼干罐、角色茶话会、愉快聊聊天、后期护理
    - 创世关键词库:身份、场景、动作/概念
    - 严格的写作风格要求和禁令
    - 标题生成公式和爽文创作规范
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>

    chenjunjie and claude committed

    Oct 5, 2025
    Configuration menu

    Browse the repository at this point in the history

  5. feat: 添加解析/验证失败自动重试机制

    修改内容:
    1. ParseNovelNode 添加 exec_fallback 异常处理
    2. 解析失败返回 'retry' action,循环回 GenerateNovelNode
    3. 验证失败也返回 'fail' action,触发重新生成
    4. 更新 design.md 流程图和节点描述
    
    新增流程:
    - ParseNovel --retry--> GenerateNovel (解析失败重试)
    - ValidateNovel --fail--> GenerateNovel (验证失败重试)
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>

    chenjunjie and claude committed

    Oct 5, 2025
    Configuration menu

    Browse the repository at this point in the history

  6. feat: 优化 CONTENT 区块解析策略,提高解析成功率

    改进内容:
    1. CONTENT 采用两级容错策略:
       - 优先匹配 CONTENT{{...}}CONTENT 格式(兼容旧版)
       - 匹配失败则取 }}INTRO 之后到 --END-- 之间的内容
    2. 移除 CONTENT 区块的硬性要求,只需保证 --END-- 标记存在
    3. 兼容两种输出格式:
       - 标准格式:TITLE/TAG/INTRO + 直接写正文
       - 旧格式:TITLE/TAG/INTRO/CONTENT 全部包裹
    
    优势:
    - 避免大括号嵌套导致的正则匹配失败
    - 兼容 AI 未使用 CONTENT 标记的情况
    - 提高长文本内容的解析成功率
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>

    chenjunjie and claude committed

    Oct 5, 2025
    Configuration menu

    Browse the repository at this point in the history

  7. fix: 修正正则表达式匹配策略,改用单层大括号

    问题诊断:
    - 原格式使用双层大括号 CONTENT{{...}}CONTENT
    - 在 f-string 中 {{}} 会被转义成单个 {}
    - 但 parser 仍在匹配双层 \{\{...\}\},导致匹配失败
    
    解决方案:
    1. Prompt 模板保持 {{}} 写法(f-string 转义后变成单层)
    2. Parser 匹配单层大括号 CONTENT\{(.*?)\}CONTENT
    3. 与 ai-novel 项目保持一致的解析策略
    
    改进效果:
    - 避免嵌套大括号导致的正则提前终止
    - 非贪婪匹配 (.*?) 更准确
    - 提高 CONTENT 区块解析成功率
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>

    chenjunjie and claude committed

    Oct 5, 2025
    Configuration menu

    Browse the repository at this point in the history