From f8a6acd009caf627bca40e9fd77f4d786e82b0e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=85=E5=BF=B5?= Date: Fri, 7 Aug 2026 15:22:08 +0800 Subject: [PATCH] =?UTF-8?q?docs(spec):=20=E5=BD=95=E9=9F=B3=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E5=8C=96=20spec=20=E4=BF=AE=E8=AE=A2=E2=80=94?= =?UTF-8?q?=E2=80=94media=5Ftype=3D'audio'=20=E6=96=B0label=20+=20store/se?= =?UTF-8?q?ssion=20=E6=8E=A5=E7=BC=9D=E6=BE=84=E6=B8=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit spec review(Approved)3 条 advisory:media_type 约定、ObjectStore 来源、 session 而非 engine。 Co-Authored-By: Claude --- .../specs/2026-08-07-yunke-recording-localization-design.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/superpowers/specs/2026-08-07-yunke-recording-localization-design.md b/docs/superpowers/specs/2026-08-07-yunke-recording-localization-design.md index 5d11e6c..8e94d58 100644 --- a/docs/superpowers/specs/2026-08-07-yunke-recording-localization-design.md +++ b/docs/superpowers/specs/2026-08-07-yunke-recording-localization-design.md @@ -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_(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 + 类型