feat: Initial v0.9 release with API Key authentication
## v0.9.20260325_144654 ### Features - API Key Authentication System - Job Worker System - V2 Backup Versioning ### Bug Fixes - get_processor_results_by_job column mapping Co-authored-by: OpenCode
This commit is contained in:
@@ -1,5 +1,22 @@
|
||||
# Rust 開發規範 - Momentry Core
|
||||
|
||||
| 項目 | 內容 |
|
||||
|------|------|
|
||||
| 建立者 | Warren |
|
||||
| 建立時間 | 2026-03-16 |
|
||||
| 文件版本 | V1.0 |
|
||||
|
||||
---
|
||||
|
||||
## 版本歷史
|
||||
|
||||
| 版本 | 日期 | 目的 | 操作人 | 工具/模型 |
|
||||
|------|------|------|--------|-----------|
|
||||
| V1.0 | 2026-03-16 | 創建文件 | Warren | OpenCode / MiniMax M2.5 |
|
||||
| V1.1 | 2026-03-21 | 新增 PythonExecutor 模組說明 | OpenCode | - |
|
||||
|
||||
---
|
||||
|
||||
本規範定義 Momentry Core 專案的 Rust 開發標準,確保程式碼品質與一致性。
|
||||
|
||||
## 1. 專案結構
|
||||
@@ -27,6 +44,7 @@ src/
|
||||
│ │ └── qdrant_db.rs
|
||||
│ ├── processor/ # 影片處理器
|
||||
│ │ ├── mod.rs
|
||||
│ │ ├── executor.rs # Python 腳本統一執行器 (含超時控制)
|
||||
│ │ ├── asr.rs # 語音識別
|
||||
│ │ ├── asrx.rs # 說話者分離
|
||||
│ │ ├── ocr.rs # 文字辨識
|
||||
@@ -273,6 +291,47 @@ for line in stderr.lines() {
|
||||
}
|
||||
```
|
||||
|
||||
### 5.3 PythonExecutor 統一執行器
|
||||
|
||||
使用 `PythonExecutor` 封裝 Python 腳本執行邏輯:
|
||||
|
||||
```rust
|
||||
use momentry_core::core::processor::{PythonExecutor, validate_python_env};
|
||||
|
||||
// 驗證 Python 環境
|
||||
fn init() -> Result<()> {
|
||||
validate_python_env()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// 使用 Executor 執行腳本
|
||||
async fn run_script() -> Result<()> {
|
||||
let executor = PythonExecutor::new()?;
|
||||
|
||||
executor.run(
|
||||
"asr_processor.py",
|
||||
&["/path/to/video.mp4", "/path/to/output.json"],
|
||||
Some("job-uuid"),
|
||||
"ASR",
|
||||
Some(Duration::from_secs(3600)), // 1小時超時
|
||||
).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
||||
#### Processor 超時設定
|
||||
|
||||
| Processor | 超時 | 說明 |
|
||||
|----------|------|------|
|
||||
| ASR | 1 小時 | 語音識別 |
|
||||
| ASRx | 2 小時 | 說話者分離 |
|
||||
| YOLO | 2 小時 | 物件偵測 |
|
||||
| OCR | 2 小時 | 文字辨識 |
|
||||
| Face | 2 小時 | 人臉偵測 |
|
||||
| Pose | 2 小時 | 姿態估計 |
|
||||
| Cut | 1 小時 | 場景偵測 |
|
||||
|
||||
---
|
||||
|
||||
## 6. Python 與 Node.js 混用規範
|
||||
@@ -379,7 +438,7 @@ let output = Command::new(venv_python)
|
||||
| **獨立路徑** | Python 用 venv 路徑,Node.js 用 node@22 路徑 |
|
||||
| **獨立環境** | n8n 服務使用 launchd plist,不與 Rust 共享環境 |
|
||||
| **明確版本** | 所有腳本明確指定直譯器路徑 |
|
||||
| **PORT 分配** | n8n: 5678/5690, API: 另行分配 |
|
||||
| **PORT 分配** | n8n: 5678/5679, API: 另行分配 |
|
||||
|
||||
#### 6.4.2 環境變數隔離
|
||||
|
||||
|
||||
Reference in New Issue
Block a user