qwen-audio-agent 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/README_ZH.md +6 -3
- package/cli/package.json +1 -1
- package/cli/src/config-command.mjs +33 -2
- package/cli/src/gateway-service.mjs +7 -1
- package/config/frontend-agent/LIVE_PROMPT.md +64 -0
- package/desktop/src/i18n.mjs +1 -1
- package/desktop/src/settings-config.mjs +10 -24
- package/docs/configuration/frontend.md +29 -12
- package/docs/configuration/frontend.zh.md +28 -12
- package/docs/contract.md +2 -0
- package/docs/contract.zh.md +2 -0
- package/docs/extensions.md +14 -0
- package/docs/extensions.zh.md +11 -0
- package/docs/getting-started/install.md +3 -0
- package/docs/getting-started/install.zh.md +3 -0
- package/docs/getting-started/mobile.md +8 -2
- package/docs/getting-started/mobile.zh.md +5 -0
- package/docs/guides/web-search.md +17 -1
- package/docs/guides/web-search.zh.md +15 -1
- package/docs/operations/troubleshooting.md +30 -0
- package/docs/operations/troubleshooting.zh.md +26 -0
- package/docs/voice-frontends/custom-provider.md +18 -3
- package/docs/voice-frontends/custom-provider.zh.md +18 -3
- package/docs/voice-frontends/google-live.md +7 -3
- package/docs/voice-frontends/google-live.zh.md +6 -3
- package/docs/voice-frontends/gpt-live-1.md +149 -0
- package/docs/voice-frontends/gpt-live-1.zh.md +114 -0
- package/docs/voice-frontends/{gpt-live.md → openai-realtime.md} +12 -5
- package/docs/voice-frontends/{gpt-live.zh.md → openai-realtime.zh.md} +11 -5
- package/docs/voice-frontends/qwen-audio-live.md +164 -0
- package/docs/voice-frontends/qwen-audio-live.zh.md +122 -0
- package/docs/voice-frontends/qwen-audio-realtime.md +2 -1
- package/docs/voice-frontends/qwen-audio-realtime.zh.md +2 -1
- package/docs/voice-frontends/qwen-omni-realtime.md +1 -1
- package/docs/voice-frontends/qwen-omni-realtime.zh.md +1 -1
- package/package.json +13 -4
- package/scripts/patch-build-node-gyp.mjs +63 -0
- package/scripts/prepare-build.mjs +2 -0
- package/scripts/verify-package.mjs +3 -0
- package/server/package.json +2 -2
- package/server/src/conversation/frontend-agent-context.mjs +18 -5
- package/server/src/core/citation.mjs +8 -2
- package/server/src/core/config.mjs +16 -5
- package/server/src/core/request-security.mjs +7 -1
- package/server/src/frontend/frontend-tools.mjs +14 -1
- package/server/src/frontend/retrieval/providers/bing.mjs +23 -12
- package/server/src/frontend/retrieval/providers/factory.mjs +9 -1
- package/server/src/frontend/retrieval/providers/mcp.mjs +17 -9
- package/server/src/frontend/retrieval/providers/so360.mjs +23 -12
- package/server/src/frontend/tools/agent-task-runtime.mjs +22 -4
- package/server/src/frontend/tools/tool-call-handler.mjs +56 -20
- package/server/src/memory/providers/markdown/context-store.mjs +3 -1
- package/server/src/orchestration/session-task-coordinator.mjs +4 -1
- package/server/src/orchestration/task-operations.mjs +5 -3
- package/server/src/orchestration/task-updates.mjs +2 -1
- package/server/src/transport/gateway-client-transport.mjs +19 -0
- package/server/src/transport/webrtc/protocol.mjs +1 -1
- package/server/src/voice/audio-stream-diagnostics.mjs +139 -0
- package/server/src/voice/native-delegation-runtime.mjs +360 -0
- package/server/src/voice/providers/dashscope-live.mjs +93 -0
- package/server/src/voice/providers/dashscope.mjs +12 -4
- package/server/src/voice/providers/doubao-seeduplex-protocol.mjs +54 -0
- package/server/src/voice/providers/doubao-seeduplex.mjs +6 -5
- package/server/src/voice/providers/ga-protocol.mjs +7 -2
- package/server/src/voice/providers/google-live-protocol.mjs +124 -34
- package/server/src/voice/providers/google-live.mjs +6 -5
- package/server/src/voice/providers/gpt-live-1-protocol.mjs +597 -0
- package/server/src/voice/providers/gpt-live-1.mjs +3 -0
- package/server/src/voice/providers/gpt-live-client-context.mjs +182 -0
- package/server/src/voice/providers/openai-live.mjs +150 -0
- package/server/src/voice/providers/{gpt-live.mjs → openai-realtime.mjs} +15 -14
- package/server/src/voice/providers/provider-registry.mjs +11 -1
- package/server/src/voice/providers/qwen-live-protocol.mjs +399 -0
- package/server/src/voice/providers/registry.mjs +45 -10
- package/server/src/voice/providers/runtime-configuration.mjs +17 -6
- package/server/src/voice/providers/stepfun.mjs +1 -1
- package/server/src/voice/realtime-input-runtime.mjs +56 -20
- package/server/src/voice/realtime-presentation-runtime.mjs +21 -4
- package/server/src/voice/realtime-provider-session.mjs +59 -14
- package/server/src/voice/realtime-provider.mjs +332 -36
- package/server/src/voice/realtime-session-runtime.mjs +207 -16
- package/server/src/voice/realtime-task-presentation.mjs +6 -2
- package/server/src/voice/realtime-turn-state.mjs +33 -2
- package/shared/gateway/client-sdk.mjs +15 -5
- package/shared/gateway/websocket-auth.mjs +2 -1
- package/shared/protocol/gateway-events.mjs +31 -0
- package/shared/realtime-legacy-environment.mjs +37 -8
- package/shared/realtime-model-catalog.mjs +12 -10
- package/shared/realtime-models/README.md +10 -2
- package/shared/realtime-models/dashscope.mjs +11 -0
- package/shared/realtime-models/{google-live.mjs → google.mjs} +1 -1
- package/shared/realtime-models/openai.mjs +24 -0
- package/shared/realtime-models/profile.mjs +6 -3
- package/shared/realtime-models/{doubao-seeduplex.mjs → volcengine.mjs} +1 -1
- package/shared/realtime-provider-catalog.mjs +7 -6
- package/shared/realtime-provider-definitions.mjs +87 -22
- package/shared/runtime-environment.mjs +2 -2
- package/shared/web-search-configuration.mjs +14 -2
- package/tui/package.json +2 -2
- package/tui/src/index.mjs +14 -9
- package/tui/src/runtime-configuration.mjs +2 -0
- package/tui/src/terminal-commands.mjs +40 -0
- package/tui/src/text-cli.mjs +10 -1
- package/web/dist/assets/index-Bc2Q04J9.css +1 -0
- package/web/dist/assets/index-bY4DFXKT.js +96 -0
- package/web/dist/index.html +2 -2
- package/shared/realtime-models/gpt-live.mjs +0 -10
- package/web/dist/assets/index-8erKDCr2.css +0 -1
- package/web/dist/assets/index-Cs4hYWbS.js +0 -96
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
以下是 **CLI / 源码** 的要求:Node.js ^22.22.2、^24.15.0 或 >=26.0.0,npm 10+。
|
|
27
27
|
源码仓库提供 `.nvmrc` 和 `.node-version`,使用 nvm 时可运行 `nvm use`。
|
|
28
28
|
|
|
29
|
+
Windows 使用 Node 24.x 时,请选择 24.16.0 或更新版本;24.15.0 存在
|
|
30
|
+
[已在 24.16.0 修复的 TCP 原生崩溃](https://github.com/nodejs/node/issues/63620)。
|
|
31
|
+
|
|
29
32
|
安装正式版:
|
|
30
33
|
|
|
31
34
|
```bash
|
|
@@ -67,8 +67,14 @@ npm run mobile:android
|
|
|
67
67
|
|
|
68
68
|
iOS requires full Xcode. Android requires JDK 21 and the Android SDK.
|
|
69
69
|
`mobile:sync` builds the local web assets before syncing the Capacitor projects.
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
Public Gateway endpoints must use HTTPS/WSS. Explicit LAN connection codes may
|
|
71
|
+
use a tokenized `ws://<LAN IPv4>` endpoint.
|
|
72
|
+
|
|
73
|
+
Bundled web assets use the fixed local origin `capacitor://qwaudio.local` on iOS
|
|
74
|
+
(`iosScheme: "capacitor"`) and `https://qwaudio.local` on Android. WKWebView cannot
|
|
75
|
+
register `https` as a custom scheme. The Gateway accepts these local origins only
|
|
76
|
+
for authenticated native devices; opaque `null` and other custom origins remain
|
|
77
|
+
rejected. This local asset scheme does not change the remote transport policy.
|
|
72
78
|
|
|
73
79
|
The GitHub `Mobile` workflow retains an Android debug APK and an iOS Simulator
|
|
74
80
|
App for testing without a local native toolchain. Installing on a physical iOS
|
|
@@ -60,5 +60,10 @@ iOS 构建需要完整 Xcode;Android 构建需要 JDK 21 和 Android SDK。`mo
|
|
|
60
60
|
本地 Web 资源,再同步到 Capacitor 原生工程。公网 Gateway 地址必须是 HTTPS;显式 LAN
|
|
61
61
|
连接允许使用带 Token 的 `ws://局域网IP`。
|
|
62
62
|
|
|
63
|
+
内置 Web 资源在 iOS 使用固定本地 Origin `capacitor://qwaudio.local`
|
|
64
|
+
(`iosScheme: "capacitor"`),Android 使用 `https://qwaudio.local`。WKWebView 无法将
|
|
65
|
+
`https` 注册为自定义 scheme。Gateway 只允许已认证原生设备使用这两个本地 Origin;
|
|
66
|
+
不接受不透明的 `null` 或其他自定义 Origin。本地资源 scheme 不改变远程连接的传输策略。
|
|
67
|
+
|
|
63
68
|
GitHub 的 `Mobile` 工作流会保存 Android debug APK 和 iOS Simulator App,便于在没有
|
|
64
69
|
本地原生工具链时下载验收。iOS 真机安装仍需要 Apple 开发签名。
|
|
@@ -35,6 +35,22 @@ snippets and links enter the voice model's context as sources. It always uses
|
|
|
35
35
|
this endpoint and the `search_web_pages` tool and does not read the
|
|
36
36
|
`QWEN_AUDIO_WEB_SEARCH_MCP_*` settings below.
|
|
37
37
|
|
|
38
|
+
The built-in [Parallel](https://docs.parallel.ai/integrations/mcp/quickstart)
|
|
39
|
+
preset connects to the Parallel MCP server
|
|
40
|
+
(`https://mcp.parallel.ai/mcp?tools=web_search`) without an account or key.
|
|
41
|
+
Keyless use runs Parallel's Fast search mode at lower rate limits:
|
|
42
|
+
|
|
43
|
+
```dotenv
|
|
44
|
+
QWEN_AUDIO_WEB_SEARCH_PROVIDER=parallel
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
With this preset, search queries go to Parallel, and the returned titles,
|
|
48
|
+
excerpts and links enter the voice model's context as sources. `tools=web_search`
|
|
49
|
+
keeps that shared server scoped to search, so its fetch and research tools stay
|
|
50
|
+
out of the frontend. It always uses this endpoint and the `web_search` tool and
|
|
51
|
+
does not read the `QWEN_AUDIO_WEB_SEARCH_MCP_*` settings below; to send a
|
|
52
|
+
Parallel API key, choose `mcp` and configure the URL and token explicitly.
|
|
53
|
+
|
|
38
54
|
The same provider-neutral adapter can connect to another compatible MCP search
|
|
39
55
|
service. Custom endpoints must provide their own credentials explicitly:
|
|
40
56
|
|
|
@@ -45,7 +61,7 @@ QWEN_AUDIO_WEB_SEARCH_MCP_TOKEN=your-token
|
|
|
45
61
|
QWEN_AUDIO_WEB_SEARCH_MCP_TOOL=web_search
|
|
46
62
|
```
|
|
47
63
|
|
|
48
|
-
Choose `so360` (default), `bing`, `bailian`, `keenable`, `mcp`, or `none`. Setting `none` disables search, not page fetching. Disable both search and page fetching with:
|
|
64
|
+
Choose `so360` (default), `bing`, `bailian`, `keenable`, `parallel`, `mcp`, or `none`. Setting `none` disables search, not page fetching. Disable both search and page fetching with:
|
|
49
65
|
|
|
50
66
|
```dotenv
|
|
51
67
|
QWEN_AUDIO_WEB_TOOLS_ENABLED=false
|
|
@@ -30,6 +30,20 @@ QWEN_AUDIO_WEB_SEARCH_PROVIDER=keenable
|
|
|
30
30
|
上下文。预设固定使用上述地址和 `search_web_pages` 工具,不读取下方的
|
|
31
31
|
`QWEN_AUDIO_WEB_SEARCH_MCP_*` 设置。
|
|
32
32
|
|
|
33
|
+
内置的 [Parallel](https://docs.parallel.ai/integrations/mcp/quickstart) 预设无需账号
|
|
34
|
+
或 Key,即可连接 Parallel MCP 服务(`https://mcp.parallel.ai/mcp?tools=web_search`)。
|
|
35
|
+
免 Key 调用使用 Fast 搜索模式,调用额度较低:
|
|
36
|
+
|
|
37
|
+
```dotenv
|
|
38
|
+
QWEN_AUDIO_WEB_SEARCH_PROVIDER=parallel
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
启用该预设后,搜索词会发送到 Parallel,返回的标题、摘录和链接作为来源进入语音模型
|
|
42
|
+
上下文。`tools=web_search` 把该共享服务限定为搜索,其网页读取与研究类工具不会进入
|
|
43
|
+
前台。预设固定使用上述地址和 `web_search` 工具,不读取下方的
|
|
44
|
+
`QWEN_AUDIO_WEB_SEARCH_MCP_*` 设置;如需发送 Parallel API Key,请选择 `mcp` 并显式
|
|
45
|
+
配置地址与 Token。
|
|
46
|
+
|
|
33
47
|
同一个与供应商无关的 Adapter 也可以接入其他兼容的 MCP 搜索服务;自定义地址必须
|
|
34
48
|
显式提供自己的凭据:
|
|
35
49
|
|
|
@@ -40,7 +54,7 @@ QWEN_AUDIO_WEB_SEARCH_MCP_TOKEN=your-token
|
|
|
40
54
|
QWEN_AUDIO_WEB_SEARCH_MCP_TOOL=web_search
|
|
41
55
|
```
|
|
42
56
|
|
|
43
|
-
可选 `so360`(默认)、`bing`、`bailian`、`keenable`、`mcp` 或 `none`。设置 `none` 只关闭搜索,网页读取工具仍可用;同时关闭搜索和网页读取时设置:
|
|
57
|
+
可选 `so360`(默认)、`bing`、`bailian`、`keenable`、`parallel`、`mcp` 或 `none`。设置 `none` 只关闭搜索,网页读取工具仍可用;同时关闭搜索和网页读取时设置:
|
|
44
58
|
|
|
45
59
|
```dotenv
|
|
46
60
|
QWEN_AUDIO_WEB_TOOLS_ENABLED=false
|
|
@@ -70,6 +70,36 @@ Desktop exposes its log directory in Settings → Application → Logs. CLI logs
|
|
|
70
70
|
`~/.config/qwaudio/state/logs`; desktop-hosted Gateway logs use `~/.config/qwaudio/state/desktop/logs`.
|
|
71
71
|
Desktop Client logs use the `logs/` subdirectory of its application data directory.
|
|
72
72
|
|
|
73
|
+
### Delayed or Choppy Live Speech
|
|
74
|
+
|
|
75
|
+
For paced-audio frontends such as Qwen Live and GPT Live, the Gateway emits
|
|
76
|
+
`realtime.audio.transport` every five seconds and flushes the final window on close, not once per frame.
|
|
77
|
+
|
|
78
|
+
- `inputAudioMs` / `outputAudioMs`: PCM duration sent/received in the window. Input includes adapter-generated
|
|
79
|
+
silence and means accepted by the local WebSocket, not processed by the service. Output is normalized PCM,
|
|
80
|
+
excluding native packets filtered by the adapter.
|
|
81
|
+
- `clientInputPackets` / `clientInputAudioMs` / `lastClientInputAgeMs`: separately count client-originated audio
|
|
82
|
+
accepted for sending, excluding adapter-generated silence. They do not distinguish speech from captured silence.
|
|
83
|
+
- `inputGapMaxMs` / `outputGapMaxMs` and `lastOutputAgeMs`: packet gaps and time since the last output PCM.
|
|
84
|
+
Silence alone is normal; correlate it with user transcripts and response-start records.
|
|
85
|
+
- `bufferedBytes` / `bufferedBytesPeak`: current/peak outbound WebSocket backlog.
|
|
86
|
+
`monitorTickDelayMs` measures lateness of the Gateway reporting timer, helping identify local event-loop stalls.
|
|
87
|
+
- `realtime.audio.input_buffer_flushed`: retained/dropped chunks, retained PCM duration, and the whole
|
|
88
|
+
connection-wait window when buffered input is flushed after connection or reconnection. The window is not
|
|
89
|
+
the age of the oldest retained frame.
|
|
90
|
+
|
|
91
|
+
Desktop and WebUI attach `audioDiagnostics` to existing `realtime.playback.started` / `ended` / `cancelled`
|
|
92
|
+
records: received chunk count and PCM duration, maximum receive gap, first-chunk-to-confirmed-playback delay,
|
|
93
|
+
maximum scheduled buffer, count/maximum of scheduling gaps within one reply, underrun recovery count, and
|
|
94
|
+
AudioContext suspension count. Start receipts contain partial statistics; end/cancel receipts contain the final
|
|
95
|
+
snapshot. Natural silence between replies is excluded from scheduling gaps. These are client observations,
|
|
96
|
+
not hardware playback timestamps; TUI and other clients may omit them.
|
|
97
|
+
|
|
98
|
+
These new metrics contain no audio, transcripts, or credentials, do not enter model context, and do not change
|
|
99
|
+
playback, interruption, or permissions. Correlate session/connection identifiers and `responseId` to distinguish
|
|
100
|
+
outbound backlog, absent incoming replies, and local playback queuing. Metrics alone do not prove whether
|
|
101
|
+
the network or the provider is responsible.
|
|
102
|
+
|
|
73
103
|
### Session history retention
|
|
74
104
|
|
|
75
105
|
`state/sessions/` contains recovery records, separate from diagnostic logs. Journals are not permanent audit archives:
|
|
@@ -67,6 +67,32 @@ HTTPS Endpoint 检查证书、反向代理与 WebSocket 转发。连接码只显
|
|
|
67
67
|
`~/.config/qwaudio/state/logs`;桌面代管的 Gateway 在 `~/.config/qwaudio/state/desktop/logs`,
|
|
68
68
|
桌面客户端日志在其应用数据目录的 `logs/` 下。
|
|
69
69
|
|
|
70
|
+
### Live 回复延迟与音频断续
|
|
71
|
+
|
|
72
|
+
对 Qwen Live、GPT Live 等按播放速率输出音频的前台,Gateway 每 5 秒记录一条
|
|
73
|
+
`realtime.audio.transport`,连接关闭时补记最后一个统计窗口;不逐帧写日志。
|
|
74
|
+
|
|
75
|
+
- `inputAudioMs` / `outputAudioMs`:本窗口发送/收到的 PCM 时长。上行包含适配器补充的静音,
|
|
76
|
+
仅代表本地 WebSocket 接受发送,不代表服务端已经处理;下行是适配后的 PCM,不含适配器过滤的原生帧。
|
|
77
|
+
- `clientInputPackets` / `clientInputAudioMs` / `lastClientInputAgeMs`:单独统计来自客户端、已接受发送的
|
|
78
|
+
音频,不包含适配器补充的静音;它不区分用户人声和客户端采集的环境静音。
|
|
79
|
+
- `inputGapMaxMs` / `outputGapMaxMs`、`lastOutputAgeMs`:包间隔与距最近下行 PCM 的时间。
|
|
80
|
+
没有回复时静默本身是正常现象,需要结合用户转写与回复开始日志判断。
|
|
81
|
+
- `bufferedBytes` / `bufferedBytesPeak`:向服务发送的 WebSocket 当前/窗口峰值积压。
|
|
82
|
+
`monitorTickDelayMs` 表示网关统计定时器的迟到量,可辅助发现本地事件循环停顿。
|
|
83
|
+
- `realtime.audio.input_buffer_flushed`:建连或重连后补发输入时,记录保留包数、丢弃包数、
|
|
84
|
+
保留 PCM 时长和整个等待建连窗口的时长;后者不是最老保留帧的年龄。
|
|
85
|
+
|
|
86
|
+
桌面版与 WebUI 在现有 `realtime.playback.started` / `ended` / `cancelled` 日志中附带
|
|
87
|
+
`audioDiagnostics`:收片数与 PCM 总时长、最大收片间隔、首次收片到确认开始播放的等待、
|
|
88
|
+
最大已调度缓冲、同一回复内调度空隙的次数/最大值、欠载恢复次数,以及 AudioContext 暂停次数。
|
|
89
|
+
开始回执是部分统计,结束或取消回执是最终统计;不同回复间的自然静默不计为调度空隙。
|
|
90
|
+
这些是客户端观察值,不是扬声器实际发声时间,TUI 或其他客户端可不提供。
|
|
91
|
+
|
|
92
|
+
上述新增指标不包含音频、转写内容或凭据,不进入模型上下文,也不改变播放、打断或授权行为。
|
|
93
|
+
用同一会话/连接及 `responseId` 对齐日志,可区分上行积压、下行无回复和本地播放排队;
|
|
94
|
+
仅凭这些指标仍不能直接认定是网络或供应商服务故障。
|
|
95
|
+
|
|
70
96
|
### 会话历史留存
|
|
71
97
|
|
|
72
98
|
`state/sessions/` 保存恢复记录,与诊断日志分开,不是永久审计档案:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Extending Realtime Providers
|
|
2
2
|
|
|
3
|
-
A Realtime Provider
|
|
3
|
+
A Realtime Provider in the runtime extension API is a protocol adapter; it is neither the client nor the Orchestration Runtime itself. The public provider identifies a service, such as `openai`; different models of that service can bind to different internal adapters. A product host can inject a custom provider without changing shared session or backend-work logic. The example below assembles it through the Gateway application entry point.
|
|
4
4
|
|
|
5
5
|
For another model using an existing provider, maintain its support in that provider's data file under `shared/realtime-models/` and add tests. Model definitions and adaptation parameters belong to framework code, not user configuration. Users [select from the supported models](../configuration/frontend.md#select-a-supported-model).
|
|
6
6
|
|
|
@@ -27,12 +27,21 @@ The extension boundary is:
|
|
|
27
27
|
- Each Provider is an independent adapter that owns its URL, authentication, model, session, and error-classification semantics. Product differences should not be carried by reshaping another Provider.
|
|
28
28
|
- `url()`, `headers()`, and `model()` can read the service URL, token, and model from host-owned configuration closures. The Gateway does not require product-specific environment variables.
|
|
29
29
|
- `createProtocol()` runs once for each Realtime connection, so connection IDs and mutable state remain isolated.
|
|
30
|
+
- `createProtocol({ emit, send })` also receives two hooks: `emit(event)` injects a synthetic provider event through `normalizeIncoming()`, for example to close a spoken segment once output goes quiet; `send(payload, options)` sends a wire event of the protocol's own through `encodeOutgoing()`, and `{ correlate: false }` keeps a `response.create` sent this way off the pending Gateway request.
|
|
31
|
+
- `concurrentVoicePlayback` declares a full-duplex service: voice output runs alongside backend work, and the model decides whether a turn gets a reply, so an unanswered turn is released without an error. Mark playback-only synthetic responses `__voicePlayback: true`, and the model's own speech also `__voiceAutomatic: true`; they gate no Gateway request, and only a playback response answers a request to speak. A user interruption calls the optional `interruptPlayback()`, with `{ speech: true }` when the user spoke, any other cancel calls it with `{ stop: true }`, and it may return a frame to send. Later user turns supersede earlier tool calls only for `respond_permission` and `update_agent_task`, and an earlier turn's `cancel_agent_task` never reaches work a later turn started; a permission or backend question is answered only by a turn that began after the Gateway asked it. Announcements are confirmed when their response completes. Default off.
|
|
32
|
+
- `interruptionPlaysOut` declares a model that finishes the speech it already generated when the user interrupts. A spoken barge-in, typed input, and `interrupt` clear no playback; `voice.ready` carries `interruptionPlaysOut: true`, so clients keep playing on `listening` and on their own interrupt. Default off.
|
|
33
|
+
- `pacedOutputAudio` declares output audio that arrives at playback speed, with no lead. `voice.ready` carries `pacedOutputAudio: true`, and clients play it from a reserve even from a local Gateway, as they do from a remote one. Default off.
|
|
34
|
+
- `inputMuteOnSleep` opts into protocol input mute during client sleep while retaining the connection. The runtime combines sleep, microphone mute, and input suspension, and restores mute before buffered audio on reconnect. The Provider owns mute acknowledgements and any synthetic audio clock. Default off; currently enabled only for Qwen Live.
|
|
35
|
+
- `toolOutputsBeforeResponse` declares a service that refuses `response.create` while a call has no output, and continues a response that made calls only on a later `response.create`. Outputs skip the response queue, Gateway requests wait until every open call has an output, and the runtime continues that response once, through the Gateway's follow-up or `continueToolResults()`. Outputs for calls the connection is not waiting on are not sent. Default off.
|
|
30
36
|
- Optional synchronous `validateSessionOptions({ sessionOptions })` runs before opening the
|
|
31
37
|
upstream connection. Reject known-invalid service options; other service-specific values still need upstream validation. This does not bypass the catalog check for supported model IDs.
|
|
32
38
|
- `connectionMessages()` emits raw handshake frames after the WebSocket opens and before `session.update`.
|
|
33
39
|
- All later events pass through `encodeOutgoing()` and `normalizeIncoming()`, leaving Gateway tools, tasks, and client protocols unchanged.
|
|
34
40
|
- Protocols without transient response instructions can implement `responseInstructionsItem(response)`. Gateway creates and awaits that conversation item before calling `responseCreate(response)`, which strips unsupported wire parameters. Set `perResponseInstructions: false`; these instructions remain in history.
|
|
35
41
|
- `conversationItemCreate(item, { contextOnly })` distinguishes context delivery from interactive user input. For message items, `contextOnly: true` must write context without triggering a reply; it must not merely cache the text for a later `responseCreate`. Gateway passes `false` for interactive text/file input. Tool receipts keep the provider's native continuation semantics.
|
|
42
|
+
- `automaticUserResponses: true` means a real user item starts a native reply without `response.create` (Qwen Live). Default off. This does not turn context updates into user requests.
|
|
43
|
+
- `contextOnlyItems: false` forbids using user-message items to inject silent context when the service would treat them as new input. Default on. Qwen Live disables it and restores history through startup instructions instead.
|
|
44
|
+
- `nativeSessionContext: true` permits native task-state updates without a delegation ID. Default off; currently enabled only for GPT Live. Qwen Live keeps it off because unassociated text can become user input rather than task context.
|
|
36
45
|
- Set `automaticToolResponses: true` only when tool results natively resume generation (Doubao Seeduplex and Google Live). Runtime sends these receipts without waiting for response completion, and the tool-batch follow-up uses `ensureResponse(..., { afterToolResults: true })` without requesting a second reply. `sendFunctionOutput` acknowledges delivery with `{ delivered: true, automatic: true }`; this is not speech completion. `createResponse: false` cannot disable the service's native continuation, nor can per-response instructions control it. Other providers keep explicit response creation and completion tracking.
|
|
37
46
|
- Normalize events that only prove liveness to `response.activity` with a `response_id`, without forwarding thinking text.
|
|
38
47
|
- An `error` that carries a `response_id` settles only that response. Leave the id off when the failure belongs to the request waiting on the frontend, so it falls back to the sole waiter.
|
|
@@ -58,8 +67,14 @@ For [Google Live](https://ai.google.dev/api/live), context-only history uses `cl
|
|
|
58
67
|
|
|
59
68
|
## Desktop settings
|
|
60
69
|
|
|
61
|
-
Built-in frontend settings live in `shared/realtime-provider-definitions.mjs`, a browser-safe catalog without credentials or connection implementations.
|
|
70
|
+
Built-in frontend settings live in `shared/realtime-provider-definitions.mjs`, a browser-safe catalog without credentials or connection implementations. Each service explicitly declares its name, configurable slots (`fields`), required slot (`required`), and defaults. Required credentials and editable model/voice fields are not inferred from whether a model catalog exists. All providers share the active connection's `QWEN_AUDIO_REALTIME_*` environment fields; adding a provider does not require another set of credential, model, URL, and voice variables.
|
|
62
71
|
|
|
63
|
-
|
|
72
|
+
Provider-specific model and API data live in `shared/realtime-models/dashscope.mjs`, `stepfun.mjs`, `openai.mjs`, `google.mjs`, and `volcengine.mjs`; `shared/realtime-model-catalog.mjs` is their public facade. These code-owned records define model IDs, adapter/API bindings, default endpoints, capabilities, session defaults, and constraints. Aggregation and resolution contain no provider-specific configuration. When a service exposes model selection, the desktop dropdown uses its static supported-model list; it does not accept user-defined model records or infer support from a free-form model name.
|
|
73
|
+
|
|
74
|
+
For example, public provider `openai` supports `gpt-realtime-2.1` and `gpt-live-1`. Their model records bind to `openai-realtime` and `openai-live` respectively. The built-in registry selects the implementation from those bindings, while user configuration stays at provider + model. Adapter is not a configurable field. The custom registry injection contract above is unchanged.
|
|
75
|
+
|
|
76
|
+
Likewise, `google` models bind to `google-live`, and `volcengine` models bind to `doubao-seeduplex`. The `speech-to-speech` and `minicpm-o` entries identify services whose models are managed upstream; they do not expose a Gateway model selector or require a cloud-vendor credential by implication.
|
|
77
|
+
|
|
78
|
+
The form displays Service URL, API Key, Model, and Voice, mapped to the `endpoint`, `credential`, `model`, and `voice` slots. Providers expose only configurable slots; upstream-owned model and voice controls remain disabled. Bearer tokens use the API Key field. Switching provider must clear or replace the previous connection's values rather than send its credential to another service. Switching models within the same provider keeps the key; changing protocol adapters clears URL and voice overrides. Legacy variable names are handled at the configuration-read boundary, not in adapters. A remote Gateway continues to own its frontend configuration.
|
|
64
79
|
|
|
65
80
|
Settings metadata is separate from runtime adapters. Host-injected custom Providers are not automatically registered in the desktop chooser.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 扩展 Realtime Provider
|
|
2
2
|
|
|
3
|
-
Realtime Provider
|
|
3
|
+
运行时扩展 API 中的 Realtime Provider 是协议适配器,不是客户端,也不是编排运行时本身。用户配置中的 Provider 则标识服务,如 `openai`;同一服务的不同模型可以绑定不同的内部 Adapter。业务宿主可以注入自定义 Provider,而不必修改通用会话与后台工作逻辑。下面通过 Gateway 应用入口进行装配。
|
|
4
4
|
|
|
5
5
|
为已有供应商新增模型支持时,在 `shared/realtime-models/` 下对应的供应商数据文件中维护并补充测试。模型定义与适配参数属于框架代码,不是用户配置;用户只需[选择受支持模型](../configuration/frontend.zh.md#选择受支持模型)。
|
|
6
6
|
|
|
@@ -27,11 +27,20 @@ createGatewayApplication({
|
|
|
27
27
|
- 每个 Provider 都是独立适配器,完整拥有自己的 URL、认证、模型、Session 和错误分类语义;不要通过改造另一个 Provider 来承载业务差异。
|
|
28
28
|
- `url()`、`headers()`、`model()` 可从宿主配置闭包读取服务地址、令牌和模型;Gateway 不要求为业务 Provider 增加环境变量。
|
|
29
29
|
- `createProtocol()` 每条 Realtime 连接调用一次,适合生成连接级 ID 和隔离状态。
|
|
30
|
+
- `createProtocol({ emit, send })` 还会收到两个钩子:`emit(event)` 注入一条经 `normalizeIncoming()` 的合成服务端事件,例如在输出静默后收掉当前语音段;`send(payload, options)` 经 `encodeOutgoing()` 发出协议自己的事件,以 `{ correlate: false }` 发出的 `response.create` 不关联等待中的 Gateway 请求。
|
|
31
|
+
- `concurrentVoicePlayback` 声明全双工服务:语音输出与后端工作并行,是否回复某一轮由模型决定,没有得到回复的轮次会被释放,不报错。只代表播放的合成 response 标 `__voicePlayback: true`,模型自发的发言再标 `__voiceAutomatic: true`;它们不阻挡 Gateway 请求,要求说话的请求只由播放 response 回复。用户打断调用可选的 `interruptPlayback()`,用户是开口打断时带 `{ speech: true }`,其他取消以 `{ stop: true }` 调用它,它可以返回一帧由运行时发出。用户后续的轮次只对 `respond_permission` 与 `update_agent_task` 顶掉更早的工具调用,更早轮次的 `cancel_agent_task` 也取消不到后来轮次发起的工作;权限请求和后台追问只能由 Gateway 询问之后开始的轮次回答。播报在其 response 完成时确认送达。默认关闭。
|
|
32
|
+
- `interruptionPlaysOut` 声明模型在用户打断时把已经生成的语音说完。插话、文字输入和 `interrupt` 都不清空播放;`voice.ready` 带上 `interruptionPlaysOut: true`,客户端在 `listening` 和自己发起打断时继续播放。默认关闭。
|
|
33
|
+
- `pacedOutputAudio` 声明输出音频按播放速度到达、没有提前量。`voice.ready` 带上 `pacedOutputAudio: true`,客户端连本机 Gateway 时也先缓冲再播放,和连远程 Gateway 时一样。默认关闭。
|
|
34
|
+
- `inputMuteOnSleep` 允许客户端休眠时使用协议静音并保留连接。运行时合并休眠、麦克风静音和输入占用状态,重连时在缓冲音频之前恢复静音;静音回执及合成音频时钟由 Provider 管理。默认关闭,目前仅 Qwen Live 启用。
|
|
35
|
+
- `toolOutputsBeforeResponse` 声明服务在有调用未回传结果时拒绝 `response.create`,且发起调用的 response 只在之后的 `response.create` 上继续。函数结果不进响应队列,Gateway 请求等所有调用都有结果后才发出,运行时把这个 response 续上一次:由 Gateway 的后续请求,或由 `continueToolResults()`。当前连接并未在等的调用,其结果不发送。默认关闭。
|
|
30
36
|
- 可选的同步 `validateSessionOptions({ sessionOptions })` 在上游连接前执行;拒绝已确认无效的服务参数,其他服务特有参数仍需上游验证。这不绕过受支持模型 ID 的目录检查。
|
|
31
37
|
- `connectionMessages()` 在 WebSocket 打开后、`session.update` 之前发送原始握手帧。
|
|
32
38
|
- 其余事件通过 `encodeOutgoing()` 与 `normalizeIncoming()` 转换,Gateway 的工具调用、任务和客户端协议保持不变。
|
|
33
39
|
- 不支持临时回复指令的协议可实现 `responseInstructionsItem(response)`,将内部回复指令转为普通对话项。Gateway 等待确认后调用 `responseCreate(response)`,后者负责去掉上游不支持的参数。此时 `perResponseInstructions` 为 `false`,指令会进入会话历史。
|
|
34
40
|
- `conversationItemCreate(item, { contextOnly })` 区分上下文投递和用户交互输入。对于消息项,`contextOnly: true` 必须写入上下文且不触发回复,不能只缓存到下一次 `responseCreate`;用户主动发送文本或文件时,Gateway 传入 `false`。工具回执仍遵循供应商原生的续答语义。
|
|
41
|
+
- `automaticUserResponses: true` 表示真实用户消息项会触发原生回复,无需 `response.create`(Qwen Live),默认关闭;不意味着可以把上下文更新作为用户请求发送。
|
|
42
|
+
- `contextOnlyItems: false` 禁止把用户消息项当作静默上下文注入,避免服务将其视为新输入;默认开启。Qwen Live 关闭此能力,历史通过建连提示词恢复。
|
|
43
|
+
- `nativeSessionContext: true` 允许不关联委派 ID 的原生任务状态更新,默认关闭,目前仅 GPT Live 开启。Qwen Live 保持关闭,避免无关联文本被当成用户输入。
|
|
35
44
|
- 仅当工具结果会由服务原生续答时声明 `automaticToolResponses: true`(豆包 Seeduplex、Google Live)。运行时发送这类回执不等待当前响应结束;工具批次结束时通过 `ensureResponse(..., { afterToolResults: true })` 避免再次请求回复。`sendFunctionOutput` 返回 `{ delivered: true, automatic: true }` 只表示回执已投递,不表示播报完成。`createResponse: false` 不能禁止服务原生续答,单次回复指令也不能控制它。其他 Provider 保持显式请求回复和完成跟踪。
|
|
36
45
|
- 只表示响应仍在进行的事件可转换为带 `response_id` 的 `response.activity`,无需转发原始思考内容。
|
|
37
46
|
- 带 `response_id` 的 `error` 只结算它点名的那个回复;失败属于前端正在等待的请求时不要带 id,以回落到唯一等待者。
|
|
@@ -57,8 +66,14 @@ Provider 和 Protocol 会在注册与建连时校验;缺少方法或返回无
|
|
|
57
66
|
|
|
58
67
|
## 桌面设置
|
|
59
68
|
|
|
60
|
-
仓库内置前台的设置统一定义在 `shared/realtime-provider-definitions.mjs`,它不依赖 Node.js
|
|
69
|
+
仓库内置前台的设置统一定义在 `shared/realtime-provider-definitions.mjs`,它不依赖 Node.js,也不包含密钥值或连接实现。各服务显式声明名称、可编辑槽位 `fields`、必填槽位 `required` 和默认值,不再通过是否存在模型目录推断是否必填密钥或允许修改模型、音色。各供应商共用当前连接的 `QWEN_AUDIO_REALTIME_*` 环境变量,不需再新增一套 Key、模型、地址和音色变量。
|
|
61
70
|
|
|
62
|
-
|
|
71
|
+
供应商专属模型和 API 数据分别位于 `shared/realtime-models/dashscope.mjs`、`stepfun.mjs`、`openai.mjs`、`google.mjs`、`volcengine.mjs`,`shared/realtime-model-catalog.mjs` 是公共入口。这些代码数据定义模型 ID、Adapter/API 绑定、默认地址、能力、会话默认参数和接入约束,聚合与解析层不包含供应商具体配置。服务开放模型选择时,桌面下拉框使用其静态支持列表,不接受用户自定义模型记录,也不通过自由输入的模型名称推断支持情况。
|
|
72
|
+
|
|
73
|
+
例如,公开 Provider `openai` 支持 `gpt-realtime-2.1` 和 `gpt-live-1`,模型记录分别绑定 `openai-realtime`、`openai-live`。内置注册表依据绑定选择实现,用户仍只选择供应商和模型,不能配置 Adapter 字段。上面的自定义注册表注入契约保持不变。
|
|
74
|
+
|
|
75
|
+
同样,`google` 的模型绑定 `google-live`,`volcengine` 的模型绑定 `doubao-seeduplex`。`speech-to-speech` 和 `minicpm-o` 则标识由上游管理模型的服务,不在 Gateway 开放模型选择,也不会因此要求云厂商凭据。
|
|
76
|
+
|
|
77
|
+
界面显示“服务地址、API Key、模型、音色”四行,分别对应 `endpoint`、`credential`、`model`、`voice` 配置槽位。Provider 只暴露可配置槽位;由上游管理的模型、音色保持禁用。Bearer 令牌使用 API Key 字段。切换供应商时应清空或替换旧连接值,不能将旧凭据发送给另一家服务。同一供应商下换模型保留 Key;跨协议 Adapter 时清空地址和音色覆盖。旧变量别名只在配置读取边界处理,不进入 Adapter。连接远端 Gateway 时,仍由远端管理前台配置。
|
|
63
78
|
|
|
64
79
|
这份设置定义与运行时适配器分离;宿主注入的自定义 Provider 不会自动注册到桌面设置页。
|
|
@@ -10,7 +10,7 @@ Gemini Live's bidirectional stream into the shared Realtime runtime.
|
|
|
10
10
|
Edit the user configuration file shown by `qwenaudio config`:
|
|
11
11
|
|
|
12
12
|
```dotenv
|
|
13
|
-
QWEN_AUDIO_REALTIME_PROVIDER=google
|
|
13
|
+
QWEN_AUDIO_REALTIME_PROVIDER=google
|
|
14
14
|
QWEN_AUDIO_REALTIME_API_KEY=your-google-api-key
|
|
15
15
|
QWEN_AUDIO_REALTIME_MODEL=gemini-3.8-live
|
|
16
16
|
QWEN_AUDIO_REALTIME_URL=
|
|
@@ -23,10 +23,14 @@ QWEN_AUDIO_REALTIME_VOICE=
|
|
|
23
23
|
| `QWEN_AUDIO_REALTIME_MODEL` | `gemini-3.8-live` | Current built-in model profile |
|
|
24
24
|
| `QWEN_AUDIO_REALTIME_VOICE` | Empty | Service default, or a prebuilt Gemini Live voice name |
|
|
25
25
|
|
|
26
|
-
Desktop exposes the same fields under **Voice frontend
|
|
26
|
+
Desktop exposes the same fields under **Voice frontend → Google**, with **Gemini 3.8 Live** as the model.
|
|
27
27
|
Restart a terminal Gateway after editing the file; for an installed service,
|
|
28
28
|
run `qwenaudio gateway restart`.
|
|
29
29
|
|
|
30
|
+
`google` identifies the service; the model definition binds to the internal
|
|
31
|
+
`google-live` adapter. Older `google-live` configurations remain readable and
|
|
32
|
+
save as `google`, without changing the API, model, or credentials.
|
|
33
|
+
|
|
30
34
|
## Integration boundary
|
|
31
35
|
|
|
32
36
|
- The adapter uses Gemini Live's native WebSocket endpoint and adds the API key
|
|
@@ -53,6 +57,6 @@ Google's current Gemini Live API documentation.
|
|
|
53
57
|
|
|
54
58
|
## Read next
|
|
55
59
|
|
|
56
|
-
- [
|
|
60
|
+
- [OpenAI Realtime](openai-realtime.md)
|
|
57
61
|
- [Frontend configuration reference](../configuration/frontend.md)
|
|
58
62
|
- [Custom Provider](custom-provider.md)
|
|
@@ -9,7 +9,7 @@ Adapter 只把 Gemini Live 的双向流协议转换成项目内统一的 Realtim
|
|
|
9
9
|
编辑 `qwenaudio config` 显示的用户配置文件:
|
|
10
10
|
|
|
11
11
|
```dotenv
|
|
12
|
-
QWEN_AUDIO_REALTIME_PROVIDER=google
|
|
12
|
+
QWEN_AUDIO_REALTIME_PROVIDER=google
|
|
13
13
|
QWEN_AUDIO_REALTIME_API_KEY=your-google-api-key
|
|
14
14
|
QWEN_AUDIO_REALTIME_MODEL=gemini-3.8-live
|
|
15
15
|
QWEN_AUDIO_REALTIME_URL=
|
|
@@ -22,9 +22,12 @@ QWEN_AUDIO_REALTIME_VOICE=
|
|
|
22
22
|
| `QWEN_AUDIO_REALTIME_MODEL` | `gemini-3.8-live` | 当前内置模型档案 |
|
|
23
23
|
| `QWEN_AUDIO_REALTIME_VOICE` | 空 | 使用服务默认音色,或填写 Gemini Live 预置音色名 |
|
|
24
24
|
|
|
25
|
-
桌面端在 **语音前台
|
|
25
|
+
桌面端在 **语音前台 → Google** 下暴露同样字段,模型选择 **Gemini 3.8 Live**。终端 Gateway 修改文件后需重启;
|
|
26
26
|
若是已安装的后台服务,执行 `qwenaudio gateway restart`。
|
|
27
27
|
|
|
28
|
+
`google` 标识服务,模型定义绑定内部的 `google-live` Adapter。旧 `google-live`
|
|
29
|
+
配置仍可读取,保存后统一为 `google`,不改变 API、模型或凭据。
|
|
30
|
+
|
|
28
31
|
## 集成边界
|
|
29
32
|
|
|
30
33
|
- Adapter 使用 Gemini Live 原生 WebSocket 端点;若 URL 中没有 `key` 或
|
|
@@ -46,6 +49,6 @@ QWEN_AUDIO_REALTIME_VOICE=
|
|
|
46
49
|
|
|
47
50
|
## 继续阅读
|
|
48
51
|
|
|
49
|
-
- [
|
|
52
|
+
- [OpenAI Realtime](openai-realtime.zh.md)
|
|
50
53
|
- [前台配置参考](../configuration/frontend.zh.md)
|
|
51
54
|
- [自定义 Provider](custom-provider.zh.md)
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# GPT-Live 1 (OpenAI Live API)
|
|
2
|
+
|
|
3
|
+
GPT-Live 1 handles the full-duplex spoken conversation. This integration uses
|
|
4
|
+
**Client delegation**: Gateway sends delegated work to the configured backend
|
|
5
|
+
Agent and returns its progress, questions, and results to the Live session.
|
|
6
|
+
It does not use OpenAI-hosted Responses delegation.
|
|
7
|
+
|
|
8
|
+
## Configuration
|
|
9
|
+
|
|
10
|
+
Edit the user configuration file shown by `qwenaudio config`:
|
|
11
|
+
|
|
12
|
+
```dotenv
|
|
13
|
+
QWEN_AUDIO_REALTIME_PROVIDER=openai
|
|
14
|
+
QWEN_AUDIO_REALTIME_API_KEY=your-openai-key
|
|
15
|
+
QWEN_AUDIO_REALTIME_MODEL=gpt-live-1
|
|
16
|
+
QWEN_AUDIO_REALTIME_URL=
|
|
17
|
+
QWEN_AUDIO_REALTIME_VOICE=
|
|
18
|
+
|
|
19
|
+
# Example: select an installed and authenticated backend Agent.
|
|
20
|
+
AGENT_PROTOCOL=qoder
|
|
21
|
+
QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE=native
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Choose a [backend Agent](../backends/overview.md) and complete its own setup
|
|
25
|
+
first. Delegated work requires an available backend; `none` leaves only the
|
|
26
|
+
Live model's conversation capability, not a cloud execution fallback.
|
|
27
|
+
|
|
28
|
+
| Optional setting | Default | Description |
|
|
29
|
+
| --- | --- | --- |
|
|
30
|
+
| `QWEN_AUDIO_REALTIME_URL` | `wss://api.openai.com/v1/live/sessions` | Live API WebSocket endpoint |
|
|
31
|
+
| `QWEN_AUDIO_REALTIME_VOICE` | Empty | Use the service default or specify a supported voice |
|
|
32
|
+
|
|
33
|
+
Select `gpt-live-1` explicitly: the `openai` provider defaults to
|
|
34
|
+
`gpt-realtime-2.1`. The model definition selects the internal `openai-live`
|
|
35
|
+
adapter; users do not configure the protocol separately. When editing the
|
|
36
|
+
configuration file to switch from Realtime, clear or replace URL and voice
|
|
37
|
+
overrides. The former `GPT_LIVE_1_DELEGATION_MODEL` setting is no longer used.
|
|
38
|
+
|
|
39
|
+
Desktop exposes these settings under **Voice frontend → OpenAI → GPT-Live 1**.
|
|
40
|
+
Restart a terminal Gateway after editing the file; for an installed service,
|
|
41
|
+
run `qwenaudio gateway restart`.
|
|
42
|
+
|
|
43
|
+
### Optional timing settings
|
|
44
|
+
|
|
45
|
+
Live streams audio and transcript fragments rather than Realtime-style turn
|
|
46
|
+
boundaries. These settings affect local caption and playback grouping, not
|
|
47
|
+
backend task completion. Values are milliseconds, clamped to 100–10,000;
|
|
48
|
+
non-numeric values are ignored.
|
|
49
|
+
|
|
50
|
+
| Setting | Default | Description |
|
|
51
|
+
| --- | --- | --- |
|
|
52
|
+
| `GPT_LIVE_1_OUTPUT_IDLE_MS` | `1500` | Output quiet period that ends a displayed answer |
|
|
53
|
+
| `GPT_LIVE_1_WORD_GAP_MS` | `600` | Word gap that separates a new answer after an interruption |
|
|
54
|
+
| `GPT_LIVE_1_INPUT_SEGMENT_GAP_MS` | `1200` | Speech gap that separates user utterances |
|
|
55
|
+
| `GPT_LIVE_1_INPUT_IDLE_MS` | `2000` | Input quiet period that completes a user utterance |
|
|
56
|
+
|
|
57
|
+
## Execution and permissions
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
Spoken request → GPT-Live Client delegation
|
|
61
|
+
→ Gateway Task → configured backend Agent
|
|
62
|
+
← progress / permission request / result
|
|
63
|
+
→ Live context update or spoken response
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- **Native delegation replaces `spawn_thinking` for this model.** The cloud
|
|
67
|
+
delegation event carries an ID and a timeline position, not task text.
|
|
68
|
+
Gateway builds the backend request from the conversation context and
|
|
69
|
+
transcriptions. Missing or incomplete input must not authorize an action.
|
|
70
|
+
- **Gateway remains the task owner.** Task status, cancellation, permissions,
|
|
71
|
+
and durable results use the existing task system. A speech interruption does
|
|
72
|
+
not cancel backend work.
|
|
73
|
+
- **Permissions require explicit client controls.** Use the permission card
|
|
74
|
+
in Desktop or WebUI, or `/approve [permission_id]` and `/reject [permission_id]`
|
|
75
|
+
in TUI. With multiple pending requests, specify the displayed permission ID;
|
|
76
|
+
`/approve` grants only the selected task, not session-wide permission.
|
|
77
|
+
The decision goes directly to Gateway and the waiting backend, without
|
|
78
|
+
another model call. Saying or typing “yes” does not approve
|
|
79
|
+
a permission request in this version. Switching to GPT-Live does not enable
|
|
80
|
+
automatic approval or change the configured backend permission policy.
|
|
81
|
+
- **Waiting for an answer is not completion.** The desktop compact card shows
|
|
82
|
+
that input is required; choose **Answer question** to open the conversation
|
|
83
|
+
form. WebUI renders the form below the task. Use **Cancel task** to stop work;
|
|
84
|
+
a spoken request does not automatically cancel backend execution.
|
|
85
|
+
- **Frontend tools are not registered with GPT-Live.** The backend uses its
|
|
86
|
+
own tools and configured capabilities. Gateway's frontend-only search,
|
|
87
|
+
memory, reminder, MCP/OpenAPI, and client-action tools are not automatically
|
|
88
|
+
transferred to it. Use client controls for task management; this integration
|
|
89
|
+
does not promise voice control of those frontend-only features.
|
|
90
|
+
|
|
91
|
+
See [Work and Permissions](../guides/tasks.md) for task-card controls and
|
|
92
|
+
[Backend Permission Modes](../configuration/backend.md#backend-permission-modes)
|
|
93
|
+
for the existing backend policies.
|
|
94
|
+
|
|
95
|
+
## Prompt structure
|
|
96
|
+
|
|
97
|
+
Live's concise policy lives in `config/frontend-agent/LIVE_PROMPT.md`, separate
|
|
98
|
+
from the tool-based `PROMPT.md`. Both reuse the same assistant profile, supplied
|
|
99
|
+
memory context, and runtime context. Live does not include instructions to call
|
|
100
|
+
frontend tools that it cannot use. To customize it, place `LIVE_PROMPT.md` in
|
|
101
|
+
`QWEN_AUDIO_AGENT_FRONTEND_PROMPT_DIR`; if that file is absent, the packaged Live
|
|
102
|
+
policy is used. A present but empty or unreadable file is an error.
|
|
103
|
+
|
|
104
|
+
## Inputs and delivery
|
|
105
|
+
|
|
106
|
+
- **Voice:** the WebSocket uses Bearer authentication and mono PCM16 audio at
|
|
107
|
+
24 kHz in both directions. Recent text history is supplied at session startup.
|
|
108
|
+
- **Text and files:** typed requests go directly to the configured backend;
|
|
109
|
+
a short text summary is mirrored into Live's context. Submit the question
|
|
110
|
+
and its images or files together. Attachments follow the backend's supported
|
|
111
|
+
input capabilities, not a GPT-Live image input path. Later spoken references
|
|
112
|
+
to historical attachments are not supported by this integration; Gateway
|
|
113
|
+
does not attach all earlier files automatically.
|
|
114
|
+
- **Progress and results:** quiet progress uses `session.thinking.append`;
|
|
115
|
+
material to speak uses `session.commentary.append`. Updates for cloud-created
|
|
116
|
+
work retain its delegation ID. Locally initiated work uses a null delegation
|
|
117
|
+
ID. An append acknowledgment confirms context acceptance, not audible delivery.
|
|
118
|
+
Each append is conservatively shortened to respect the upstream limit; the full
|
|
119
|
+
result remains in the local task record.
|
|
120
|
+
- **Natural interruptions:** the Live model controls its continuous speech.
|
|
121
|
+
Already generated audio plays out; Gateway does not apply Realtime's
|
|
122
|
+
speech-start playback clearing. Text input and explicit stop actions can
|
|
123
|
+
request that the model stop speaking without cancelling the backend task.
|
|
124
|
+
|
|
125
|
+
## Limitations and validation
|
|
126
|
+
|
|
127
|
+
- Oral permission approval is not implemented. Use a client with permission
|
|
128
|
+
controls when the backend can request authorization.
|
|
129
|
+
- TUI does not yet provide structured backend-question forms. Answer those
|
|
130
|
+
requests through the Desktop or WebUI task card.
|
|
131
|
+
- GPT-Live receives no images directly, and this integration does not negotiate
|
|
132
|
+
live visual frames. Backend image understanding depends on the chosen Agent.
|
|
133
|
+
- Audio and transcript timing are service-dependent. The adapter's local turn
|
|
134
|
+
grouping is not a protocol guarantee that an answer was heard or an action
|
|
135
|
+
completed.
|
|
136
|
+
- An open Live connection can incur service charges even when the microphone
|
|
137
|
+
is muted. Backend usage is separate.
|
|
138
|
+
|
|
139
|
+
Local tests cover Client session setup, delegation and result events, task
|
|
140
|
+
isolation, explicit permission handling, and unaffected Realtime behavior.
|
|
141
|
+
They do not replace live validation of account access, model behavior, latency,
|
|
142
|
+
or voices. See OpenAI's [delegation guide](https://developers.openai.com/api/docs/guides/live-delegation)
|
|
143
|
+
for the upstream protocol.
|
|
144
|
+
|
|
145
|
+
## Read next
|
|
146
|
+
|
|
147
|
+
- [OpenAI Realtime](openai-realtime.md)
|
|
148
|
+
- [Frontend configuration reference](../configuration/frontend.md)
|
|
149
|
+
- [Custom Provider](custom-provider.md)
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# GPT-Live 1(OpenAI Live API)
|
|
2
|
+
|
|
3
|
+
GPT-Live 1 负责全双工语音对话。本集成采用 **Client 委派模式**:Gateway 把委派请求交给已配置的后台 Agent,
|
|
4
|
+
再把进度、追问和结果回传给 Live 会话,不使用 OpenAI 托管的 Responses 委派。
|
|
5
|
+
|
|
6
|
+
## 配置
|
|
7
|
+
|
|
8
|
+
编辑 `qwenaudio config` 显示的用户配置文件:
|
|
9
|
+
|
|
10
|
+
```dotenv
|
|
11
|
+
QWEN_AUDIO_REALTIME_PROVIDER=openai
|
|
12
|
+
QWEN_AUDIO_REALTIME_API_KEY=your-openai-key
|
|
13
|
+
QWEN_AUDIO_REALTIME_MODEL=gpt-live-1
|
|
14
|
+
QWEN_AUDIO_REALTIME_URL=
|
|
15
|
+
QWEN_AUDIO_REALTIME_VOICE=
|
|
16
|
+
|
|
17
|
+
# 示例:选择已经安装并完成登录的后台 Agent。
|
|
18
|
+
AGENT_PROTOCOL=qoder
|
|
19
|
+
QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE=native
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
先选择并配置一个[后台 Agent](../backends/overview.zh.md)。执行委派任务需要后台可用;选择 `none` 时,
|
|
23
|
+
仅保留 Live 模型自身的对话能力,不会自动切换为云端后台执行。
|
|
24
|
+
|
|
25
|
+
| 可选配置 | 默认值 | 说明 |
|
|
26
|
+
| --- | --- | --- |
|
|
27
|
+
| `QWEN_AUDIO_REALTIME_URL` | `wss://api.openai.com/v1/live/sessions` | Live API WebSocket 端点 |
|
|
28
|
+
| `QWEN_AUDIO_REALTIME_VOICE` | 空 | 使用服务默认音色,或填写支持的音色 |
|
|
29
|
+
|
|
30
|
+
必须显式选择 `gpt-live-1`,因为 `openai` 的默认模型是 `gpt-realtime-2.1`。
|
|
31
|
+
模型定义会选择内部 `openai-live` Adapter,用户无需另行配置协议。
|
|
32
|
+
手动编辑文件从 Realtime 切换时,应清空或替换地址和音色覆盖。
|
|
33
|
+
原有的 `GPT_LIVE_1_DELEGATION_MODEL` 配置不再使用。
|
|
34
|
+
|
|
35
|
+
桌面端选择 **语音前台 → OpenAI → GPT-Live 1** 即可配置。
|
|
36
|
+
终端 Gateway 修改文件后需重启;若是已安装的后台服务,执行 `qwenaudio gateway restart`。
|
|
37
|
+
|
|
38
|
+
### 可选时间参数
|
|
39
|
+
|
|
40
|
+
Live 连续传输音频与转写片段,不提供 Realtime 风格的轮次边界。这些参数控制本地字幕和播放分段,
|
|
41
|
+
不用于判断后台任务是否完成。单位为毫秒,限制在 100–10,000;非数字的值会被忽略。
|
|
42
|
+
|
|
43
|
+
| 参数 | 默认值 | 说明 |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| `GPT_LIVE_1_OUTPUT_IDLE_MS` | `1500` | 输出安静多久后结束一段展示中的回答 |
|
|
46
|
+
| `GPT_LIVE_1_WORD_GAP_MS` | `600` | 打断后用于区分新回答的文字间隔 |
|
|
47
|
+
| `GPT_LIVE_1_INPUT_SEGMENT_GAP_MS` | `1200` | 用于区分用户语句的语音间隔 |
|
|
48
|
+
| `GPT_LIVE_1_INPUT_IDLE_MS` | `2000` | 输入安静多久后结束当前用户语句 |
|
|
49
|
+
|
|
50
|
+
## 任务执行与授权
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
语音请求 → GPT-Live 原生委派
|
|
54
|
+
→ Gateway 任务 → 已配置的后台 Agent
|
|
55
|
+
← 进度 / 权限请求 / 结果
|
|
56
|
+
→ Live 上下文更新或语音播报
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
- **原生委派替代此模型的 `spawn_thinking` 入口。**云端委派事件只有标识和时间位置,不包含任务正文;
|
|
60
|
+
Gateway 根据转写与对话上下文组织后台请求。缺失或不完整的输入不能成为授权依据。
|
|
61
|
+
- **Gateway 仍管理任务。**任务状态、取消、授权和持久化结果继续使用现有任务系统。
|
|
62
|
+
打断语音不等于取消后台执行。
|
|
63
|
+
- **通过客户端控件明确授权。**在桌面端或 WebUI 的权限卡片中操作,或在 TUI 使用
|
|
64
|
+
`/approve [permission_id]`、`/reject [permission_id]`。有多个待确认请求时需填写展示的权限 ID;
|
|
65
|
+
`/approve` 仅授权所选任务,不授予整个会话权限。决定直接交给 Gateway 和等待中的后台,
|
|
66
|
+
无需再次调用模型。本版说出或输入“同意”均不会批准权限请求。
|
|
67
|
+
切换到 GPT-Live 不会开启自动授权,也不会改变已配置的后台权限策略。
|
|
68
|
+
- **等待追问不等于执行完成。**桌面悬浮卡会显示“等待你的回答”,点击“回答问题”打开
|
|
69
|
+
对话面板填写;WebUI 可直接在任务下填写。停止工作使用“取消任务”,口头表达不会自动取消后台执行。
|
|
70
|
+
- **不向 GPT-Live 注册前台工具。**后台使用自己的工具及已配置的能力;Gateway 原有的前台搜索、
|
|
71
|
+
记忆、提醒、MCP/OpenAPI 和客户端操作工具不会自动转移到后台。
|
|
72
|
+
任务管理使用客户端控件,本集成不承诺对这些前台专属功能的语音控制。
|
|
73
|
+
|
|
74
|
+
卡片操作参见[任务与权限](../guides/tasks.zh.md),现有权限策略参见[后台权限模式](../configuration/backend.zh.md#后台权限模式)。
|
|
75
|
+
|
|
76
|
+
## 提示词结构
|
|
77
|
+
|
|
78
|
+
Live 的精简规则保存在 `config/frontend-agent/LIVE_PROMPT.md`,与工具调用式前台的
|
|
79
|
+
`PROMPT.md` 分开维护;两者复用相同的人设、已提供的记忆上下文和运行环境上下文。
|
|
80
|
+
Live 不包含调用其无法使用的前台工具的指令。需要自定义时,在
|
|
81
|
+
`QWEN_AUDIO_AGENT_FRONTEND_PROMPT_DIR` 下放置 `LIVE_PROMPT.md`;缺少此文件时使用内置
|
|
82
|
+
Live 规则,已存在但为空或不可读的文件则报错。
|
|
83
|
+
|
|
84
|
+
## 输入与结果回传
|
|
85
|
+
|
|
86
|
+
- **语音:**WebSocket 使用 Bearer 认证,上下行均为单声道 24 kHz PCM16。
|
|
87
|
+
近期文字历史在会话启动时传入。
|
|
88
|
+
- **文字和文件:**文字请求直接交给已配置的后台,简短文本摘要同步到 Live 上下文。
|
|
89
|
+
请把问题和相关图片、文件同次提交;附件按后台支持的能力传递,不走 GPT-Live 图像输入接口。
|
|
90
|
+
本集成暂不支持后续语音引用历史附件,Gateway 不会自动把全部历史文件交给后台。
|
|
91
|
+
- **进度与结果:**无需立即播报的进度使用 `session.thinking.append`,需要自然表达的内容使用
|
|
92
|
+
`session.commentary.append`。云端发起的任务保留对应委派 ID;本地发起的工作使用空委派 ID。
|
|
93
|
+
收到 append 回执只代表上下文被接收,不代表用户已经听到结果。
|
|
94
|
+
每次回传材料按上游长度限制做保守截断;完整结果保留在本地任务记录中。
|
|
95
|
+
- **自然插话:**Live 模型控制连续语音输出,已经生成的音频继续播放,不套用 Realtime 的语音起始清空逻辑。
|
|
96
|
+
文字输入和明确的停止操作可以要求模型停播,但不取消后台任务。
|
|
97
|
+
|
|
98
|
+
## 限制与验证边界
|
|
99
|
+
|
|
100
|
+
- 尚未实现口头授权。后台可能请求权限时,应使用具备权限确认控件的客户端。
|
|
101
|
+
- TUI 暂不支持后台结构化追问的表单答复,请在桌面端或 WebUI 任务卡片中填写。
|
|
102
|
+
- GPT-Live 不直接接收图片,本集成不协商实时视觉帧;后台能否理解图片取决于所选 Agent。
|
|
103
|
+
- 音频与转写时序受上游服务影响。本地轮次分段不是“用户已听到”或“操作已完成”的协议保证。
|
|
104
|
+
- Live 连接保持打开时,即使麦克风静音也可能产生服务费用;后台用量另计。
|
|
105
|
+
|
|
106
|
+
本地测试覆盖 Client 会话配置、委派与回传事件、任务隔离、明确授权,以及原有 Realtime 行为不受影响。
|
|
107
|
+
测试不替代账号可用性、模型行为、延迟与音色的线上验证。上游协议参见 OpenAI 的
|
|
108
|
+
[委派说明](https://developers.openai.com/api/docs/guides/live-delegation)。
|
|
109
|
+
|
|
110
|
+
## 继续阅读
|
|
111
|
+
|
|
112
|
+
- [OpenAI Realtime](openai-realtime.zh.md)
|
|
113
|
+
- [前台配置参考](../configuration/frontend.zh.md)
|
|
114
|
+
- [自定义 Provider](custom-provider.zh.md)
|