Commit Graph

218 Commits

Author SHA1 Message Date
starmen1265 ae8f6080c9 删除就技能
PR Test / lint (pull_request) Successful in 2s
2026-03-16 16:55:21 +08:00
starmen1265 f98d649b5c docs: resolve debug kb-workflow-legacy-code-removal
PR Test / lint (pull_request) Successful in 1s
2026-03-16 15:27:57 +08:00
starmen1265 0f0011b4a6 refactor(kb-workflow): remove legacy code - use kb_pipeline only
Root cause: kb_workflow.py contained 312 lines of deprecated legacy
code that was confusing AI agents. The legacy functions have been
completely replaced by the kb_pipeline package.

Changes:
- Removed all legacy functions (is_video_content, check_duplicate, etc.)
- Kept only process_command() and main() entry points
- Updated SKILL.md to remove old command examples
- File reduced from 495 to 143 lines (71% reduction)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 15:27:31 +08:00
starmen1265 f05c93d2b1 fix(zhihu): remove noscript tags to prevent duplicate images
PR Test / lint (pull_request) Successful in 1s
Zhihu HTML structure includes noscript fallback images:
<figure><img data-actualsrc=...><noscript><img src=...></noscript></figure>

After fixing lazy-load (replacing src with data-actualsrc), both imgs
have real URLs, causing duplicates. The fix removes noscript tags before
processing img elements.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 15:08:08 +08:00
starmen1265 c8cdcb4631 fix(bilibili): correct metadata and filename in archive
PR Test / lint (pull_request) Successful in 1s
- Add _normalize_metadata() to flatten nested metadata structure
- Fix generate_frontmatter() to use correct metadata fields
- Change _sanitize_filename() to return standardized "bilibili_{bvid}" format

Fixes: analysis.md frontmatter showing "未命名"/0/"未知" instead of actual values
Fixes: audio filename using video title instead of platform_bvid format

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 13:48:28 +08:00
starmen1265 30552f2e5c refactor: remove deprecated kb-xxx sub-skills
PR Test / lint (pull_request) Successful in 2s
Remove sub-skills that have been replaced by kb_pipeline:
- kb-link-parser -> kb_pipeline/link_parser.py
- kb-whisper -> kb_pipeline/processors/asr.py
- kb-whisper-diarization -> kb_pipeline/processors/asr.py
- kb-bilibili-content -> BilibiliAdapter.download_video()
- kb-zhihu-content -> ZhihuAdapter.fetch_content()
- kb-ocr-processor -> unused
- kb-funasr -> unused (ASR uses Whisper)

Retained skills (still used by kb_pipeline):
- kb-bilibili-metadata
- kb-deep-analyzer
- kb-zhihu-metadata

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 12:03:57 +08:00
starmen1265 ca57a2f901 chore: update pycache
PR Test / lint (pull_request) Successful in 2s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 00:24:55 +08:00
starmen1265 1239fed9a9 docs(debug): mark bilibili subtitle debug session as resolved
All fixes verified working:
- Video download for videos without official subtitles
- Whisper transcription with correct offset parsing
- Text extraction from Whisper JSON format
- End-to-end analysis with real video content

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 00:24:21 +08:00
starmen1265 dd9d4cdf90 fix(analyze): extract text from Whisper JSON format
- Handle Whisper transcription format (array of segments with text)
- Extract full text from transcription array before passing to DeepAnalyzer
- Fix offsets parsing to support both dict and list formats

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 00:20:25 +08:00
starmen1265 153e6dfeba chore: add generated files and directories
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 00:09:16 +08:00
starmen1265 c7cdd49f01 chore: add debug session and init file
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 00:09:16 +08:00
starmen1265 0b215dabe7 feat(download): add video download capability for videos without official subtitles
- Add download_video() to BilibiliAdapter using yt-dlp
- Add bilibili_cookie config to Settings
- Update DownloadProcessor to call video download for bilibili videos
- Add idempotency check to ASRProcessor for existing subtitle files
- Fix indentation error in asr.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 00:09:16 +08:00
starmen1265 07a9db85f7 feat(download): add video download capability for videos without official subtitles
- When content_type is video and no official subtitle available:
  - Download video using yt-dlp
  - Extract audio for Whisper fallback
