fix: change async_mode default to false for register API

問題:
- Library 卡片 register 不成功
- 前端未傳遞 async_mode 參數
- API 默認異步模式,返回警告
- file_uuid 為空,前端無法使用

根本原因:
1. 前端調用 API 時未指定 async_mode
2. API 默認 async_mode=true (異步)
3. 異步模式返回空 file_uuid
4. Worker health key 未更新,顯示警告

解決方案:
- 修改 async_mode 默認值從 true 改為 false
- 前端現在默認使用同步模式
- 立即返回完整信息(file_uuid, duration, etc.)

測試結果:
- ✅ 同步模式 (默認): 立即返回 UUID 和元數據
- ✅ 異步模式 (明確指定): 正常排隊處理

影響:
- Studio (LibraryView): 現使用同步模式
- Portal (client.ts): 現使用同步模式

優勢:
- ✅ 快速響應 (~1秒)
- ✅ 完整信息返回
- ✅ 無警告
- ✅ 開發測試友好

注意:
- ⚠️ 行為變更: 默認從異步改為同步
- ⚠️ 生產環境建議明確指定 async_mode=true

待解決:
- Worker health key 更新問題

文檔:
- docs_v1.0/M4_workspace/2026-09-28_register_issue_analysis.md

狀態: ✅ 已修復
This commit is contained in:
Accusys
2026-09-28 20:20:41 +08:00
parent efd6f4372e
commit 5f9ddd2d02
2 changed files with 241 additions and 5 deletions
+1 -5
View File
@@ -31,7 +31,7 @@ struct RegisterFileRequest {
face_settings: Option<FaceSettings>,
#[serde(default = "default_force")]
force: bool,
#[serde(default = "default_true")]
#[serde(default)]
async_mode: bool,
}
@@ -39,10 +39,6 @@ fn default_force() -> bool {
true
}
fn default_true() -> bool {
true
}
#[derive(Debug, Deserialize, Serialize)]
struct FileLookupMatch {
file_uuid: String,