feat: 添加本地字幕生成功能
- 新增 subtitle_generator.py 核心模块 - AudioDownloader: 使用 yt-dlp 下载视频音频 - WhisperTranscriber: Whisper 语音识别器 - SubtitleFormatter: SRT 格式化器 - SubtitleCache: 缓存管理器 - SubtitleGenerator: 统一接口 - 集成到 pipeline.py - 添加 _ensure_subtitle() 方法 - 自动检测无字幕视频并生成字幕 - 支持缓存机制避免重复处理 - 更新配置文件 - config.yaml.example 添加字幕配置项 - requirements.txt 添加依赖包 - 文档更新 - SKILL.md 添加字幕生成说明 - SUBTITLE_FEATURE.md 详细功能文档 - 测试脚本 - test_subtitle_generator.py 完整测试套件 特性: - 本地处理,数据不上传,隐私安全 - 支持中英文识别及自动检测 - 多种模型可选(tiny/base/small/medium/large) - 智能缓存,提升处理速度 - 完善的错误处理和日志输出
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
# obsidian-kb 配置文件示例
|
||||
# 复制此文件为 config.yaml 并修改配置
|
||||
|
||||
# Obsidian 笔记库路径
|
||||
obsidian_vault: ~/Documents/ObsidianVault
|
||||
|
||||
# 笔记输出目录(相对于 vault)
|
||||
output_dir: AI_Generated
|
||||
|
||||
# Git 同步配置
|
||||
git:
|
||||
enabled: false
|
||||
repo: ~/Documents/ObsidianVault
|
||||
branch: main
|
||||
auto_commit: true
|
||||
auto_push: true
|
||||
|
||||
# AI 客户端配置
|
||||
ai_client:
|
||||
provider: openai # openai 或 anthropic
|
||||
model: gpt-4o-mini
|
||||
api_key: ${OPENAI_API_KEY} # 从环境变量读取
|
||||
base_url: null # 自定义 API 端点(可选)
|
||||
temperature: 0.7
|
||||
max_tokens: 4000
|
||||
|
||||
# 内容处理配置
|
||||
content:
|
||||
max_video_length: 3600 # 最大视频长度(秒),超过则跳过
|
||||
min_transcript_length: 100 # 最小字幕长度(字符)
|
||||
chunk_size: 2000 # 文本分块大小(字符)
|
||||
chunk_overlap: 200 # 分块重叠大小(字符)
|
||||
|
||||
# 模板配置
|
||||
templates:
|
||||
note_template: templates/default_note.md
|
||||
summary_template: templates/default_summary.md
|
||||
deep_analysis_template: templates/default_deep_analysis.md
|
||||
|
||||
# 字幕生成配置(新增)
|
||||
subtitle:
|
||||
enabled: false # 是否启用自动生成字幕
|
||||
model: base # Whisper 模型大小: tiny/base/small/medium/large
|
||||
language: null # 语言代码: zh/en/null(自动检测)
|
||||
cache_dir: cache/subtitles # 字幕缓存目录
|
||||
audio_cache_dir: cache/audio # 音频缓存目录
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level: INFO # DEBUG, INFO, WARNING, ERROR
|
||||
file: logs/obsidian-kb.log
|
||||
Reference in New Issue
Block a user