feat: remaining frontend views (groups/calls/sms/sync) + messageout media fields

Backend (Part A):
- MessageOut: add file_th_url, file_hd_url, duration, transcription_text, md5
  (room_id + sender_head_url already existed) so the chat timeline can render
  image thumbnails, voice duration/transcription, and avatars from a single
  response.
- PhoneCallOut: add record_file so the Calls view can offer recording playback.
- SmsOut: add content (full body) so the SMS detail dialog shows the whole text.
- Tests: red->green for each new field (media fields default None + populated,
  record_file round-trip, content round-trip). Suite 267 -> 271.

Frontend (Part B):
- api/index.ts: wrappers getGroups/getGroupMembers/getCalls/getSms/getSyncStatus
  + Group/GroupMember/PhoneCall/Sms/SyncState/SyncRun/SyncStatus types in
  types.ts (mirror the *Out pydantic schemas).
- views/GroupList.vue (/groups): table + channel filter + pagination; row click
  opens the group timeline.
- views/CallList.vue (/calls): table + call-type filter (phone_call/voice_call/
  all); "播放录音" action opens an el-dialog with <audio controls>.
- views/SmsList.vue (/sms): table; row click opens a detail dialog with the full
  content.
- views/SyncStatus.vue (/sync): two tables (states + recent_runs) with a manual
  refresh; run status color-coded.
- ChatTimeline.vue: reused for both 1:1 DM (talkerId) and group (roomId) by
  branching the query; group title + per-member sender already handled by
  MessageBubble.
- router: add /groups /calls /sms /sync + /group/:channel/:ownerId/:roomId.
- layouts/MainLayout.vue: replace the single 客户列表 button with an el-menu
  (客户 / 群 / 通话 / 短信 / 同步); org tree kept on the left.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-01 16:38:47 +08:00
parent 6c4cd92ae6
commit b822e87d4d
14 changed files with 1401 additions and 36 deletions
+17
View File
@@ -20,6 +20,7 @@ async def _seed(session: AsyncSession) -> None:
user_id="u1",
receive_name="Alice",
content_preview="hello",
content="hello, this is the full body",
create_time=1000,
direction=1,
sender="111",
@@ -40,6 +41,7 @@ async def _seed(session: AsyncSession) -> None:
user_id="u1",
receive_name="Alice",
content_preview="bye",
content="bye for now",
create_time=3000,
direction=1,
),
@@ -60,6 +62,7 @@ async def test_default_list_returns_all_ordered_desc(make_client):
"sms_id",
"customer_phone",
"content_preview",
"content",
"sender",
"direction",
"user_id",
@@ -109,3 +112,17 @@ async def test_pagination(make_client):
assert body["total"] == 3
assert len(body["items"]) == 1
assert body["items"][0]["sms_id"] == "s3"
async def test_content_field_serializes(make_client):
"""``content`` (full SMS body) round-trips so the SMS view can show the
whole message in a detail dialog — present when set, None when unset.
"""
client = await make_client(_seed)
r = await client.get("/api/sms")
assert r.status_code == 200
by_id = {it["sms_id"]: it for it in r.json()["items"]}
assert by_id["s1"]["content"] == "hello, this is the full body"
assert by_id["s3"]["content"] == "bye for now"
# s2 was seeded without content -> None.
assert by_id["s2"]["content"] is None