18 Commits

Author SHA1 Message Date
starmen1265 5983e95352 feat(15-02): integrate KBSettings config for semantic segmentation
- Modified SRTProcessor to read enable_semantic_segmentation from KBSettings
- Changed constructor parameter default from False to None (None = read from config)
- Added config priority: constructor parameter > KBSettings > default (True)
- Added logging for config status (INFO level)
- Added comprehensive tests for config integration (TestConfigIntegration)
- Added tests for output format compatibility (TestOutputFormatBenefits)
- Fixed MockAIClient to accept disable_reasoning parameter
- All 34 tests passing

Requirements satisfied:
- CONFIG-01: SRTProcessor reads from KBSettings
- CONFIG-02: Disabled config uses rule-based segmentation
- OUTPUT-01: LLM segmentation outputs H2 titles
- OUTPUT-02: title=null skips title output
- OUTPUT-03: Rule-based segmentation outputs "## 内容"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 23:03:54 +08:00
starmen1265 8303cea018 feat(15-01): add enable_semantic_segmentation field to KBSettings
- Add enable_semantic_segmentation: bool field with default=True
- Allow override via KB_ENABLE_SEMANTIC_SEGMENTATION env var
- Pydantic automatically parses boolean strings (true/false, yes/no, 1/0)
- Update docstring to document new field

CONFIG-01: LLM segmentation can be enabled/disabled via configuration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 23:01:29 +08:00
starmen1265 bb321d9cd4 feat(14-05): integrate cache into SRTProcessor
- Add enable_cache parameter to SRTProcessor.__init__()
- Create SemanticCache instance when semantic segmentation is enabled
- Pass cache to UnifiedSegmentationStrategy through SemanticSegmentationEngine
- Add logging for cache status (enabled/disabled)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 22:40:47 +08:00
starmen1265 ef4a660faa feat(13-07): integrate SemanticSegmentationEngine into SRTProcessor
- 添加 enable_semantic_segmentation 参数到 SRTProcessor.__init__
- 启用时使用 SemanticSegmentationEngine,禁用时使用 SemanticSegmenter
- AI 不可用时自动降级到规则分段
- 更新 _generate_markdown() 支持带标题的 VideoSegment 输出
- 调整步骤顺序:先加载元数据,再进行语义分段
- 更新 UnifiedSegmentationStrategy.segment() 返回 List[VideoSegment]
- 添加代理方法到 SemanticSegmentationEngine 以保持向后兼容
- 创建全面的集成测试(9 个测试用例)
- 更新现有语义引擎测试以适配新 API

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 00:32:14 +08:00
starmen1265 4d2645876b fix(srt): add disable_reasoning parameter for ASR correction and include title in archive filename
PR Test / lint (pull_request) Successful in 1s
- SimpleAIClient: Add disable_reasoning parameter to control AI thinking mode
- ASRCorrector: Use disable_reasoning=True to get direct correction results
- ArchiveProcessor: Extract title from frontmatter and include in filename

File naming format: {YYYYMMDD}_{content_id}_{title}_analysis.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 22:19:14 +08:00
starmen1265 7ac4937c48 fix(deep-analyzer, srt): correct Zhipu API thinking parameter and fix metadata handling
Root cause:
1. thinking.type="disabled" caused ASR correction accuracy degradation
2. SRTProcessor didn't flatten nested metadata structure
3. Low-quality auto-generated summary section
4. duration field type handling issue

