refactor: remove legacy assistant compatibility
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
/**
|
||||
* Workflow v3 edge: LLM judgement, variable expression, or deterministic default.
|
||||
* Workflow v4 edge: LLM judgement, variable expression, or deterministic default.
|
||||
*/
|
||||
|
||||
import {
|
||||
|
||||
@@ -18,7 +18,6 @@ import {
|
||||
} from "./context";
|
||||
import {
|
||||
accentVar,
|
||||
messageCompletionPolicy,
|
||||
type WorkflowNodeData,
|
||||
} from "./specs";
|
||||
|
||||
@@ -31,7 +30,7 @@ export function GenericNode({ id, type, data, selected }: NodeProps) {
|
||||
if (!spec) return null;
|
||||
|
||||
const nodeData = data as WorkflowNodeData;
|
||||
const messagePolicy = messageCompletionPolicy(nodeData);
|
||||
const messagePolicy = nodeData.completionPolicy ?? "playback";
|
||||
const Icon = spec.icon;
|
||||
const preview = (
|
||||
nodeData.prompt ||
|
||||
|
||||
@@ -6,10 +6,7 @@ import { SectionCard } from "@/components/editor/section-card";
|
||||
import { ToolBindingEditor } from "@/components/tools/tool-binding-editor";
|
||||
|
||||
import { NodeSelect } from "./controls";
|
||||
import {
|
||||
actionUserInputPolicy,
|
||||
type WorkflowNodeData,
|
||||
} from "../specs";
|
||||
import { type WorkflowNodeData } from "../specs";
|
||||
import type { ModelOption } from "../types";
|
||||
import type { DynamicVariableDefinition } from "@/lib/api";
|
||||
|
||||
@@ -28,7 +25,7 @@ export function ActionNodePanel({
|
||||
dynamicVariableDefinitions,
|
||||
runtimeMode,
|
||||
}: ActionNodePanelProps) {
|
||||
const userInputPolicy = actionUserInputPolicy(draft);
|
||||
const userInputPolicy = draft.userInputPolicy ?? "queue";
|
||||
|
||||
return (
|
||||
<SectionCard
|
||||
|
||||
@@ -87,7 +87,7 @@ export function GlobalSettingsPanel({
|
||||
? [{ value: "edge_tool", label: "边工具(Realtime 必需)" }]
|
||||
: [
|
||||
{ value: "edge_tool", label: "边工具(低延迟)" },
|
||||
{ value: "llm_router", label: "独立 LLM Router(兼容)" },
|
||||
{ value: "llm_router", label: "独立 LLM Router" },
|
||||
]
|
||||
}
|
||||
onChange={(llmRoutingMode) =>
|
||||
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
|
||||
import {
|
||||
messageCompletionPolicy,
|
||||
type MessageCompletionPolicy,
|
||||
type WorkflowNodeData,
|
||||
} from "../specs";
|
||||
@@ -51,17 +50,13 @@ export function MessageNodePanel({
|
||||
set: (key: string, value: unknown) => void;
|
||||
setPatch: (patch: Partial<WorkflowNodeData>) => void;
|
||||
}) {
|
||||
const completionPolicy = messageCompletionPolicy(draft);
|
||||
const completionPolicy = draft.completionPolicy ?? "playback";
|
||||
const completionDescription = COMPLETION_OPTIONS.find(
|
||||
(option) => option.value === completionPolicy,
|
||||
)?.description;
|
||||
|
||||
const selectCompletionPolicy = (value: MessageCompletionPolicy) => {
|
||||
setPatch({
|
||||
completionPolicy: value,
|
||||
requireConfirmation: undefined,
|
||||
showMessage: undefined,
|
||||
});
|
||||
setPatch({ completionPolicy: value });
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/** Workflow v3 public graph types and defaults. */
|
||||
/** Current Workflow graph types and defaults. */
|
||||
|
||||
import * as LucideIcons from "lucide-react";
|
||||
import { Circle, type LucideIcon } from "lucide-react";
|
||||
@@ -68,13 +68,9 @@ export type WorkflowNodeData = {
|
||||
updates?: StateUpdateRule[];
|
||||
userInputPolicy?: ActionUserInputPolicy;
|
||||
speech?: string;
|
||||
/** Legacy field read only while an older graph is open in the editor. */
|
||||
showMessage?: boolean;
|
||||
title?: string;
|
||||
confirmLabel?: string;
|
||||
completionPolicy?: MessageCompletionPolicy;
|
||||
/** Legacy field read only while an older graph is open in the editor. */
|
||||
requireConfirmation?: boolean;
|
||||
targetType?: "ai" | "human" | "queue" | "phone";
|
||||
target?: string;
|
||||
message?: string;
|
||||
@@ -82,27 +78,6 @@ export type WorkflowNodeData = {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
|
||||
/** Infer the new Message policy for graphs saved before it was explicit. */
|
||||
export function messageCompletionPolicy(
|
||||
data: WorkflowNodeData,
|
||||
): MessageCompletionPolicy {
|
||||
if (
|
||||
data.completionPolicy === "interruptible" ||
|
||||
data.completionPolicy === "playback" ||
|
||||
data.completionPolicy === "confirmation"
|
||||
) {
|
||||
return data.completionPolicy;
|
||||
}
|
||||
return data.requireConfirmation === true ? "confirmation" : "playback";
|
||||
}
|
||||
|
||||
/** Older Action nodes allowed input to continue, which matches queue. */
|
||||
export function actionUserInputPolicy(
|
||||
data: WorkflowNodeData,
|
||||
): ActionUserInputPolicy {
|
||||
return data.userInputPolicy === "block" ? "block" : "queue";
|
||||
}
|
||||
|
||||
export type ExpressionRule = {
|
||||
variable: string;
|
||||
operator: ExpressionOperator;
|
||||
|
||||
Reference in New Issue
Block a user