Add workflow support and enhance runtime configuration in models and services

- Introduce RuntimeModelResource and RuntimeKnowledgeBase classes to manage workflow resources.
- Update AssistantConfig to include workflow_model_resources and workflow_knowledge_bases for better integration.
- Refactor validation and processing logic in routes and services to accommodate workflow types.
- Implement dynamic variable support for workflow assistants and enhance graph normalization.
- Add ToolExecutor for reusable tool execution across different assistant types.
- Update various services to ensure compatibility with new workflow features and improve error handling.
This commit is contained in:
Xin Wang
2026-07-13 16:13:27 +08:00
parent 6108b00007
commit 32aef14ddb
27 changed files with 2563 additions and 910 deletions
@@ -1,14 +1,13 @@
"use client";
/**
* 条件边。边携带 condition(自然语言条件,LLM 据此决定是否走这条路径)与
* label(日志里识别该路径的短标签)。悬停/选中时在标签旁显示「编辑 / 删除」按钮。
* Workflow v3 edge: LLM judgement, variable expression, or deterministic default.
*/
import {
BaseEdge,
EdgeLabelRenderer,
getSmoothStepPath,
getBezierPath,
type EdgeProps,
useReactFlow,
} from "@xyflow/react";
@@ -36,20 +35,22 @@ export function ConditionEdge({
// 点击标签:只选中这条边(露出编辑/删除按钮),不直接进入编辑。
const selectThisEdge = () =>
setEdges((eds) => eds.map((e) => ({ ...e, selected: e.id === id })));
const [path, labelX, labelY] = getSmoothStepPath({
const [path, labelX, labelY] = getBezierPath({
sourceX,
sourceY,
sourcePosition,
targetX,
targetY,
targetPosition,
borderRadius: 8,
offset: 20,
curvature: 0.28,
});
const label = ((data?.label as string) || (data?.condition as string) || "")
.toString()
.trim();
const mode = (data?.mode as string) || "always";
const label = (
(data?.label as string) ||
(mode === "llm" ? (data?.condition as string) : "") ||
(mode === "expression" ? "变量表达式" : "默认路径")
).toString().trim();
const expanded = hovered || selected;
return (