From 1f32d34fe1db311a2bdff7b41b4c90fc03a5f231 Mon Sep 17 00:00:00 2001 From: xiaopyyy Date: Thu, 3 Dec 2026 00:04:38 -0500 Subject: [PATCH] docs: clarify product scope and architecture in English and Chinese --- README.md | 7 +- README.zh-CN.md | 7 +- docs/architecture.svg | 66 +++++++++++ docs/architecture.zh-CN.svg | 66 +++++++++++ docs/full-duplex-sequence.svg | 52 ++++++++ docs/full-duplex-sequence.zh-CN.svg | 52 ++++++++ docs/integrating.md | 4 +- docs/model-pipeline.svg | 28 +++++ docs/model-pipeline.zh-CN.svg | 28 +++++ docs/product-definition.md | 177 ++++++++++++++++++++++++++++ docs/product-definition.zh-CN.md | 177 ++++++++++++++++++++++++++++ host/README.md | 2 +- 12 files changed, 657 insertions(+), 9 deletions(-) create mode 100644 docs/architecture.svg create mode 100644 docs/architecture.zh-CN.svg create mode 100644 docs/full-duplex-sequence.svg create mode 100644 docs/full-duplex-sequence.zh-CN.svg create mode 100644 docs/model-pipeline.svg create mode 100644 docs/model-pipeline.zh-CN.svg create mode 100644 docs/product-definition.md create mode 100644 docs/product-definition.zh-CN.md diff --git a/README.md b/README.md index 34ec60d..1374af9 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Open Voice +# OpenVoice Agent-native voice personal agent, powered by vLLM-Omni. -Voice is the native modality, not a wrapper around a chatbot: Open Voice +Voice is the native modality, not a wrapper around a chatbot: OpenVoice listens, understands, and acts — running durable jobs, routing across providers, and handing off across devices — while your voice preferences and knowledge stay on your device. @@ -23,8 +23,9 @@ See `docs/subsystems/` for one doc per subsystem. ## Docs +- `docs/product-definition.md` — product definition, target users, architecture, roadmap (中文: `docs/product-definition.zh-CN.md`) - `docs/reference.md` — configuration / CLI / API reference -- `docs/integrating.md` — embed Open Voice as an input method or SDK +- `docs/integrating.md` — embed OpenVoice as an input method or SDK - `docs/subsystems/` — one doc per subsystem - `docs/code-standards.md` — code standards diff --git a/README.zh-CN.md b/README.zh-CN.md index f622d9c..d574f0f 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -1,8 +1,8 @@ -# Open Voice +# OpenVoice Agent 原生语音个人助手,Powered by vLLM-Omni。 -语音是原生交互方式,不是聊天机器人的外壳:Open Voice 听得懂、能行动——跑持久任务、跨模型路由、跨设备接力,而语音偏好与知识库留在本地。 +语音是原生交互方式,不是聊天机器人的外壳:OpenVoice 听得懂、能行动——跑持久任务、跨模型路由、跨设备接力,而语音偏好与知识库留在本地。 Local First:语音偏好与知识库存在本地,不上传云端; 云端大模型按阶段可选接入,由用户自行权衡隐私与效果。 @@ -19,8 +19,9 @@ ASR + 实时翻译。情感化 TTS 与全双工打断插话在后续阶段加入 ## 文档 +- `docs/product-definition.zh-CN.md` — 产品定义、目标人群、整体架构与开发路标(English: `docs/product-definition.md`) - `docs/reference.md` — 配置 / CLI / API 参考 -- `docs/integrating.md` — 作为输入法或 SDK 接入 Open Voice +- `docs/integrating.md` — 作为输入法或 SDK 接入 OpenVoice - `docs/subsystems/` — 每个子系统一篇文档 - `docs/code-standards.md` — 代码规范 diff --git a/docs/architecture.svg b/docs/architecture.svg new file mode 100644 index 0000000..3b67b00 --- /dev/null +++ b/docs/architecture.svg @@ -0,0 +1,66 @@ + +OpenVoice Layered Architecture +Five layers: interaction, orchestration, models, inference runtime and local data. The model layer (audio front-end, ASR, LLM, TTS, Embedding) is the capability core; inference runs locally on vLLM-Omni by default, with cloud models optional under user consent. + + + +OpenVoice Layered Architecture +Model (swappable) +Control logic +Cloud (optional) + + + +InteractionDesktop · Mobile +Hotkey & OverlayPush-to-talk · live draft +Review PanelSource ↔ translation +Insert into AppConfirm, insert once +Meeting & BriefingMinutes · schedules +Mobile (M4)Cross-device handoff + + + +OrchestrationLocal, resident +Duplex Session ControllerState machine · barge-in · resume +Task OrchestratorDictate · translate · meet · brief · Q&A +Model RouterLocal first · consent · timeout fallback + + + +ModelsCapability coreLocal or cloudAll swappable +Voice in → hear → understand → think → speak → voice out; Embedding gives the LLM personal memory + +Audio Front-endHEAREcho cancel · denoiseVAD onset / endpointaudio → clean audio + +ASRUNDERSTANDStreaming draft → finalHotwords · punctuationaudio → text + +LLMTHINKTranslate · polishSummarize · Q&Atext → text + +TTSSPEAKEmotive · own voiceStreaming synthesistext → speech + +EmbeddingREMEMBERIndex knowledge baseRetrieve contexttext → vector + +Retrieved context → LLM + + + +InferenceRuntimeDriven by router +vLLM-Omni Local Inference (default)ASR · LLM · TTS · Embedding served together · streaming I/O · omni-modal scheduling +Cloud Model APIs (optional)Per-stage consent · location shown + + + +Local DataStays on device +Personal LexiconHotwords · glossary +Voice ProfileAccent · voice · speed +Knowledge BaseNotes · docs · vectors +Session StatePosition · history +CredentialsOS credential store + diff --git a/docs/architecture.zh-CN.svg b/docs/architecture.zh-CN.svg new file mode 100644 index 0000000..3ad0c42 --- /dev/null +++ b/docs/architecture.zh-CN.svg @@ -0,0 +1,66 @@ + +OpenVoice 分层架构 +五层架构:交互层、编排层、模型层、推理运行时、本地数据层。模型层包含音频前端模型、ASR、LLM、TTS 与 Embedding,是产品能力核心;推理默认在本地,云端模型经授权可选。 + + + +OpenVoice 分层架构 +模型(可替换) +控制逻辑 +云端可选 + + + +交互层桌面 · 移动 +快捷键与浮窗按住说话 · 实时草稿 +校对面板原文 / 译文对照 +目标应用写入确认后一次上屏 +会议与播报界面纪要 · 定时播报 +移动端(M4)跨端接力收听 + + + +编排层本地常驻 +全双工会话控制器状态机 · 起声暂停 · 插话判定 · 恢复 +任务编排听写 · 翻译 · 会议 · 播报 · 问答 +模型路由本地优先 · 授权检查 · 超时降级 + + + +模型层产品能力核心本地 / 云端均可替换 +语音进 → 听清 → 听懂 → 思考 → 表达 → 语音出;Embedding 为 LLM 提供个人记忆 + +音频前端听清回声消除 · 降噪VAD 起声 / 端点音频 → 净化音频 + +ASR 语音识别听懂流式草稿 → 定稿热词 · 标点音频 → 文字 + +LLM 大语言模型思考翻译 · 纠错润色会议摘要 · 问答文字 → 文字 + +TTS 语音合成表达情感语气 · 个人音色流式分段合成文字 → 声音 + +Embedding记忆知识库向量化相关片段检索文字 → 向量 + +检索上下文注入 LLM + + + +推理运行时由模型路由调度 +vLLM-Omni 本地推理引擎(默认)ASR · LLM · TTS · Embedding 统一服务化 · 流式输入输出 · 全模态调度 +云端模型 API(可选)用户逐项授权 · 界面标明处理位置 + + + +本地数据层不出本机 +个人词库热词 · 术语表 +语音偏好口音适配 · 音色 · 语速 +本地知识库纪要 · 文档 · 向量索引 +会话与进度播放位置 · 历史 +凭据存于系统凭据库 + diff --git a/docs/full-duplex-sequence.svg b/docs/full-duplex-sequence.svg new file mode 100644 index 0000000..2020180 --- /dev/null +++ b/docs/full-duplex-sequence.svg @@ -0,0 +1,52 @@ + +Full-Duplex Barge-in Sequence +Pause on detected speech. Seek directly for playback commands, use the LLM for questions, and resume on false triggers. + + + + + + + +Full-Duplex Barge-in: stop first, understand next, then respond + + +User +Front-end · VAD +ASR +Session Controller +LLM +TTS · Playback + + + +① Reading paragraph 3 (playback also goes to the front-end as echo reference) +② User starts speaking (t0) +③ VAD detects speech +④ Pause now, save position §3 · 12.4 s +M4 candidate: speech onset to audible stop, P95 ≤ 300 ms +⑤ Echo-free audio +⑥ Draft → final +⑦ Real barge-in or false trigger? + + + +alt +[Real barge-in: a command or question] +⑧ Cancel old generation +Clear queued audio +Playback commandPrevious paragraph: seek and replay + +Content questionQuestion + passage +Stream answer to TTS + +[False trigger: cough, residual echo, background speech] +Resume from §3 · 12.4 s +False-stop and miss rates measured separately on speakers and headphones + diff --git a/docs/full-duplex-sequence.zh-CN.svg b/docs/full-duplex-sequence.zh-CN.svg new file mode 100644 index 0000000..7cd6d20 --- /dev/null +++ b/docs/full-duplex-sequence.zh-CN.svg @@ -0,0 +1,52 @@ + +全双工插话时序 +起声后暂停,播放控制直接定位,内容提问经 LLM 回答,误触发恢复。 + + + + + + + +全双工插话时序:先停声,再理解,最后回应 + + +用户 +音频前端 · VAD +ASR +会话控制器 +LLM +TTS · 播放 + + + +① 正在播报第 3 段(播放音频同时作为参考信号送往音频前端) +② 用户实际开口(t0) +③ VAD 检出起声 +④ 立即暂停,记录位置 §3 · 12.4 s +M4 候选:实际起声到实际停声 P95 ≤ 300 ms +⑤ 去回声音频 +⑥ 草稿 → 定稿 +⑦ 判定:有效插话还是误触发? + + + +alt +[有效插话:指令或提问] +⑧ 取消旧生成 +清空待播音频 +播放控制上一段:直接定位并重播 + +内容问答问题与段落上下文 +分句合成并播放回答 + +[误触发:咳嗽、残留回声、旁人说话] +从 §3 · 12.4 s 恢复播放 +误停率与漏检率在外放、耳机两种条件下分别评测 + diff --git a/docs/integrating.md b/docs/integrating.md index 45c1f46..27cc4cc 100644 --- a/docs/integrating.md +++ b/docs/integrating.md @@ -1,5 +1,5 @@ -# Integrating Open Voice +# Integrating OpenVoice 状态:待编写(TBD)。 -如何接入 Open Voice:作为 PC 端语音输入法、SDK 或服务调用;配置与鉴权方式。 +如何接入 OpenVoice:作为 PC 端语音输入法、SDK 或服务调用;配置与鉴权方式。 diff --git a/docs/model-pipeline.svg b/docs/model-pipeline.svg new file mode 100644 index 0000000..1c29184 --- /dev/null +++ b/docs/model-pipeline.svg @@ -0,0 +1,28 @@ + +Model pipelines for speech and contentSpeech tasks share ASR. Scheduled reading starts from text. + + + +Model pipelines for speech and content + +Speech input Microphone → audio front-end → streaming ASR +Drafts drive live feedback. Stable segments carry a source revision and meeting transcripts retain timestamps. + + +M1 Dictation +Review source → confirm once → insert into the target app + +M1 Translation +LLM translates stable segments → review alongside source → confirm insertion + +M2 Meetings +LLM drafts cited minutes → user approves → Host saves → optional local embedding index + +M4 Barge-in +Playback command → player control. Open question → LLM answer → TTS + +Content input M3 scheduled job → authorized text +Read the source or request a summary → synthesize by paragraph → play and track position. The mic can stay off. +Private terminology and retrieved passages stay local. Cloud translation receives only selected text and target language. +M4 candidate target: actual speech onset → audible stop, P95 ≤ 300 ms. Measure VAD detection latency separately. + diff --git a/docs/model-pipeline.zh-CN.svg b/docs/model-pipeline.zh-CN.svg new file mode 100644 index 0000000..55ab998 --- /dev/null +++ b/docs/model-pipeline.zh-CN.svg @@ -0,0 +1,28 @@ + +模型流程 · 语音与内容分别进入语音经 ASR 分流。定时播报直接读取文本。 + + + +模型流程 · 语音与内容分别进入 + +语音入口 麦克风 → 音频前端 → 流式 ASR +草稿用于实时反馈;稳定分句带原文版本,会议转写同时保留时间点。 + + +M1 听写 +校对原文 → 确认一次 → 写入目标应用 + +M1 翻译 +LLM 翻译稳定分句 → 原译文对照 → 确认写入 + +M2 会议 +LLM 草拟带出处的纪要 → 用户确认 → Host 保存 → 可选本地向量索引 + +M4 插话 +播放指令直接执行;开放式提问 → LLM 回答 → TTS + +内容入口 M3 定时任务 → 获准读取的文本 +直接读取原文或按需生成摘要 → 分段 TTS → 播放并保存位置。麦克风可以保持关闭。 +私人术语和知识片段仅用于本地推理。云翻译只接收选定原文和目标语言。 +M4 候选目标:用户实际起声 → 实际停声,P95 ≤ 300 ms;VAD 检测耗时单独测量。 + diff --git a/docs/product-definition.md b/docs/product-definition.md new file mode 100644 index 0000000..eeb4673 --- /dev/null +++ b/docs/product-definition.md @@ -0,0 +1,177 @@ +# OpenVoice Product Definition & Architecture + +**English** · [简体中文](product-definition.zh-CN.md) + +| Item | Description | +| --- | --- | +| Product | OpenVoice | +| Positioning | Agent-native voice personal agent: an open-source, local-first, full-duplex “voice sprite” | +| Foundation | **Powered by vLLM-Omni** | +| Phase 1 scope (M1) | Desktop dictation + real-time translation (multilingual; Chinese → English is the primary evaluated direction) | + +--- + +## 1. Product Definition + +### 1.1 Positioning + +OpenVoice aims to be an agent-native voice personal agent: open-source, local-first and full-duplex. The first release (M1, i.e. Phase 1) focuses on desktop dictation and real-time translation, with Chinese → English as the primary direction. Users hold a hotkey, speak, review the text in an overlay, and insert the original or translation into a supported app. + +Later releases will add meeting minutes, long-form reading and full-duplex interaction. In full duplex, the assistant keeps listening during playback so users can rewind, ask a question and resume where they left off. + +### 1.2 Vision + +> A voice sprite that lives on your device: it knows your accent and your terminology, remembers your knowledge, and lets you decide whether a cloud service may receive your audio. Speak and it writes; ask and it answers; interrupt and it stops. + +### 1.3 Capability Map + +| Capability | User value | Main models | Phase | +| --- | --- | --- | --- | +| Voice input | Dictate into supported text fields instead of typing | ASR (+ optional LLM clean-up) | **M1** | +| Real-time translation | Speak Chinese, get English ready to send | ASR + LLM | **M1** | +| Meeting summaries | Live transcription with topics, decisions and action items | ASR + LLM (optional indexing after save) | M2 | +| Expressive reading & scheduled briefings | News, papers, email and books read in a fitting tone | LLM + TTS | M3 | +| Full-duplex barge-in | Say “stop”, “go back” or “what does that mean?” mid-playback | VAD/AEC + ASR + LLM + TTS | M4 | +| Cross-device handoff | Continue long content seamlessly from desktop to phone | — (protocol & clients) | M4 | + +### 1.4 Product Principles + +1. **Local first**: everything runs on the device by default. Personal lexicon, voice profile and knowledge base never leave it. +2. **Cloud is optional, the user decides**: when local models hit their limits, users can authorize cloud models one stage at a time, and the UI always shows where processing happens. +3. **Swappable models**: ASR, LLM, TTS and other models plug in through one interface — open-source models, cloud APIs and closed-source models alike. +4. **Stop first, understand later**: on barge-in the assistant goes silent immediately, without waiting for any model to understand what was said. +5. **Verifiable results**: translations sit next to the source, meeting items link back to the original speech, and nothing is inserted or saved until the user confirms. + +### 1.5 What Sets OpenVoice Apart + +| Dimension | Typical cloud voice input / assistants | OpenVoice | +| --- | --- | --- | +| Where data goes | Audio uploaded to the cloud by default | Stays on device; cloud use needs per-stage consent | +| Personalization | Generic, account-level models | Local lexicon, accent profile and knowledge base that grow over time | +| Interaction | Turn-based; playback can't be interrupted | Planned for M4: listens while speaking; interrupt, rewind, ask | +| Openness | Closed source, fixed models | Open source; models and deployment freely combined | +| Offline | Stops working without a network | Dictation and translation work offline once models are downloaded | + +--- + +## 2. Target Users + +| Group | Typical scenarios | Core pain point | What “good” looks like | First covered | +| --- | --- | --- | --- | --- | +| **PC users who'd rather not type** | Dictating chats, email, notes and documents | Typing is slow; privacy concerns with cloud input methods | Accurate recognition and names, text lands at the cursor, easy to fix | M1 | +| **Cross-language professionals** | Multinational teams; sending English messages in cross-border meetings | Hard to turn speech into polished written English quickly | Numbers, dates, negations and names are right and can be checked against the source | M1 | +| **Meeting note-takers** | Recording and organizing internal and cross-border meetings | Can't keep up while listening; write-ups take too long | Keeps pace, every item traces back to what was said, no invented owners | M2 | +| **Long-form listeners** | News, papers and books while commuting or doing chores | Little reading time; robotic narration that can't be interrupted | Natural tone, interruptible, replayable, progress never lost | M3–M4 | + +**Primary Phase 1 users**: the first two groups — knowledge workers who write a lot every day and often need Chinese-to-English translation. + +--- + +## 3. Standard Usage Scenarios + +### Scenario A · Dictate into a supported app (M1) + +1. Put the cursor in an agent chat box, email or document, **hold the hotkey** and speak; +2. An overlay shows the live draft; **release the hotkey** and it is segmented and punctuated automatically; +3. Fix any errors in the overlay, then **confirm to insert it once** at the cursor; press Esc to discard. + +> Design note: the draft only updates inside the overlay, so the target app never receives duplicate text. If focus changes while recording, the result stays in the overlay with a copy button and is never typed into another window. + +### Scenario B · Speak Chinese, send written English in a meeting (M1) + +1. Choose “Chinese → English” and say: “交付改到周五,预算仍然是十五万”; +2. The overlay shows the source on top and the translation below: *“Delivery is moved to Friday; the budget remains 150,000.”*; +3. The user corrects “十五万” (150,000) to “五十万” (500,000) in the source, and the translation is regenerated from the new version; +4. After checking, the user confirms and the English is inserted into the meeting chat. If translation fails, the source can still be copied. + +### Scenario C · Turn a discussion into minutes (M2) + +1. With participants' consent, the host starts meeting mode and picks the audio source and languages; +2. The system transcribes continuously with bilingual captions, and the topic list updates as the discussion moves on; +3. When the meeting ends it outputs **topics / decisions / action items / owners / due dates**, each linked to the original speech; +4. Example rules: “Let's revisit the budget on Friday” is recorded as an open item; only explicit agreement counts as a decision; owners are left blank unless clearly named; +5. After review, the minutes are saved to the local knowledge base. + +### Scenario D · Scheduled briefings you can interrupt (M3–M4) + +1. Schedule an 8:00 briefing from authorized news feeds, paper subscriptions or email digests; +2. The assistant adjusts pace, pauses and tone for headlines, body text and quotes; +3. Say “**go back**” and it stops immediately and rereads the previous paragraph from the start; +4. Ask “**what does that acronym mean?**” and it pauses, answers, then resumes from where it stopped. + +### Scenario E · Hand off from desktop to phone (M4) + +1. Before heading out, click “**Continue on phone**”; +2. The desktop sends the content ID, version and paragraph position to a paired phone on the same LAN; +3. Once the phone is ready it takes over playback and the desktop stops; if the connection fails, the desktop keeps playing so listening is never interrupted. + +--- + +## 4. Architecture + +### 4.1 Runtime Boundaries and Ownership + +![Runtime boundaries for the desktop client, Personal Host, local inference and optional cloud providers](architecture.svg) + +| Runtime | Responsibilities and state | +| --- | --- | +| Desktop client | Owns microphone access, hotkeys, the overlay and app insertion. The audio front-end runs here. In M4 it uses actual playback audio as the echo reference and pauses local playback on speech detection. | +| Personal Host (on device) | Owns sessions and turns, persists jobs and playback positions, and recovers scheduled work after restart. The device registry checks pairing, permissions and revocation before handoff. The router checks task data, stage consent and provider before assembling a request. Storage saves approved minutes locally. Keys live in the OS credential store. | +| Local inference service | Model workers provide ASR and LLM inference, with TTS and embeddings in later phases. vLLM-Omni is the default runtime. Device compatibility, streaming support and resource use need validation for each candidate. | + +See the [subsystem map](subsystems/README.md) for ownership. + +### 4.2 Model Roles: Hear → Understand → Think → Speak → Remember + +| Model | Role | Input → output | What it does in the product | Local candidates | Local execution location | Key metrics | +| --- | --- | --- | --- | --- | --- | --- | +| **Audio front-end** (AEC / denoise / VAD) | Hear | Raw audio → clean audio + speech-onset events | Removes the assistant's own playback echo and detects when the user starts talking; **the trigger for full duplex** | WebRTC AEC3, Silero VAD, FSMN-VAD | Client | Barge-in detection rate, echo false triggers, detection latency | +| **ASR** speech recognition | Understand | Audio stream → draft / final text | All of dictation; sets input quality for translation, meetings and Q&A | SenseVoice, streaming Paraformer, Whisper turbo | Local inference service | Character error rate, first-token latency, name recall | +| **LLM** large language model | Think | Text + context → text | Translation, spoken-to-written, correction, meeting summaries, Q&A, briefing scripts | Qwen family 4B–8B quantized; cloud LLMs optional | Local inference service | Usable-translation rate, factual consistency, first-token latency | +| **TTS** speech synthesis | Speak | Text + tone → audio stream | Expressive reading and spoken answers, with a personal voice | CosyVoice, Kokoro, etc. | Local inference service | Naturalness, misreading rate, first-packet latency | +| **Embedding** | Remember | Text → vector | Indexes and retrieves the local knowledge base to give the LLM personal context | bge-m3, etc. | Local inference service | Retrieval recall | + +> Candidates are evaluated in their delivery phase, starting with ASR and translation; models already supported by vLLM-Omni come first. Before locking in, check each model's license allows open-source distribution and commercial use. + +**How personalization reaches the models**: the personal lexicon serves as both ASR hotwords and the LLM glossary; the voice profile drives ASR accent adaptation and the TTS voice; the knowledge base is retrieved through Embedding and passed to the LLM as context. All three stay on the device, and tasks that touch private knowledge are forced onto local inference. + +### 4.3 Speech and Content Pipelines + +![Speech tasks start with ASR. Scheduled reading starts with authorized text.](model-pipeline.svg) + +| Task | Processing path | +| --- | --- | +| Dictation (M1) | The hotkey starts capture. ASR updates the live draft. The user reviews the final text and confirms insertion. Light LLM editing is optional. | +| Translation (M1) | The LLM translates stable ASR segments. Each translation carries its source revision. Editing the source triggers translation again and invalidates stale replies. | +| Meetings (M2) | ASR retains timestamps. The LLM drafts minutes linked to the transcript. After review, the Host saves approved items and can index them locally with an embedding model. Discarded drafts stay out of the knowledge base. | +| Scheduled reading (M3) | A Host job reads authorized content and optionally requests a summary. TTS renders the selected text by paragraph. The client plays it and tracks position. The microphone can remain off throughout. | +| Barge-in (M4) | With barge-in enabled, capture and playback run together. Playback commands control the player directly. Spoken questions use ASR, the LLM and TTS to produce an answer. | + +### 4.4 Full-Duplex Barge-in: Stop First, Understand Next, Then Respond + +![Playback pauses on detected speech, with separate paths for commands, questions and false triggers](full-duplex-sequence.svg) + +During playback, the client pauses on detected speech and records the paragraph and offset. Once ASR returns text, the Host resolves the turn: + +- **Playback control.** “Previous paragraph” seeks directly to the saved paragraph boundary and replays it. A valid command invalidates the previous turn and clears stale queued audio. +- **Content question.** Cancel generation and synthesis for the previous turn. Send the question and permitted passage context to the LLM. TTS speaks the first stable sentence. Playback can resume at the saved position after the answer. +- **False trigger.** Keep the original turn and resume from the paused position. + +Text and audio chunks carry session and turn IDs. The client discards late output from cancelled turns. The **M4 candidate target is P95 ≤ 300 ms from actual user speech onset to audible playback stopping**. Measure onset-to-VAD-event latency separately, and measure false stops and misses on speakers and headphones. + +### 4.5 Deployment Modes & Privacy Boundary + +All inference runs locally by default. Before assembling an outbound request, the Host checks task dependencies. Processing that needs a private glossary, voice preferences or retrieved knowledge stays local. Other calls require consent for the specific stage and provider. The UI shows where processing takes place. + +| Authorized stage | Data the provider may receive | On revocation or failure | +| --- | --- | --- | +| Cloud ASR | Only the selected audio for this task. Translation follows its own authorization. | Stop subsequent audio transfers on revocation. Local recognition remains an option. | +| Cloud translation | Only the selected source text and target language. The translation request excludes audio, private glossaries and retrieved passages. | Keep the editable source. Retry or switch to local translation. Stop subsequent text transfers on revocation. | + +When both stages have consent, each sends only its listed payload. Either stage can use its local model independently. Offline use requires the corresponding models to be installed. + +## 5. Roadmap + +**M1 ships first**, with desktop dictation and Chinese-to-English translation. Later releases will add meeting transcription and structured minutes (M2), expressive reading and scheduled briefings (M3), then full-duplex barge-in and cross-device handoff (M4). + +Milestones map to the phase names used elsewhere in the repo: **M1 = Phase 1 (首期)**; M2–M4 are the later phases (后期). diff --git a/docs/product-definition.zh-CN.md b/docs/product-definition.zh-CN.md new file mode 100644 index 0000000..8d7cc61 --- /dev/null +++ b/docs/product-definition.zh-CN.md @@ -0,0 +1,177 @@ +# OpenVoice 产品定义与架构规划 + +[English](product-definition.md) · **简体中文** + +| 项目 | 内容 | +| --- | --- | +| 产品名称 | OpenVoice | +| 产品定位 | Agent 原生语音个人助手:开源、本地优先、全双工的“声音精灵” | +| 技术底座 | **Powered by vLLM-Omni** | +| 首期范围(M1) | 桌面端语音听写 + 实时翻译(面向多语言交流,中译英为首要评测方向) | + +--- + +## 1. 产品定义 + +### 1.1 定位 + +OpenVoice 的目标是一款 Agent 原生的语音个人助手:开源、本地优先、支持全双工。首个版本(M1,即首期 / Phase 1)聚焦桌面听写与实时翻译,以中译英为首要方向。用户按住快捷键口述,在浮窗里核对文字,再将原文或译文写入支持的应用。 + +后续版本将支持会议纪要、长文朗读和全双工插话。全双工意味着助手在说话时仍能听见用户,用户可以要求回退、提问,再从原来的位置继续听。 + +### 1.2 产品愿景 + +> 一个住在你设备里的声音精灵:懂你的口音和术语,记得你的知识,由你决定声音能否发给云服务;你说它就写,你问它就答,你打断它就停。 + +### 1.3 核心能力全景 + +| 能力 | 用户价值 | 主要依赖模型 | 交付阶段 | +| --- | --- | --- | --- | +| 语音输入法 | 不打字,在支持的输入框里口述成文 | ASR(+ 可选 LLM 纠错) | **M1** | +| 实时翻译 | 说中文,得到可直接发送的书面英文 | ASR + LLM | **M1** | +| 会议总结 | 实时转写,自动生成议题、决定、行动项 | ASR + LLM(保存后可选向量索引) | M2 | +| 情感化朗读与定时播报 | 用合适的语气读新闻、论文、邮件、长书 | LLM + TTS | M3 | +| 全双工打断与插话 | 播报中随时说“停”“上一段”“这是什么意思” | VAD/AEC + ASR + LLM + TTS | M4 | +| 跨设备接力 | 从桌面到手机无缝续听长内容 | —(协议与客户端) | M4 | + +### 1.4 产品原则 + +1. **本地优先(Local First)**:默认全部在本机处理。个人词库、语音偏好和知识库永远不出设备。 +2. **云端可选、用户做主**:本地模型能力有上限时,用户可以逐项授权云端模型,界面始终标明实际在哪里处理。 +3. **模型可替换**:ASR、LLM、TTS 等模型通过统一接口接入,开源模型、云 API 和闭源模型都可以插拔。 +4. **先停声、再理解**:插话时助手立即停止发声,不需要等模型理解完用户的话。 +5. **结果可核对**:译文对照原文显示,纪要条目关联原话时间点,用户确认后才写入或保存。 + +### 1.5 差异化 + +| 维度 | 常见云端语音输入/助手 | OpenVoice | +| --- | --- | --- | +| 数据去向 | 音频默认上传云端 | 默认不出本机,上云需逐项授权 | +| 个性化 | 账号级通用模型 | 本地个人词库、口音偏好和知识库持续积累 | +| 交互方式 | 一问一答,播报时无法打断 | M4 规划:边说边听,可打断、回退、插问 | +| 开放性 | 闭源,模型固定 | 开源,模型和部署方式可自由组合 | +| 离线可用 | 断网即不可用 | 模型下载后,听写和翻译可离线完成 | + +--- + +## 2. 目标人群 + +| 人群 | 典型场景 | 核心痛点 | 判断“好用”的标准 | 首次覆盖 | +| --- | --- | --- | --- | --- | +| **不愿打字的 PC 用户** | 聊天、邮件、笔记、文档里口述 | 打字慢,云输入法有隐私顾虑 | 识别准、专名对,文字落在光标处,改错方便 | M1 | +| **跨语言工作的职场人** | 外企沟通、跨国会议中发英文消息 | 口语难以快速转成得体的书面外语 | 数字、日期、否定和专名准确,可对照原文核对 | M1 | +| **会议记录者** | 内部会议、跨国会议的记录与整理 | 边听边记跟不上,会后整理耗时 | 跟得上发言,条目能回溯原话,不编造责任人 | M2 | +| **长内容听众** | 通勤、家务时听资讯、论文、长书 | 阅读时间少,朗读机械、不可打断 | 语气自然,可打断、重听,进度不丢 | M3–M4 | + +**首期主力用户**:前两类人群,即每天需要大量输入文字、经常需要中译英的知识工作者。 + +--- + +## 3. 标准使用方案 + +### 场景 A · 在支持的应用中听写(M1) + +1. 将光标放在智能体对话框、邮件、文档的输入框中,**按住快捷键**说话; +2. 浮窗实时显示草稿,**松开快捷键**后自动断句、加标点; +3. 在浮窗里修改错字,**确认后一次性写入**光标处;按 Esc 取消整段。 + +> 设计要点:草稿只在浮窗中更新,避免目标应用收到重复文字。录音期间如果焦点切换,结果保留在浮窗并提供复制,不会写进其他窗口。 + +### 场景 B · 会议中口述生成书面英文(M1) + +1. 选择“中文 → 英文”,口述:“交付改到周五,预算仍然是十五万”; +2. 浮窗上方显示原文,下方显示译文 *“Delivery is moved to Friday; the budget remains 150,000.”*; +3. 用户把原文中的“十五万”改为“五十万”,译文随之按新版本重新生成; +4. 核对后确认,将英文写入会议聊天框。翻译失败时仍可复制原文。 + +### 场景 C · 从会议讨论生成纪要(M2) + +1. 主持人在取得参会者同意后开启会议模式,选择音频来源和语言; +2. 系统持续转写并显示双语字幕,议题列表随讨论滚动更新; +3. 会议结束后输出 **议题 / 决定 / 行动项 / 负责人 / 期限**,每一条都能跳转到原话; +4. 规则示例:“周五再讨论预算”记为待讨论;只有明确达成一致时才记为“决定”;没有明确负责人时该项留空。 +5. 复核后保存到本地知识库。 + +### 场景 D · 定时播报并随时打断(M3–M4) + +1. 设置每天 8:00 播报已授权的新闻源、论文订阅或邮件摘要; +2. 助手按标题、正文、引文分别调整语速、停顿和语气朗读; +3. 用户说“**上一段**”,助手立即停止,从上一段开头重读; +4. 用户问“**这个缩写什么意思**”,助手暂停播报回答问题,答完从刚才的位置继续读。 + +### 场景 E · 桌面到手机接力(M4) + +1. 起身出门前点击“**在手机继续**”; +2. 桌面把内容标识、版本和段落位置发给同一局域网内已配对的手机; +3. 手机准备就绪后接管播放,桌面随即停止;如果连接失败,桌面继续播放,不会中断收听。 + +--- + +## 4. 整体架构 + +### 4.1 运行边界与职责 + +![桌面客户端、本机 Personal Host、本地推理服务与可选云服务的运行边界](architecture.zh-CN.svg) + +| 运行位置 | 职责与状态归属 | +| --- | --- | +| 桌面客户端 | 管理麦克风、快捷键、浮窗和目标应用写入。音频前端在客户端运行;M4 播放期间以实际送播音频为回声参考,在检测到起声时立即暂停本地播放。 | +| Personal Host(本机) | 持有会话与轮次,持久化任务和播放进度,重启后恢复定时任务。设备注册表校验接力设备的配对、授权与吊销状态。模型路由在请求组装前检查任务数据、阶段授权和供应商。已确认的纪要由存储模块写入本地知识库,凭据保存在系统凭据库。 | +| 本地推理服务 | 通过模型 worker 提供 ASR、LLM,以及后续阶段的 TTS、Embedding。默认推理底座为 vLLM-Omni,具体模型的设备兼容性、流式模式与资源需求须逐项验证。 | + +子系统及职责见[架构索引](subsystems/README.md)。 + +### 4.2 模型职责:听清 → 听懂 → 思考 → 表达 → 记忆 + +| 模型 | 比喻 | 输入 → 输出 | 在产品中的作用 | 本地候选 | 本地执行位置 | 关键指标 | +| --- | --- | --- | --- | --- | --- | --- | +| **音频前端**(AEC / 降噪 / VAD) | 听清 | 原始音频 → 净化音频 + 起声事件 | 去除自身播放的回声,检测用户开口;**全双工的触发器** | WebRTC AEC3、Silero VAD、FSMN-VAD | 客户端 | 插话检出率、回声误触发率、检测延迟 | +| **ASR** 语音识别 | 听懂 | 音频流 → 草稿 / 定稿文本 | 听写的全部能力;翻译、会议、问答的输入质量 | SenseVoice、Paraformer 流式、Whisper turbo | 本地推理服务 | 字错率、首字延迟、专名召回 | +| **LLM** 大语言模型 | 思考 | 文本 + 上下文 → 文本 | 翻译、口语转书面、纠错、会议摘要、问答、播报稿改写 | Qwen 系列 4B–8B 量化版本;可接云端大模型 | 本地推理服务 | 译文可用率、事实一致性、首 token 延迟 | +| **TTS** 语音合成 | 表达 | 文本 + 语气 → 音频流 | 情感化朗读和回答播报,支持个人音色 | CosyVoice、Kokoro 等 | 本地推理服务 | 自然度、错读率、首包延迟 | +| **Embedding** 向量模型 | 记忆 | 文本 → 向量 | 本地知识库入库与检索,为 LLM 提供个人上下文 | bge-m3 等 | 本地推理服务 | 检索召回率 | + +> 候选按交付阶段评测,首期聚焦 ASR 与翻译,不代表最终选型;优先选用 vLLM-Omni 已支持的模型。锁定前须逐一核对模型许可证是否允许开源分发和商用。 + +**个人化如何作用于模型**:个人词库同时作为 ASR 热词和 LLM 术语表;语音偏好用于 ASR 口音适配和 TTS 音色;知识库经 Embedding 检索后作为 LLM 的上下文。这三类数据都只在本地使用,涉及私有知识的任务强制使用本地推理。 + +### 4.3 语音和内容的处理流程 + +![语音任务经 ASR 分流,定时播报从授权文本进入 TTS](model-pipeline.zh-CN.svg) + +| 任务 | 处理路径 | +| --- | --- | +| 听写(M1) | 快捷键启动采集,ASR 草稿随说话更新,用户校对定稿并确认写入。可选择轻度 LLM 纠错。 | +| 翻译(M1) | LLM 翻译 ASR 的稳定分句。每条译文绑定原文版本,用户修改原文后重新翻译,丢弃过期结果。 | +| 会议(M2) | ASR 保留发言时间点,LLM 根据原文提取带出处的纪要草稿。用户复核后,Host 保存确认的条目,并可按需调用 Embedding 建立本地索引。丢弃的草稿不进入知识库。 | +| 定时播报(M3) | Host 的定时任务读取已授权内容,按需生成摘要或直接分段朗读。TTS 将文本转换成音频,客户端播放并记录位置。全程可以关闭麦克风。 | +| 播报中插话(M4) | 用户启用语音打断后,采集与播放并行。回退等指令直接控制播放器,开放式提问经 ASR、LLM 和 TTS 生成语音回答。 | + +### 4.4 全双工插话时序:先停声,再理解,最后回应 + +![起声暂停后分为播放控制、内容问答和误触发恢复](full-duplex-sequence.zh-CN.svg) + +播放期间,客户端检测到起声后先暂停并记录段落与偏移。ASR 返回识别结果,Host 再决定如何处理本轮: + +- **播放控制**:“上一段”直接定位到上一段起点并重播。有效指令使旧轮次失效,清除过期的待播音频。 +- **内容问答**:取消旧轮次的生成与合成,用问题和允许使用的段落上下文请求 LLM,TTS 从首个稳定句开始播报。回答结束后可回到保存的位置。 +- **误触发**:保留原轮次,从暂停位置恢复播放。 + +文本与音频块均携带会话 ID 和轮次号。客户端丢弃已取消轮次的迟到结果。M4 的候选目标为**从用户实际起声到扬声器实际停声,P95 ≤ 300 ms**。另测起声到 VAD 事件的检测耗时,并分别在外放和耳机条件下统计误停与漏检。 + +### 4.5 部署模式与隐私边界 + +默认在本机完成所有推理。Host 在组装外发请求前检查任务依赖;凡需私人术语表、语音偏好或知识库片段的处理均留在本机。其余任务按阶段和指定供应商单独授权,界面显示实际处理位置。 + +| 授权阶段 | 允许发给该供应商的数据 | 关闭授权或服务失败时 | +| --- | --- | --- | +| 云 ASR | 仅本次任务选定的音频。翻译阶段仍按自己的授权执行。 | 撤销后停止后续音频发送;可改用本地识别。 | +| 云翻译 | 仅用户选中的原文和目标语言。翻译请求不含音频、私人术语表或知识片段。 | 保留可校对的原文,可重试或切回本地;撤销后停止后续文本发送。 | + +两个阶段均获授权时,各自只发送表中列出的数据。任一阶段都可单独使用本地模型;离线使用前需准备好对应模型。 + +## 5. 开发路标 + +**M1 优先发布**,聚焦桌面听写与中译英。后续版本依次扩展会议转写与结构化纪要(M2)、情感化朗读与定时播报(M3),以及全双工插话与跨设备接力(M4)。 + +里程碑与仓库其他文档的阶段口径对应:**M1 = 首期(Phase 1)**,M2–M4 属于后期。 diff --git a/host/README.md b/host/README.md index d947646..aa06a62 100644 --- a/host/README.md +++ b/host/README.md @@ -1,6 +1,6 @@ # Host -Local Personal Host: the core of Open Voice. +Local Personal Host: the core of OpenVoice. - `sessions/` — voice sessions: capture / interrupt / return results - `jobs/` — durable jobs: queue / resume / cancel