- Update content_file with actual video path

This enables the pipeline to handle videos that don't have
official Bilibili subtitles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 00:09:16 +08:00
starmen1265 60b0eaec93 feat(download): add video download capability for videos without official subtitles
- When content_type is video and no official subtitle available:
  - Download video using yt-dlp
  - Extract audio for Whisper fallback
- Update content_file with actual video path

This enables the pipeline to handle videos that don't have
official Bilibili subtitles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 00:04:56 +08:00
starmen1265 729f4650d5 fix(pipeline): populate results for skipped steps and support old file naming
- When a step is skipped (already completed), ask user if they want to re-run
- If skipping, scan content_dir for existing files and populate results
- Support both new naming (platform_id_subtitle.json) and old naming (platform_id.json)
- This fixes the issue where analyze step couldn't find subtitle files
  when ASR step was skipped

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 23:49:34 +08:00
starmen1265 f24841996a fix(analyze): include original text for zhihu answer/zhuanlan types
知乎回答(answer)和专栏(zhuanlan)的原文没有被追加到分析报告中。
代码只在 content_type == "article" 时设置和追加原文。

修复:
- deep_analyzer.py: 扩展条件支持 answer, zhuanlan 类型
- analyze.py: 同步扩展原文追加条件

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 23:41:42 +08:00
starmen1265 8ad64a4d1b fix(asr): use content_dir for subtitle output instead of video_path
PR Test / lint (pull_request) Successful in 2s
- Add content_dir field to ASRInput schema
- Pass content_dir from pipeline when creating ASRInput
- Modify _try_official_subtitle to use content_dir for output
- Modify _run_whisper_basic to use content_dir for output
- Add validation for empty video_path in Whisper fallback

Root cause: DownloadProcessor sets content_file="" for video types,
causing Path("").parent to resolve to current directory instead of
content directory. Subtitle files were written to wrong location.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 22:59:24 +08:00
starmen1265 b6ff7c81aa fix(zhihu): handle lazy-load images in markdown conversion
知乎使用图片懒加载机制,`<img>` 标签的 `src` 属性包含 SVG 占位符,
真实图片 URL 在 `data-actualsrc` 或 `data-original` 属性中。
`markdownify` 只读取 `src`,导致转换后得到无效占位符。

修复:在转换前预处理 HTML,将真实图片 URL 替换到 `src` 属性。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 22:59:24 +08:00
starmen1265 aae4d2fd70 docs(debug): resolve asyncio nested loop debug session
Root cause: BilibiliExtractor sync wrappers use asyncio.run() internally,
which fails when called from async context in BilibiliAdapter.

Fix: Call async methods directly instead of sync wrappers.

