docs(spec): 录音本地化 spec 修订——media_type='audio' 新label + store/session 接缝澄清
spec review(Approved)3 条 advisory:media_type 约定、ObjectStore 来源、 session 而非 engine。 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -41,7 +41,7 @@
|
||||
- Alembic 迁移 `ADD COLUMN`(nullable,回填由 sync pass 填)。
|
||||
- 不复用 `phone_call.download_count`/`is_upload`(那些是云客侧原值);`record_media_hash` 是本地化标记。
|
||||
|
||||
`Media` 行(下载时写):`media_hash`=sha256(bytes)(录音无 md5,用 sha256)、`media_type`='audio'、`mime_type`='audio/mpeg'、`original_url`=record_file、`local_path`、`size_bytes`、`channel`=phone_call.channel、`raw_json`=null。
|
||||
`Media` 行(下载时写):`media_hash`=sha256(bytes)(录音无 md5,用 sha256)、`media_type`='audio'(**新 label**——现有约定是 `image|voice|video|file`,列是 free-form `String(32)` 所以可用;plan 时更新 `Media.media_type` 注释把 `audio` 纳入约定)、`mime_type`='audio/mpeg'、`original_url`=record_file、`local_path`、`size_bytes`、`channel`=phone_call.channel、`raw_json`=null。
|
||||
|
||||
## 4. 下载逻辑 `download_call_recordings`
|
||||
|
||||
@@ -66,9 +66,9 @@ async def download_call_recordings(client, store, session, batch_size=50) -> int
|
||||
|
||||
## 5. sync
|
||||
|
||||
- `sync_call_recordings(engine, ...)`:照 `sync_wa_voice_calls` 模式(开 session、跑 `download_call_recordings`、写 `SyncRun`)。**不抓云客列表**——只读本地 DB 找缺媒体 call,从公开 OSS 下载。
|
||||
- `sync_call_recordings(session, client, store)`:照 `sync_wa_voice_calls` 模式(跑 `download_call_recordings`、写 `SyncRun`)。**注意**:现有 `sync_*` 多为 `(session, client)`,但本 func 还需 `store: ObjectStore`——scheduler 的 wrapper `_run_<entity>(session, client, store)` 已传 store(见 scheduler.py),故 orchestrator 直接接收;若 wrapper 未传则在 func 内 `ObjectStore()`(默认 `MEDIA_DIR`)。**不抓云客列表**——只读本地 DB 找缺媒体 call,从公开 OSS 下载。
|
||||
- `client`:复用 `YunkeClient`(其 httpx session,下载公开 OSS 走同一 transport/ mocked 测试)。
|
||||
- scheduler `ENTITY_FUNCS['call_recordings'] = sync_call_recordings`;CLI `sync --entity call_recordings` 可独立跑。
|
||||
- scheduler `ENTITY_FUNCS['call_recordings']`(wrapper `_run_call_recordings` 委托 `sync_call_recordings`);CLI `sync --entity call_recordings` 可独立跑。
|
||||
- **独立 pass 的理由**:解耦于 call 抓取(不拖慢)、可重试/可续、量大(~1261+)单独跑不阻塞其它实体。
|
||||
|
||||
## 6. API + 类型
|
||||
|
||||
Reference in New Issue
Block a user