Add turn configuration support for assistants

- Introduce a new `turnConfig` field in `AssistantConfig` and `Assistant` models to manage user interaction settings.
- Implement `TurnConfig`, `BargeInConfig`, `VadConfig`, and `TurnDetectionConfig` schemas to define turn management strategies.
- Update the backend to handle turn configuration in the database and during assistant operations.
- Enhance frontend components with a `TurnConfigEditor` for configuring turn settings, including VAD and barge-in strategies.
- Modify existing pages to integrate turn configuration, improving user experience and interaction capabilities.
This commit is contained in:
Xin Wang
2026-07-12 11:08:19 +08:00
parent 00270a5c01
commit 01c563a3e7
13 changed files with 453 additions and 168 deletions

View File

@@ -150,6 +150,21 @@ export type AssistantType =
| "fastgpt"
| "opencode";
export type RuntimeMode = "pipeline" | "realtime";
export type TurnConfig = {
bargeIn: {
strategy: "vad" | "transcription";
};
vad: {
confidence: number;
startSecs: number;
stopSecs: number;
minVolume: number;
};
turnDetection: {
strategy: "silence" | "smart_turn";
silenceTimeoutSecs: number;
};
};
/** 后端 AssistantOut(宽表 STI:瘦字段平铺,workflow 用 graph)。apiKey 读时打码 */
export type Assistant = {
@@ -159,6 +174,7 @@ export type Assistant = {
runtimeMode: RuntimeMode;
greeting: string;
enableInterrupt: boolean;
turnConfig: TurnConfig;
visionEnabled: boolean;
visionModelResourceId: string | null;
modelResourceIds: Partial<Record<ModelType, string>>;