feat: add deterministic message interaction stages

This commit is contained in:
Xin Wang
2026-08-03 07:10:41 +08:00
parent 479a516546
commit 9daa46ed4d
26 changed files with 1356 additions and 414 deletions

View File

@@ -6,7 +6,13 @@ import { Circle, type LucideIcon } from "lucide-react";
import type { NodeSpecDto, TurnConfig } from "@/lib/api";
import { defaultTurnConfig } from "@/lib/turn-config";
export type WorkflowNodeType = "start" | "agent" | "action" | "handoff" | "end";
export type WorkflowNodeType =
| "start"
| "agent"
| "message"
| "action"
| "handoff"
| "end";
export type ContextPolicy = "inherit" | "fresh";
export type KnowledgeMode = "automatic" | "on_demand" | "disabled";
export type AgentEntryMode = "wait_user" | "generate" | "fixed_speech";
@@ -26,7 +32,6 @@ export type ExpressionOperator =
export type WorkflowNodeData = {
name: string;
greeting?: string;
prompt?: string;
contextPolicy?: ContextPolicy;
inheritGlobalConfig?: boolean;
@@ -49,6 +54,11 @@ export type WorkflowNodeData = {
resultAssignmentMode?: ActionResultAssignmentMode;
resultAssignments?: Record<string, string>;
userInputPolicy?: ActionUserInputPolicy;
speech?: string;
showMessage?: boolean;
title?: string;
confirmLabel?: string;
requireConfirmation?: boolean;
targetType?: "ai" | "human" | "queue" | "phone";
target?: string;
message?: string;
@@ -224,13 +234,26 @@ export function defaultGraph(): WorkflowGraph {
position: { x: 360, y: 60 },
data: {
name: "Start",
greeting: "你好,我是 AI 视频助手,有什么可以帮你?",
},
},
{
id: "message-1",
type: "message",
position: { x: 360, y: 260 },
data: {
name: "开场消息",
speech: "你好,我是 AI 视频助手,有什么可以帮你?",
showMessage: false,
title: "重要提示",
message: "",
confirmLabel: "确认",
requireConfirmation: false,
},
},
{
id: "agent-1",
type: "agent",
position: { x: 360, y: 300 },
position: { x: 360, y: 480 },
data: {
name: "Agent",
prompt: "了解用户需求并提供清晰、准确的帮助。",
@@ -243,7 +266,7 @@ export function defaultGraph(): WorkflowGraph {
{
id: "end",
type: "end",
position: { x: 360, y: 540 },
position: { x: 360, y: 700 },
data: {
name: "End",
message: "感谢你的来电,再见。",
@@ -253,8 +276,14 @@ export function defaultGraph(): WorkflowGraph {
],
edges: [
{
id: "e-start-agent",
id: "e-start-message",
source: "start",
target: "message-1",
data: { mode: "always", priority: 0 },
},
{
id: "e-message-agent",
source: "message-1",
target: "agent-1",
data: { mode: "always", priority: 0 },
},