Skip to content

Scheduled Directory Import (定时目录导入)#167

Merged
nashsu merged 22 commits into
nashsu:mainfrom
skfan135:main
May 14, 2026
Merged

Scheduled Directory Import (定时目录导入)#167
nashsu merged 22 commits into
nashsu:mainfrom
skfan135:main

Conversation

@skfan135
Copy link
Copy Markdown
Contributor

功能概述

新增定时目录导入功能,允许用户设置一个监控目录,系统会自动扫描并导入新增或修改的文件到项目中。

主要功能

  1. 定时扫描
    - 可配置扫描间隔(分钟)
    - 支持启用/禁用定时导入
    - 应用启动时自动开始扫描
  2. 智能文件检测
    - 使用 MD5 哈希值判断文件是否变化
    - 在监控目录下创建 .llm-wiki-imported/db.json 隐藏配置文件夹记录已扫描文件
    - 仅对新增或内容变化的文件执行导入
  3. 导入流程
    - 自动复制文件到 raw/sources/ 目录
    - 触发文件预处理(PDF/Office 文本提取)
    - 自动入队 LLM 摄入任务
  4. UI 设置
    - 新增"定时导入"设置分类
    - 目录选择器(支持浏览选择)
    - 扫描间隔配置
    - 手动"立即扫描"按钮
    - 显示上次扫描时间
  5. 多项目支持
    - 每个项目独立存储定时导入配置
    - 切换项目时自动加载对应配置
    - 路径支持绝对路径和相对路径

修改文件

  • src-tauri/Cargo.toml - 添加 md-5 依赖
  • src-tauri/src/commands/fs.rs - 新增 get_file_md5 命令
  • src-tauri/src/lib.rs - 注册新命令
  • src/commands/fs.ts - 添加 TypeScript 包装
  • src/lib/scheduled-import.ts - 核心逻辑(新建)
  • src/components/settings/sections/scheduled-import-section.tsx - UI 组件(新建)
  • src/components/settings/settings-view.tsx - 集成设置页面
  • src/components/settings/settings-types.ts - 添加配置类型
  • src/stores/wiki-store.ts - 状态管理
  • src/lib/project-store.ts - 配置持久化
  • src/App.tsx - 启动时初始化
  • src/i18n/en.json / src/i18n/zh.json - 国际化

skfan135 and others added 22 commits May 6, 2026 06:05
Add ability to monitor a directory and automatically import new or
modified files at configurable intervals. Features:
- Enable/disable toggle in Settings
- Directory picker for monitoring path
- Configurable scan interval (minutes)
- Manual scan button
- Auto-start on app launch when enabled
- Detects new and modified files
- Auto-ingests when LLM is configured

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The choco install approach was not reliably adding protoc to PATH.
Use the arduino/setup-protoc action instead which handles PATH setup
automatically.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
When scheduled import path is not configured, automatically use the
project's raw/ directory as the default monitoring path. This makes
it easier to set up scheduled imports without manually specifying
the directory.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Change scheduled import path from absolute to relative path. This
ensures the monitoring directory automatically follows the project
when switching between different projects. The path defaults to
'raw' (project root /raw/) when empty.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
When switching projects, reset the scheduled import path to the
default 'raw' directory instead of keeping the custom path from
the previous project. This ensures the monitoring directory always
follows the current project.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Scheduled import config is now keyed by project path so custom paths
survive project switches. Includes migration from the legacy global key.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Add get_file_md5 Rust command using md5 crate
- Store scanned file hashes in .llm-wiki-imported/db.json
- Compare MD5 to detect new/modified files instead of mtime
- Fix Scan Now button to properly scan import directory
- Keep both scheduled import (MD5-based) and file sync features
- Use md-5 crate (RustCrypto) instead of md5
- Merge all imports and dependencies
The CI build failed because @tauri-apps/api (2.10.1) didn't match
the Rust tauri crate (2.11.1). Updated all Tauri npm packages:
- @tauri-apps/api: 2.10.1 → 2.11.0
- @tauri-apps/cli: 2.10.1 → 2.11.1
- @tauri-apps/plugin-dialog: 2.7.0 → 2.7.1
- @tauri-apps/plugin-http: 2.5.8 → 2.5.9
- @tauri-apps/plugin-opener: 2.5.3 → 2.5.4
- @tauri-apps/plugin-store: 2.4.2 → 2.4.3

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Remove duplicate `const project` declaration (merge artifact)
- Make `projectFileSyncEnabled` parameter optional with default to
  fix "required parameter cannot follow optional parameter" error

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Use normalized path prefix comparison instead of string includes
to reliably skip the hidden config folder on all platforms.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@nashsu nashsu merged commit 5320a9c into nashsu:main May 14, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants