前后端与模型协作Client, backend and models
把实时语音拆成清楚的几段A real-time pipeline with clear boundaries
SwiftUI 客户端管理通知、通话界面和音频设备。FastAPI 在通话中中继音频与转写,挂断后再调用独立的文本模型生成日记。模型密钥保存在服务端。The SwiftUI client handles notifications, call controls and audio devices. FastAPI relays audio and transcription during the call, then asks a separate text model to draft the journal. Model credentials stay on the server.
SwiftUI iOS音频 · 转写 · 日记Audio · transcript · diary
↕ WebSocketFastAPI会话 · 中继 · 任务编排Sessions · relay · orchestration
豆包实时语音 · ASR / TTSDoubao live voice · ASR / TTSResponses API · Diary Generator
会话归档Session archive转写与日记正文Transcript and diary entry
- SwiftUI · iOS 17+
- 原生 iOS 客户端承载通话、日历、今日记录和个人设置。Native iOS screens for calls, calendar, today’s journal and personal settings.
- AVFoundation · PCM
- 采集麦克风声音、播放 AI 回复,并处理 16 kHz 输入与 24 kHz 输出的单声道音频。Captures microphone audio, plays AI speech and handles mono audio at 16 kHz input and 24 kHz output.
- Python · FastAPI · asyncio · websockets
- 负责 WebSocket 会话、中继状态、通话收尾和会后总结任务。Coordinates WebSocket sessions, relays audio, and runs post-call journal generation.
- WebSocket · 豆包实时语音 O2.0
- iOS 把音频交给 FastAPI,再由后端中继至豆包;ASR 转写和 TTS 语音沿实时链路返回。iOS streams audio to FastAPI, which relays it to Doubao. ASR transcripts and TTS audio return through the live connection.
- Responses API · GPT-5.4
- 通话结束后,把转写整理成第一人称日记,并只保留用户明确讲出的内容。After a call, turns the transcript into a first-person journal entry using only what the user actually said.
- UserDefaults · JSONL
- iOS 本机保存设置和历史记录,原型后端将转写与日记写入 JSONL。The iOS app stores settings and history on-device. The prototype backend stores transcripts and entries in JSONL.
不保存录音;原始转写保留 30 天,日记与转写分开管理。Audio recordings are not stored. Raw transcripts are retained for 30 days, separately from the diary.