- 创建 plugin_manager.py 模块
- PluginManager: 插件管理主类
- ChromeExtensionHandler: Chrome 插件处理
- BotHandler: 飞书/钉钉/Slack 机器人处理
- WebhookIntegration: Zapier/Make Webhook 集成
- WebDAVSync: WebDAV 同步管理
- 创建完整的 Chrome 扩展代码
- manifest.json, background.js, content.js, content.css
- popup.html/js: 弹出窗口界面
- options.html/js: 设置页面
- 支持网页剪藏、选中文本保存、项目选择
- 更新 schema.sql 添加插件相关数据库表
- plugins: 插件配置表
- bot_sessions: 机器人会话表
- webhook_endpoints: Webhook 端点表
- webdav_syncs: WebDAV 同步配置表
- plugin_activity_logs: 插件活动日志表
- 更新 main.py 添加插件相关 API 端点
- GET/POST /api/v1/plugins - 插件管理
- POST /api/v1/plugins/chrome/clip - Chrome 插件保存网页
- POST /api/v1/bots/webhook/{platform} - 接收机器人消息
- GET /api/v1/bots/sessions - 机器人会话列表
- POST /api/v1/webhook-endpoints - 创建 Webhook 端点
- POST /webhook/{type}/{token} - 接收外部 Webhook
- POST /api/v1/webdav-syncs - WebDAV 同步配置
- POST /api/v1/webdav-syncs/{id}/test - 测试 WebDAV 连接
- POST /api/v1/webdav-syncs/{id}/sync - 触发 WebDAV 同步
- 更新 requirements.txt 添加插件依赖
- beautifulsoup4: HTML 解析
- webdavclient3: WebDAV 客户端
- 更新 STATUS.md 和 README.md 开发进度
105 lines
4.4 KiB
SQL
105 lines
4.4 KiB
SQL
-- Phase 7: 多模态支持相关表
|
||
|
||
-- 视频表
|
||
CREATE TABLE IF NOT EXISTS videos (
|
||
id TEXT PRIMARY KEY,
|
||
project_id TEXT NOT NULL,
|
||
filename TEXT NOT NULL,
|
||
file_path TEXT,
|
||
duration REAL, -- 视频时长(秒)
|
||
width INTEGER, -- 视频宽度
|
||
height INTEGER, -- 视频高度
|
||
fps REAL, -- 帧率
|
||
audio_extracted INTEGER DEFAULT 0, -- 是否已提取音频
|
||
audio_path TEXT, -- 提取的音频文件路径
|
||
transcript_id TEXT, -- 关联的转录记录ID
|
||
status TEXT DEFAULT 'pending', -- pending, processing, completed, failed
|
||
error_message TEXT,
|
||
metadata TEXT, -- JSON: 其他元数据
|
||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||
FOREIGN KEY (project_id) REFERENCES projects(id),
|
||
FOREIGN KEY (transcript_id) REFERENCES transcripts(id)
|
||
);
|
||
|
||
-- 视频关键帧表
|
||
CREATE TABLE IF NOT EXISTS video_frames (
|
||
id TEXT PRIMARY KEY,
|
||
video_id TEXT NOT NULL,
|
||
frame_number INTEGER NOT NULL,
|
||
timestamp REAL NOT NULL, -- 帧时间戳(秒)
|
||
frame_path TEXT NOT NULL, -- 帧图片路径
|
||
ocr_text TEXT, -- OCR识别的文字
|
||
ocr_confidence REAL, -- OCR置信度
|
||
entities_detected TEXT, -- JSON: 检测到的实体
|
||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||
FOREIGN KEY (video_id) REFERENCES videos(id) ON DELETE CASCADE
|
||
);
|
||
|
||
-- 图片表
|
||
CREATE TABLE IF NOT EXISTS images (
|
||
id TEXT PRIMARY KEY,
|
||
project_id TEXT NOT NULL,
|
||
filename TEXT NOT NULL,
|
||
file_path TEXT,
|
||
image_type TEXT, -- whiteboard, ppt, handwritten, screenshot, other
|
||
width INTEGER,
|
||
height INTEGER,
|
||
ocr_text TEXT, -- OCR识别的文字
|
||
description TEXT, -- 图片描述(LLM生成)
|
||
entities_detected TEXT, -- JSON: 检测到的实体
|
||
relations_detected TEXT, -- JSON: 检测到的关系
|
||
transcript_id TEXT, -- 关联的转录记录ID(可选)
|
||
status TEXT DEFAULT 'pending', -- pending, processing, completed, failed
|
||
error_message TEXT,
|
||
metadata TEXT, -- JSON: 其他元数据
|
||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||
FOREIGN KEY (project_id) REFERENCES projects(id),
|
||
FOREIGN KEY (transcript_id) REFERENCES transcripts(id)
|
||
);
|
||
|
||
-- 多模态实体关联表
|
||
CREATE TABLE IF NOT EXISTS multimodal_entities (
|
||
id TEXT PRIMARY KEY,
|
||
project_id TEXT NOT NULL,
|
||
entity_id TEXT NOT NULL, -- 关联的实体ID
|
||
source_type TEXT NOT NULL, -- audio, video, image, document
|
||
source_id TEXT NOT NULL, -- 来源ID(transcript_id, video_id, image_id)
|
||
mention_context TEXT, -- 提及上下文
|
||
confidence REAL DEFAULT 1.0,
|
||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||
FOREIGN KEY (project_id) REFERENCES projects(id),
|
||
FOREIGN KEY (entity_id) REFERENCES entities(id),
|
||
UNIQUE(entity_id, source_type, source_id)
|
||
);
|
||
|
||
-- 多模态实体对齐表(跨模态实体关联)
|
||
CREATE TABLE IF NOT EXISTS multimodal_entity_links (
|
||
id TEXT PRIMARY KEY,
|
||
project_id TEXT NOT NULL,
|
||
source_entity_id TEXT NOT NULL, -- 源实体ID
|
||
target_entity_id TEXT NOT NULL, -- 目标实体ID
|
||
link_type TEXT NOT NULL, -- same_as, related_to, part_of
|
||
source_modality TEXT NOT NULL, -- audio, video, image, document
|
||
target_modality TEXT NOT NULL, -- audio, video, image, document
|
||
confidence REAL DEFAULT 1.0,
|
||
evidence TEXT, -- 关联证据
|
||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||
FOREIGN KEY (project_id) REFERENCES projects(id),
|
||
FOREIGN KEY (source_entity_id) REFERENCES entities(id),
|
||
FOREIGN KEY (target_entity_id) REFERENCES entities(id)
|
||
);
|
||
|
||
-- 创建索引
|
||
CREATE INDEX IF NOT EXISTS idx_videos_project ON videos(project_id);
|
||
CREATE INDEX IF NOT EXISTS idx_videos_status ON videos(status);
|
||
CREATE INDEX IF NOT EXISTS idx_video_frames_video ON video_frames(video_id);
|
||
CREATE INDEX IF NOT EXISTS idx_video_frames_timestamp ON video_frames(timestamp);
|
||
CREATE INDEX IF NOT EXISTS idx_images_project ON images(project_id);
|
||
CREATE INDEX IF NOT EXISTS idx_images_type ON images(image_type);
|
||
CREATE INDEX IF NOT EXISTS idx_images_status ON images(status);
|
||
CREATE INDEX IF NOT EXISTS idx_multimodal_entities_project ON multimodal_entities(project_id);
|
||
CREATE INDEX IF NOT EXISTS idx_multimodal_entities_entity ON multimodal_entities(entity_id);
|
||
CREATE INDEX IF NOT EXISTS idx_multimodal_entity_links_project ON multimodal_entity_links(project_id);
|