Changes:
- DeepAnalyzer: Remove thinking.type="disabled" to enable default thinking mode
- SRTProcessor: Add metadata flattening for nested structures
- SRTProcessor: Remove low-quality summary section generation
- SRTProcessor: Add duration type checking (string or int)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 21:41:29 +08:00
starmen1265 1f599f0c60 fix: correct Zhipu API thinking parameter and add non-interactive archive mode
PR Test / lint (pull_request) Successful in 2s
2026-03-20 00:44:41 +08:00
starmen1265 fbdfc2d68a fix(12-02): add SRTProcessor to processors/__init__.py exports
PR Test / lint (pull_request) Successful in 1s
2026-03-20 00:16:53 +08:00
starmen1265 8d41a1b324 feat(12-02): modify Pipeline for platform-specific processing flow
- Add Bilibili video detection: platform=bilibili and content_type=video
- Skip analyze step for Bilibili videos, use srt step instead
- Skip srt step for non-Bilibili-video content
- Add SRTInput import and step input creation logic
- Update _populate_skipped_step_results for srt step
- Add output_file, paragraphs, tags, corrected to result fields

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 23:43:39 +08:00
starmen1265 87b1919483 feat(12-01): implement SRTProcessor and Markdown generation
- Add SRTInput/SRTOutput schemas to pipeline
- Create SRTProcessor following BaseProcessor pattern
- Generate Markdown with YAML frontmatter
- Support metadata extraction and formatting
- Handle missing metadata gracefully

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 23:38:56 +08:00
starmen1265 76f06c330b feat(09-01): integrate ZhihuCrawler into ZhihuAdapter
- Replace ZhihuPlaywrightExtractor with ZhihuCrawler
- Add comment crawling with include_comments=True by default
- Implement cookie expiration detection and QR code login trigger
- Add idempotency check via IdempotencyChecker
- Add comment formatting with "## 热门评论" section
- Convert HTML content to Markdown using html2text

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 23:14:22 +08:00
starmen1265 9fc52ffbdd refactor: integrate kb-deep-analyzer as kb_workflow.deep_analyzer package
- Move kb-deep-analyzer/deep_analyzer.py to kb_workflow/deep_analyzer/__init__.py
- Update analyze.py to import from kb_workflow.deep_analyzer directly
- Remove sys.path manipulation for external package
- DeepAnalyzer, SimpleAIClient, generate_frontmatter now available as:
  from kb_workflow.deep_analyzer import DeepAnalyzer, SimpleAIClient, generate_frontmatter

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 15:28:58 +08:00
starmen1265 14b3a3c4c1 fix(analyze): correct kb-deep-analyzer path calculation
- Add one more .parent to reach correct directory level
- Fixed path: /home/.../kb-skills/kb-deep-analyzer (was /home/.../kb-skills/kb_workflow/kb-deep-analyzer)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 15:14:22 +08:00
starmen1265 ee0fc74378 fix(download): return author name instead of mid in _extract_author
PR Test / lint (pull_request) Successful in 1s
- Fix download processor to return actual author name (e.g. "HOLA小测佬")
  instead of B站用户ID (mid, e.g. "406636263")
- Add 5 test cases for author extraction logic
- Resolves report display issue where UP主名称 showed numeric ID

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 13:50:02 +08:00
starmen1265 72d75e3454 feat(06-03): export Pipeline class from pipeline package
- Add Pipeline import from kb_workflow.pipeline.pipeline
- Add Pipeline to __all__ exports list
- Enables: from kb_workflow.pipeline import Pipeline

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 00:34:26 +08:00
starmen1265 8b07ef9dcd refactor(06-03): move sys.path manipulation to lazy import in analyze.py
- Remove top-level sys.path.insert for kb-deep-analyzer
- Add module-level flag _deep_analyzer_path_added for single execution
- Move sys.path manipulation inside _run_analysis method
- External dependency import now happens lazily at runtime

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 00:34:06 +08:00
starmen1265 fdca690bd6 feat(06-02): move processors and platforms to kb_workflow.pipeline
- Move all processor implementations (parse, download, asr, analyze, archive)
- Move all platform adapters (base, bilibili, zhihu)
- Update all internal imports to use kb_workflow.pipeline prefix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 00:17:01 +08:00
starmen1265 279ae684ea feat(06-02): move pipeline core files to kb_workflow.pipeline
- Move pipeline.py, schemas.py, config.py, state.py, errors.py
- Move retry.py, idempotency.py, link_parser.py
- Create pipeline/__init__.py with updated imports
- Update all internal imports to use kb_workflow.pipeline prefix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 00:16:56 +08:00