Verified: Human confirmed fix works (bilibili_BV16cNMzpExh)
2026-03-15 22:59:24 +08:00
starmen1265 47c4ee39c1 Merge branch 'main' into fix/ci-deploy-reset
PR Test / lint (pull_request) Successful in 2s
2026-03-15 18:17:51 +08:00
starmen1265 5d06056b43 fix(download): handle formatted duration strings in metadata
PR Test / lint (pull_request) Successful in 1s
Parse duration strings like "12:34" or "01:23:45" into seconds.
Previously only integer duration values were handled.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 18:17:03 +08:00
starmen1265 368e946cd1 fix(bilibili): avoid nested asyncio.run() in async context
BilibiliAdapter._fetch_metadata_with_retry() now calls the underlying
async methods directly instead of sync wrappers that use asyncio.run().
This prevents "asyncio.run() cannot be called from a running event loop"
error when the adapter is called from within an already-running event loop.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 18:17:03 +08:00
starmen1265 264dbe1cde Merge pull request 'fix/ci-deploy-reset' (#9) from fix/ci-deploy-reset into main
Deploy kb-skills / deploy (push) Successful in 2s
Reviewed-on: http://192.168.1.22:8418/starmen1265/kb-skills/pulls/9
2026-03-15 01:05:13 +08:00
starmen1265 f7569af007 Merge branch 'main' into fix/ci-deploy-reset
PR Test / lint (pull_request) Successful in 1s
2026-03-15 01:04:55 +08:00
starmen1265 6883a701c0 docs(kb-workflow): update SKILL.md for new pipeline architecture
PR Test / lint (pull_request) Successful in 2s
- Simplify to single-command workflow: kb-workflow process <url>
- Document new CLI parameters and options
- Add architecture overview
- Remove deprecated multi-step manual process

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 01:03:18 +08:00
starmen1265 46f7feb146 chore: complete v1.0 milestone
- Archive ROADMAP and REQUIREMENTS to milestones/
- Delete original ROADMAP.md and REQUIREMENTS.md
- Update PROJECT.md with v1.0 validated requirements
- Update STATE.md for milestone complete status
- Update MILESTONES.md with key accomplishments
- Add VERIFICATION.md for phase 04

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 00:59:18 +08:00
starmen1265 7cf6ddd02f chore: complete v1.0 milestone 2026-03-15 00:59:12 +08:00
starmen1265 5736e2228e docs(04-05): complete CLI process subcommand and E2E tests plan
- CLI 'process' subcommand for single-command workflow execution
- End-to-end integration tests (16 tests passing)
- State persistence and resumability verified

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 00:10:10 +08:00
starmen1265 ec2d12a05b feat(04-05): implement Pipeline.run() method
- Add async run() method to Pipeline class
- Execute processors sequentially with state persistence
- Handle step-specific input types (Parse, Download, ASR, Analyze)
- Support skip_completed for resumable workflows
- Return PipelineOutput with results and content_dir

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:46:54 +08:00
starmen1265 377794b5b3 test(04-05): add end-to-end integration tests
- Test full workflow execution from URL to analysis
- Test workflow error handling
- Test state persistence
- Test workflow resumability (skip completed steps)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:46:46 +08:00
starmen1265 33eeb6bc34 feat(04-05): add CLI 'process' subcommand
- Add process_command function that executes full pipeline
- Add subparser for 'process' command with URL argument
- Add --output-dir and --skip-completed flags
- Add --no-skip flag to re-run all steps
- Maintain backward compatibility with legacy arguments

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:44:10 +08:00
starmen1265 76aefa23e1 test(04-05): add failing tests for CLI process subcommand
- Test process --help shows usage
- Test process <url> calls Pipeline.run()
- Test invalid URL returns error
- Test --output-dir flag
- Test --no-skip flag

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:43:06 +08:00
starmen1265 f9f8ec84fc docs(04-04): complete Pipeline schemas and class plan 2026-03-13 23:39:49 +08:00
starmen1265 0dfb51e9aa feat(04-04): create Pipeline class with processor initialization
- Pipeline class initializes with processors list
- Validates processor STEP_NAME matches config.steps
- _parse_url method parses URLs using LinkParser
- _get_content_dir creates content directory from parsed URL

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:38:17 +08:00
starmen1265 789d1f43e0 feat(04-04): add PipelineInput/Output/Config schemas
- PipelineInput: url (required), output_dir, skip_completed
- PipelineOutput: success, error_message, results, content_dir
- PipelineConfig: steps, output_dir, skip_completed, max_retries

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:37:35 +08:00
starmen1265 5d4cb93f8b test(04-04): add schema validation tests for PipelineInput/Output/Config
- Test PipelineInput validates url field (required)
- Test PipelineOutput contains results dict
- Test PipelineConfig has default steps list
- Test PipelineConfig allows custom output_dir

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:37:28 +08:00
starmen1265 93c4f20044 docs(04-03): complete AnalyzeProcessor plan
- AnalyzeProcessor wraps DeepAnalyzer for AI-powered content analysis
- Analysis reports saved as Markdown with YAML frontmatter
- All 15 tests passing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:34:52 +08:00
starmen1265 029718e7e0 feat(04-03): export AnalyzeProcessor from processors module
- Add AnalyzeProcessor to __init__.py exports
- Update module docstring

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:32:53 +08:00
starmen1265 0b7d8707bf feat(04-03): implement AnalyzeProcessor with DeepAnalyzer integration
- AnalyzeProcessor wraps existing DeepAnalyzer for pipeline integration
- Loads metadata and content from JSON files
- Generates analysis reports as Markdown with frontmatter
- Records state on success and failure
- Supports both video and article content types

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:32:31 +08:00
starmen1265 51644997e4 feat(04-03): add AnalyzeInput and AnalyzeOutput schemas
- AnalyzeInput extends StepInput with metadata_file, content_file, content_type, output_file
- AnalyzeOutput extends StepOutput with analysis_file, summary, main_topics, key_insights, tags, stats
- Supports both video and article content types

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:28:30 +08:00
starmen1265 87d64b57c0 test(04-03): add failing tests for AnalyzeInput/AnalyzeOutput schemas
- Test schema validation for AnalyzeInput (metadata_file, content_file, content_type, output_file)
- Test schema validation for AnalyzeOutput (analysis_file, summary, main_topics, key_insights, tags, stats)
- Test AnalyzeProcessor integration with DeepAnalyzer
- Test state recording on success and failure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:27:59 +08:00
starmen1265 df4323af13 docs(04-02): complete DownloadProcessor plan 2026-03-13 23:25:27 +08:00
starmen1265 ec268f7d17 feat(04-02): add content downloading and module export for DownloadProcessor
TDD GREEN phase:
- DownloadProcessor downloads article/answer/zhuanlan content
- Video content is skipped (handled by ASR in Phase 3)
- Content files saved with correct naming convention
- DownloadProcessor exported from kb_pipeline.processors
- All 17 tests pass

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:24:00 +08:00
starmen1265 fc6fba76b2 feat(04-02): implement DownloadProcessor with metadata fetching
TDD GREEN phase:
- DownloadProcessor inherits from BaseProcessor
- Fetches metadata from Bilibili and Zhihu adapters
- Saves metadata to content_dir as JSON
- Records state on success/failure
- Skips step if already completed (idempotency)
- All metadata tests pass

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:22:48 +08:00
starmen1265 567bd32c94 test(04-02): add failing tests for DownloadProcessor metadata fetching
TDD RED phase:
- Test DownloadProcessor fetches Bilibili video metadata correctly
- Test DownloadProcessor fetches Zhihu answer metadata correctly
- Test DownloadProcessor records state on success
- Test DownloadProcessor records state on failure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:19:21 +08:00
starmen1265 1e012366e1 feat(04-02): add DownloadInput and DownloadOutput schemas
TDD GREEN phase:
- DownloadInput extends StepInput with content_dir and content_type
- DownloadOutput extends StepOutput with metadata_file, content_file, title, author, duration
- Supports video, article, answer, zhuanlan content types
- All schema validation tests pass

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:18:29 +08:00
starmen1265 9d5c3ffc48 test(04-02): add failing tests for DownloadInput/DownloadOutput schemas
TDD RED phase:
- Test DownloadInput validates required fields (content_dir, content_type)
- Test DownloadOutput validates required fields (metadata_file, content_file, title, author)
- Test DownloadOutput handles both video and article content types

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:17:54 +08:00
starmen1265 57e6d9b6b2 docs(04-01): complete BaseProcessor and ParseProcessor plan
- BaseProcessor abstract class with unified interface
- ParseProcessor wrapping LinkParser for URL parsing
- ParseInput/ParseOutput schemas for parse step
- All tests passing (18 tests)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:16:17 +08:00
starmen1265 06d36fc440 feat(04-01): implement ParseProcessor and update module exports
- ParseProcessor wraps LinkParser for URL parsing
- Returns ParseOutput with platform, content_type, content_id
- Records state when state_manager is provided
- Handles unknown URLs with success=False
- Export BaseProcessor, ParseProcessor, ASRProcessor from __init__.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:14:32 +08:00
starmen1265 efddef98d3 feat(04-01): add ParseInput and ParseOutput schemas
- ParseInput extends StepInput with url field
- ParseOutput extends StepOutput with platform, content_type, content_id, resolved_url, original_url
- Tests for schema validation and inheritance

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:11:44 +08:00