feat: 动态路径系统 - 支持任意用户环境部署

问题:
- 100+ 处硬编码路径 /Users/accusys
- 无法在不同用户环境部署
- 配置文件路径固定

解决方案:
1. ✅ 创建 paths.rs 模块
   - get_home_dir() - 获取用户主目录
   - get_momentry_core_root() - Core API 根目录
   - get_markbase_root() - MarkBase 根目录
   - get_studio_root() - Studio 根目录
   - get_storage_root() - 存储根目录
   - 环境变量优先 > 用户主目录推断

2. ✅ 修改 main.rs
   - 移除所有硬编码路径
   - 使用动态路径函数
   - 支持环境变量配置

3. ✅ 创建配置模板
   - admin_config.json.template
   - .env.template
   - 使用 {{HOME}} 占位符

4. ✅ 创建自动化脚本
   - install.sh - 通用安装脚本
   - generate_config.sh - 配置生成脚本
   - 自动检测用户环境

特性:
- ✅ 支持任意用户环境
- ✅ 自动检测用户主目录
- ✅ 环境变量优先级控制
- ✅ 一键安装部署

测试:
- ✅ 编译通过 (cargo check)
- ⚠️ 需要在新环境测试

使用方法:
1. 克隆项目
2. ./install.sh
3. 编辑 .env
4. npm run proxy

适用环境:
- m5max48: /Users/accusys
- m4promini: /Users/nextorageai
- 任意 macOS 环境
This commit is contained in:
2026-10-12 12:34:53 +08:00
parent bb45f0981a
commit 0973f5cfd7
6 changed files with 584 additions and 17 deletions

View File

@@ -0,0 +1,84 @@
{
"vlm_prompts": {
"scene": {
"system_prompt": "Analyze this video frame and provide a detailed description.",
"user_prompt_template": "Describe the scene in detail, including environment, objects, and activities.",
"max_tokens": 500,
"temperature": 0.7,
"output_language": "en"
},
"trace": {
"system_prompt": "Describe the person's appearance and clothing in this frame.",
"user_prompt_template": "Describe the person, focusing on clothing, accessories, and notable features.",
"max_tokens": 300,
"temperature": 0.6,
"output_language": "en"
}
},
"llm_config": {
"model": "gpt-4o",
"max_tokens": 2000,
"temperature": 0.7,
"api_base": "http://localhost:8080/v1"
},
"processor_config": {
"asr": {
"enabled": true,
"language": "auto",
"model": "large-v3"
},
"ocr": {
"enabled": true,
"languages": ["en", "zh"],
"min_confidence": 0.5
},
"face": {
"enabled": true,
"min_confidence": 0.7,
"min_size": 32
}
},
"filter_config": {
"face": {
"min_confidence": 50.0,
"min_size": 32,
"min_capture_quality": 30.0
}
},
"paths": {
"output_dir": "{{HOME}}/momentry/output",
"backup_dir": "{{HOME}}/momentry/backup",
"scripts_dir": "{{HOME}}/momentry_core/scripts",
"python_path": "{{PYTHON_PATH}}",
"ffmpeg_path": "{{FFMPEG_PATH}}"
},
"concurrency": {
"max_concurrent_jobs": 6,
"poll_interval": 10,
"batch_size": 10,
"processor_timeout_secs": 3600
},
"feature_flags": {
"cache_enabled": true,
"auto_pipeline_enabled": false,
"watcher_auto_register": false,
"summary_enabled": true
},
"server": {
"port": 3002,
"media_base_url": "{{MEDIA_BASE_URL}}",
"serve_base_url": "{{SERVE_BASE_URL}}",
"storage_root": "{{HOME}}/momentry/var/sftpgo/data"
},
"admin_settings": {
"session_timeout": 3600,
"max_login_attempts": 5,
"api_key_expiry_days": 365,
"system_stats_refresh_sec": 5
},
"face_filter_defaults": {
"min_confidence": 50.0,
"min_size": 32,
"min_capture_quality": 25.0
}
}