Add dynamic variable support to Assistant model and related components
- Introduce dynamic variable definitions in AssistantConfig and Assistant models, allowing for flexible prompt customization. - Implement validation for dynamic variable names and types in the schema. - Update backend services and routes to handle dynamic variables in assistant configurations and runtime processing. - Enhance frontend components to support dynamic variable definitions, including a new editor for managing variables. - Add tests to ensure proper functionality and validation of dynamic variables in various scenarios.
This commit is contained in:
@@ -158,6 +158,27 @@ docker compose --profile remote up -d
|
||||
当前后台处理使用 FastAPI 进程内任务,适合 MVP。服务重启时未完成任务会转为失败,
|
||||
可在页面重试;需要多实例或高吞吐时再迁移到 Redis/ARQ worker。
|
||||
|
||||
## Prompt 动态变量
|
||||
|
||||
提示词助手的 Pipeline 与 Realtime 模式都支持在开场白和系统提示词中使用
|
||||
`{{ variable_name }}`。Pipeline 模式还支持在 HTTP 工具的 URL、Header 和 Body
|
||||
中引用变量。助手页维护变量类型、默认值和必填规则;调试面板在每次通话开始前
|
||||
传入会话值。Realtime 会把渲染后的提示词作为模型 instructions。
|
||||
|
||||
内置系统变量包括 `system__conversation_id`、`system__time`、
|
||||
`system__agent_turns` 和 `system__conversation_history`。客户端不能提交
|
||||
`system__*` 或 `secret__*`。HTTP 工具的密钥变量必须在工具的服务端密钥配置中
|
||||
以 `secret__` 开头声明,而且只能用于 Header。
|
||||
|
||||
HTTP 工具可通过“响应变量赋值”把 JSON 路径写回普通会话变量,例如:
|
||||
|
||||
```json
|
||||
{"order_status": "response.order.status"}
|
||||
```
|
||||
|
||||
后续轮次会使用新值重新渲染系统提示词。上线前执行 `make db-migrate`,应用
|
||||
`20260712_0007` 迁移。
|
||||
|
||||
## 待联调 / TODO
|
||||
|
||||
- [ ] 联调 Pipecat 1.3.0 语音链路与各 OpenAI 兼容服务
|
||||
|
||||
Reference in New Issue
Block a user