Merge branch 'refs/heads/develop' into fix/memory_bug_fix

This commit is contained in:
lixinyue
2026-01-14 14:47:15 +08:00
5 changed files with 61 additions and 45 deletions

View File

@@ -583,7 +583,7 @@ async def chat(
event_data = event.get("data", {})
# 转换为标准 SSE 格式(字符串)
sse_message = f"event: {event_type}\ndata: {json.dumps(event_data)}\n\n"
sse_message = f"event: {event_type}\ndata: {json.dumps(event_data, default=str, ensure_ascii=False)}\n\n"
yield sse_message
return StreamingResponse(

View File

@@ -226,6 +226,7 @@ class LLMNode(BaseNode):
Yields:
文本片段chunk或完成标记
"""
self.typed_config = LLMNodeConfig(**self.config)
from langgraph.config import get_stream_writer
llm, prompt_or_messages = self._prepare_llm(state, True)

View File

@@ -1416,11 +1416,10 @@ async def analytics_graph_data(
elementId(n) as id,
labels(n)[0] as label,
properties(n) as properties
LIMIT $limit
"""
node_params = {
"group_id": end_user_id,
"limit": limit
# "limit": limit
}
# 执行节点查询

View File

@@ -502,16 +502,44 @@ interface NodeConfig {
ports?: PortsConfig;
}
const portAttrs = {
circle: {
r: 4, magnet: true, stroke: '#155EEF', strokeWidth: 2, fill: '#155EEF', position: { top: 22 }
// 统一的端口 markup 配置
export const portMarkup = [
{
tagName: 'circle',
selector: 'body',
},
{
tagName: 'text',
selector: 'label',
},
];
// 统一的端口属性配置
export const portAttrs = {
body: {
r: 6,
magnet: true,
stroke: '#155EEF',
strokeWidth: 2,
fill: '#155EEF',
},
label: {
text: '+',
fontSize: 12,
fontWeight: 'bold',
fill: '#FFFFFF',
textAnchor: 'middle',
textVerticalAnchor: 'middle',
pointerEvents: 'none',
}
}
// 统一的端口组配置
const defaultPortGroups = {
// top: { position: 'top', attrs: portAttrs },
right: { position: 'right', attrs: portAttrs },
// bottom: { position: 'bottom', attrs: portAttrs },
left: { position: 'left', attrs: portAttrs },
// top: { position: 'top', markup: portMarkup, attrs: portAttrs },
right: { position: 'right', markup: portMarkup, attrs: portAttrs },
// bottom: { position: 'bottom', markup: portMarkup, attrs: portAttrs },
left: { position: 'left', markup: portMarkup, attrs: portAttrs },
}
const defaultPortItems = [
// { group: 'top' },
@@ -569,7 +597,7 @@ export const graphNodeLibrary: Record<string, NodeConfig> = {
height: 64,
shape: 'normal-node',
ports: {
groups: {right: { position: 'right', attrs: portAttrs }},
groups: {right: { position: 'right', markup: portMarkup, attrs: portAttrs }},
items: [{ group: 'right' }],
},
},
@@ -578,7 +606,7 @@ export const graphNodeLibrary: Record<string, NodeConfig> = {
height: 64,
shape: 'normal-node',
ports: {
groups: {left: { position: 'left', attrs: portAttrs }},
groups: {left: { position: 'left', markup: portMarkup, attrs: portAttrs }},
items: [{ group: 'left' }],
},
},
@@ -587,7 +615,7 @@ export const graphNodeLibrary: Record<string, NodeConfig> = {
height: 44,
shape: 'cycle-start',
ports: {
groups: {right: { position: 'right', attrs: portAttrs }},
groups: {right: { position: 'right', markup: portMarkup, attrs: portAttrs }},
items: [{ group: 'right' }],
},
},
@@ -596,7 +624,7 @@ export const graphNodeLibrary: Record<string, NodeConfig> = {
height: 44,
shape: 'add-node',
ports: {
groups: {left: { position: 'left', attrs: portAttrs }},
groups: {left: { position: 'left', markup: portMarkup, attrs: portAttrs }},
items: [{ group: 'left' }],
},
},
@@ -614,7 +642,7 @@ export const graphNodeLibrary: Record<string, NodeConfig> = {
height: 44,
shape: 'cycle-start',
ports: {
groups: {right: { position: 'right', attrs: portAttrs }},
groups: {right: { position: 'right', markup: portMarkup, attrs: portAttrs }},
items: [{ group: 'right' }],
},
},
@@ -623,7 +651,7 @@ export const graphNodeLibrary: Record<string, NodeConfig> = {
height: 44,
shape: 'add-node',
ports: {
groups: {left: { position: 'left', attrs: portAttrs }},
groups: {left: { position: 'left', markup: portMarkup, attrs: portAttrs }},
items: [{ group: 'left' }],
},
}

View File

@@ -5,7 +5,7 @@ import { App } from 'antd'
import { Graph, Node, MiniMap, Snapline, Clipboard, Keyboard, type Edge } from '@antv/x6';
import { register } from '@antv/x6-react-shape';
import { nodeRegisterLibrary, graphNodeLibrary, nodeLibrary } from '../constant';
import { nodeRegisterLibrary, graphNodeLibrary, nodeLibrary, portMarkup, portAttrs } from '../constant';
import type { WorkflowConfig, NodeProperties } from '../types';
import { getWorkflowConfig, saveWorkflowConfig } from '@/api/application'
import type { PortMetadata } from '@antv/x6/lib/model/port';
@@ -39,7 +39,6 @@ export interface UseWorkflowGraphReturn {
export const edge_color = '#155EEF';
const edge_selected_color = '#4DA8FF'
export const useWorkflowGraph = ({
containerRef,
miniMapRef,
@@ -128,12 +127,6 @@ export const useWorkflowGraph = ({
const baseHeight = 88;
const newHeight = baseHeight + (totalPorts - 2) * 30;
const portAttrs = {
circle: {
r: 4, magnet: true, stroke: '#155EEF', strokeWidth: 2, fill: '#155EEF', position: { top: 22 }
},
};
const portItems: PortMetadata[] = [
{ group: 'left' },
{ group: 'right', id: 'CASE1', args: { dy: 24 }, attrs: { text: { text: 'IF', fontSize: 12, fill: '#5B6167' }} }
@@ -157,8 +150,8 @@ export const useWorkflowGraph = ({
nodeConfig.ports = {
groups: {
right: { position: 'right', attrs: portAttrs },
left: { position: 'left', attrs: portAttrs },
right: { position: 'right', markup: portMarkup, attrs: portAttrs },
left: { position: 'left', markup: portMarkup, attrs: portAttrs },
},
items: portItems
};
@@ -172,12 +165,6 @@ export const useWorkflowGraph = ({
const baseHeight = 88;
const newHeight = baseHeight + (categoryCount - 1) * 30;
const portAttrs = {
circle: {
r: 4, magnet: true, stroke: '#155EEF', strokeWidth: 2, fill: '#155EEF', position: { top: 22 }
},
};
const portItems: PortMetadata[] = [
{ group: 'left' }
];
@@ -194,8 +181,8 @@ export const useWorkflowGraph = ({
nodeConfig.ports = {
groups: {
right: { position: 'right', attrs: portAttrs },
left: { position: 'left', attrs: portAttrs },
right: { position: 'right', markup: portMarkup, attrs: portAttrs },
left: { position: 'left', markup: portMarkup, attrs: portAttrs },
},
items: portItems
};
@@ -205,16 +192,10 @@ export const useWorkflowGraph = ({
// 如果是http-request节点检查error_handle.method配置
if (type === 'http-request' && (config as any).error_handle?.method === 'branch') {
const portAttrs = {
circle: {
r: 4, magnet: true, stroke: '#155EEF', strokeWidth: 2, fill: '#155EEF', position: { top: 22 }
},
};
nodeConfig.ports = {
groups: {
right: { position: 'right', attrs: portAttrs },
left: { position: 'left', attrs: portAttrs },
right: { position: 'right', markup: portMarkup, attrs: portAttrs },
left: { position: 'left', markup: portMarkup, attrs: portAttrs },
},
items: [
{ group: 'left' },
@@ -344,13 +325,15 @@ export const useWorkflowGraph = ({
cell: targetCell.id,
port: targetPorts.find((port: any) => port.group === 'left')?.id || 'left'
},
connector: { name: 'smooth' },
attrs: {
line: {
stroke: edge_color,
strokeWidth: 1,
targetMarker: {
name: 'block',
size: 8,
name: 'diamond',
width: 4,
height: 4,
},
},
},
@@ -703,7 +686,7 @@ export const useWorkflowGraph = ({
// router: 'orth',
// router: 'manhattan',
connector: {
name: 'rounded',
name: 'smooth',
args: {
radius: 8,
},
@@ -723,6 +706,11 @@ export const useWorkflowGraph = ({
line: {
stroke: edge_color,
strokeWidth: 1,
targetMarker: {
name: 'diamond',
width: 4,
height: 4,
},
},
},
zIndex: 0,