Refactor assistant configuration management and update documentation
- Removed legacy agent profile settings from the .env.example and README, streamlining the configuration process. - Introduced a new local YAML configuration adapter for assistant settings, allowing for easier management of assistant profiles. - Updated backend integration documentation to clarify the behavior of assistant config sourcing based on backend URL settings. - Adjusted various service implementations to directly utilize API keys from the new configuration structure. - Enhanced test coverage for the new local YAML adapter and its integration with backend services.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# py-active-call-cc
|
||||
# Realtime Agent Studio Engine
|
||||
|
||||
Python Active-Call: real-time audio streaming with WebSocket and WebRTC.
|
||||
This repo contains a Python 3.11+ codebase for building low-latency realtime human-agent interaction pipelines (capture, stream, and process audio) using WebSockets or WebRTC.
|
||||
|
||||
This repo contains a Python 3.11+ codebase for building low-latency voice
|
||||
pipelines (capture, stream, and process audio) using WebRTC and WebSockets.
|
||||
@@ -14,35 +14,11 @@ It is currently in an early, experimental stage.
|
||||
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
|
||||
```
|
||||
|
||||
使用 agent profile(推荐)
|
||||
|
||||
```
|
||||
python -m app.main --agent-profile default
|
||||
```
|
||||
|
||||
使用指定 YAML
|
||||
|
||||
```
|
||||
python -m app.main --agent-config config/agents/default.yaml
|
||||
```
|
||||
|
||||
Agent 配置路径优先级
|
||||
1. `--agent-config`
|
||||
2. `--agent-profile`(映射到 `config/agents/<profile>.yaml`)
|
||||
3. `AGENT_CONFIG_PATH`
|
||||
4. `AGENT_PROFILE`
|
||||
5. `config/agents/default.yaml`(若存在)
|
||||
|
||||
说明
|
||||
- Agent 相关配置是严格模式:YAML 缺少必须项会直接报错,不会回退到 `.env` 或代码默认值。
|
||||
- 如果要引用环境变量,请在 YAML 显式写 `${ENV_VAR}`。
|
||||
- `siliconflow` 独立 section 已移除;请在 `agent.llm / agent.tts / agent.asr` 内通过 `provider`、`api_key`、`api_url`、`model` 配置。
|
||||
- `agent.tts.provider` 现支持 `dashscope`(Realtime 协议,非 OpenAI-compatible);默认 URL 为 `wss://dashscope.aliyuncs.com/api-ws/v1/realtime`,默认模型为 `qwen3-tts-flash-realtime`。
|
||||
- `agent.tts.dashscope_mode`(兼容旧写法 `agent.tts.mode`)支持 `commit | server_commit`,且仅在 `provider=dashscope` 时生效:
|
||||
- `commit`:Engine 先按句切分,再逐句提交给 DashScope。
|
||||
- `server_commit`:Engine 不再逐句切分,由 DashScope 对整段文本自行切分。
|
||||
- 现在支持在 Agent YAML 中配置 `agent.tools`(列表),用于声明运行时可调用工具。
|
||||
- 工具配置示例见 `config/agents/tools.yaml`。
|
||||
- 启动阶段不再通过参数加载 Agent YAML。
|
||||
- 会话阶段统一按 `assistant_id` 拉取运行时配置:
|
||||
- 有 `BACKEND_URL`:从 backend API 获取。
|
||||
- 无 `BACKEND_URL`(或 `BACKEND_MODE=disabled`):从 `ASSISTANT_LOCAL_CONFIG_DIR/<assistant_id>.yaml` 获取。
|
||||
|
||||
## Backend Integration
|
||||
|
||||
@@ -50,6 +26,7 @@ Engine runtime now supports adapter-based backend integration:
|
||||
|
||||
- `BACKEND_MODE=auto|http|disabled`
|
||||
- `BACKEND_URL` + `BACKEND_TIMEOUT_SEC`
|
||||
- `ASSISTANT_LOCAL_CONFIG_DIR` (default `engine/config/agents`)
|
||||
- `HISTORY_ENABLED=true|false`
|
||||
|
||||
Behavior:
|
||||
@@ -58,6 +35,16 @@ Behavior:
|
||||
- `http`: force HTTP backend; falls back to engine-only mode when URL is missing.
|
||||
- `disabled`: force engine-only mode (no backend calls).
|
||||
|
||||
Assistant config source behavior:
|
||||
|
||||
- If `BACKEND_URL` is configured and backend mode is enabled, assistant config is loaded from backend API.
|
||||
- If `BACKEND_URL` is empty (or backend mode is disabled), assistant config is loaded from local YAML.
|
||||
|
||||
Local assistant YAML example:
|
||||
|
||||
- File path: `engine/config/agents/<assistant_id>.yaml`
|
||||
- Runtime still requires WebSocket query param `assistant_id`; it must match the local file name.
|
||||
|
||||
History write path is now asynchronous and buffered per session:
|
||||
|
||||
- `HISTORY_QUEUE_MAX_SIZE`
|
||||
@@ -84,3 +71,6 @@ python mic_client.py
|
||||
`/ws` uses a strict `v1` JSON control protocol with binary PCM audio frames.
|
||||
|
||||
See `docs/ws_v1_schema.md`.
|
||||
|
||||
# Reference
|
||||
* [active-call](https://github.com/restsend/active-call)
|
||||
|
||||
Reference in New Issue
Block a user