@stack-spot/ai-chat-widget 2.8.4 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/app-metadata.json +3 -3
- package/dist/chat-interceptors/quick-commands.js +2 -2
- package/dist/chat-interceptors/quick-commands.js.map +1 -1
- package/dist/views/Chat/ButtonExecutionDetail.d.ts +5 -0
- package/dist/views/Chat/ButtonExecutionDetail.d.ts.map +1 -0
- package/dist/views/Chat/ButtonExecutionDetail.js +34 -0
- package/dist/views/Chat/ButtonExecutionDetail.js.map +1 -0
- package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessage.js +9 -7
- package/dist/views/Chat/ChatMessage.js.map +1 -1
- package/dist/views/Steps/FlowChart/HandleGroup.d.ts +4 -1
- package/dist/views/Steps/FlowChart/HandleGroup.d.ts.map +1 -1
- package/dist/views/Steps/FlowChart/HandleGroup.js +1 -1
- package/dist/views/Steps/FlowChart/HandleGroup.js.map +1 -1
- package/dist/views/Steps/FlowChart/NodeDynamic.d.ts +15 -0
- package/dist/views/Steps/FlowChart/NodeDynamic.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/NodeDynamic.js +41 -0
- package/dist/views/Steps/FlowChart/NodeDynamic.js.map +1 -0
- package/dist/views/Steps/FlowChart/NodeStep.d.ts +4 -1
- package/dist/views/Steps/FlowChart/NodeStep.d.ts.map +1 -1
- package/dist/views/Steps/FlowChart/NodeStep.js +2 -2
- package/dist/views/Steps/FlowChart/NodeStep.js.map +1 -1
- package/dist/views/Steps/FlowChart/hooks.d.ts +7 -0
- package/dist/views/Steps/FlowChart/hooks.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/hooks.js +31 -0
- package/dist/views/Steps/FlowChart/hooks.js.map +1 -0
- package/dist/views/Steps/FlowChart/index.d.ts +4 -2
- package/dist/views/Steps/FlowChart/index.d.ts.map +1 -1
- package/dist/views/Steps/FlowChart/index.js +53 -23
- package/dist/views/Steps/FlowChart/index.js.map +1 -1
- package/dist/views/Steps/FlowChart/layout.d.ts +4 -13
- package/dist/views/Steps/FlowChart/layout.d.ts.map +1 -1
- package/dist/views/Steps/FlowChart/layout.js +25 -7
- package/dist/views/Steps/FlowChart/layout.js.map +1 -1
- package/dist/views/Steps/FlowChart/styled.d.ts +0 -1
- package/dist/views/Steps/FlowChart/styled.d.ts.map +1 -1
- package/dist/views/Steps/FlowChart/styled.js +39 -15
- package/dist/views/Steps/FlowChart/styled.js.map +1 -1
- package/dist/views/Steps/FlowChart/types.d.ts +14 -2
- package/dist/views/Steps/FlowChart/types.d.ts.map +1 -1
- package/dist/views/Steps/StepModal.d.ts +2 -1
- package/dist/views/Steps/StepModal.d.ts.map +1 -1
- package/dist/views/Steps/StepModal.js +24 -7
- package/dist/views/Steps/StepModal.js.map +1 -1
- package/dist/views/Steps/StepsPanel.d.ts.map +1 -1
- package/dist/views/Steps/StepsPanel.js +6 -2
- package/dist/views/Steps/StepsPanel.js.map +1 -1
- package/dist/views/Steps/dictionary.d.ts +5 -1
- package/dist/views/Steps/dictionary.d.ts.map +1 -1
- package/dist/views/Steps/dictionary.js +4 -0
- package/dist/views/Steps/dictionary.js.map +1 -1
- package/dist/views/Steps/utils.js +2 -2
- package/dist/views/Steps/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/app-metadata.json +3 -3
- package/src/chat-interceptors/quick-commands.ts +2 -2
- package/src/views/Chat/ButtonExecutionDetail.tsx +46 -0
- package/src/views/Chat/ChatMessage.tsx +10 -6
- package/src/views/Steps/FlowChart/HandleGroup.tsx +5 -3
- package/src/views/Steps/FlowChart/NodeDynamic.tsx +97 -0
- package/src/views/Steps/FlowChart/NodeStep.tsx +6 -4
- package/src/views/Steps/FlowChart/hooks.ts +41 -0
- package/src/views/Steps/FlowChart/index.tsx +67 -23
- package/src/views/Steps/FlowChart/layout.ts +39 -16
- package/src/views/Steps/FlowChart/styled.ts +39 -15
- package/src/views/Steps/FlowChart/types.ts +16 -2
- package/src/views/Steps/StepModal.tsx +36 -13
- package/src/views/Steps/StepsPanel.tsx +9 -2
- package/src/views/Steps/dictionary.ts +4 -0
- package/src/views/Steps/utils.tsx +2 -2
|
@@ -1,26 +1,51 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { listToClass, theme } from '@stack-spot/portal-theme';
|
|
3
|
-
import { Background, Controls, MarkerType, ReactFlow } from '@xyflow/react';
|
|
3
|
+
import { Background, Controls, MarkerType, ReactFlow, ReactFlowProvider, useReactFlow } from '@xyflow/react';
|
|
4
4
|
import '@xyflow/react/dist/style.css';
|
|
5
|
-
import {
|
|
5
|
+
import { last } from 'lodash';
|
|
6
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
7
|
import { useChatEntry } from '../../../context/hooks.js';
|
|
7
8
|
import { useLayoutedElements } from './layout.js';
|
|
9
|
+
import { NodeDynamic } from './NodeDynamic.js';
|
|
8
10
|
import { NodeStep } from './NodeStep.js';
|
|
9
|
-
import { FlowChartBox
|
|
10
|
-
const
|
|
11
|
-
planning: NodeStep,
|
|
12
|
-
step:
|
|
13
|
-
answer: NodeStep,
|
|
11
|
+
import { FlowChartBox } from './styled.js';
|
|
12
|
+
const NODE_TYPES = {
|
|
13
|
+
step: { planning: NodeStep, step: NodeStep, answer: NodeStep },
|
|
14
|
+
stepDynamic: { planning: NodeDynamic, step: NodeDynamic, answer: NodeDynamic },
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
+
const Flow = ({ message, onClick, direction = 'LR' }) => {
|
|
16
17
|
const steps = useChatEntry(message).steps;
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
const [nodeSizes, setNodeSizes] = useState({});
|
|
19
|
+
const reactFlowInstance = useReactFlow();
|
|
20
|
+
const isDynamic = useMemo(() => steps?.some((step) => step.id === 'dynamic'), [steps]);
|
|
21
|
+
const nodeTypes = useMemo(() => NODE_TYPES[isDynamic ? 'stepDynamic' : 'step'], [isDynamic]);
|
|
22
|
+
const handleNodeSizeChange = useCallback((id, size) => {
|
|
23
|
+
setNodeSizes((prev) => {
|
|
24
|
+
const current = prev[id];
|
|
25
|
+
if (current?.width === size.width && current?.height === size.height)
|
|
26
|
+
return prev;
|
|
27
|
+
return { ...prev, [id]: size };
|
|
28
|
+
});
|
|
29
|
+
}, []);
|
|
30
|
+
const baseElements = useMemo(() => {
|
|
31
|
+
const nodes = steps?.map((s, index) => {
|
|
32
|
+
const nodeSize = nodeSizes[s.id];
|
|
33
|
+
return {
|
|
34
|
+
id: s.id,
|
|
35
|
+
type: s.type,
|
|
36
|
+
focusable: false,
|
|
37
|
+
...(nodeSize && { width: nodeSize.width, height: nodeSize.height }),
|
|
38
|
+
origin: [1, 0],
|
|
39
|
+
data: {
|
|
40
|
+
message,
|
|
41
|
+
step: s,
|
|
42
|
+
index,
|
|
43
|
+
nextStatus: steps[index + 1]?.status,
|
|
44
|
+
onClick: (toolIndex) => onClick(s, toolIndex),
|
|
45
|
+
onResize: (size) => handleNodeSizeChange(s.id, size),
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}) ?? [];
|
|
24
49
|
const edges = [];
|
|
25
50
|
for (let i = 0; i < nodes.length - 1; i++) {
|
|
26
51
|
edges.push({
|
|
@@ -32,17 +57,22 @@ export const FlowChart = ({ message, onClick }) => {
|
|
|
32
57
|
markerEnd: {
|
|
33
58
|
type: MarkerType.Arrow,
|
|
34
59
|
strokeWidth: 2,
|
|
35
|
-
color:
|
|
60
|
+
color: theme.color.light[700],
|
|
36
61
|
},
|
|
37
62
|
});
|
|
38
63
|
}
|
|
39
64
|
return { nodes, edges };
|
|
40
|
-
}, [steps]);
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
65
|
+
}, [steps, nodeSizes, message, onClick, handleNodeSizeChange]);
|
|
66
|
+
const { nodes, edges } = useLayoutedElements(baseElements.nodes, baseElements.edges, direction);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
const lastNode = last(nodes);
|
|
69
|
+
const isRunning = lastNode?.data?.step?.status === 'running';
|
|
70
|
+
const shouldFitView = nodes.length > 2 && isRunning || (lastNode?.height ?? 0 > 180) && isRunning;
|
|
71
|
+
if (shouldFitView) {
|
|
72
|
+
reactFlowInstance.fitView({ duration: 1000, padding: { bottom: '120px', top: '20px' } });
|
|
73
|
+
}
|
|
74
|
+
}, [nodes, edges, reactFlowInstance]);
|
|
75
|
+
return (_jsx(FlowChartBox, { children: _jsxs(ReactFlow, { nodes: nodes, edges: edges, nodeTypes: nodeTypes, snapToGrid: true, fitView: true, maxZoom: 1, children: [_jsx(Controls, { orientation: "horizontal", className: "controls", showInteractive: false }), _jsx(Background, {})] }) }));
|
|
47
76
|
};
|
|
77
|
+
export const FlowChart = (props) => (_jsx(ReactFlowProvider, { children: _jsx(Flow, { ...props }) }));
|
|
48
78
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/views/Steps/FlowChart/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAQ,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/views/Steps/FlowChart/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAQ,UAAU,EAAE,SAAS,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAClH,OAAO,8BAA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AG,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,KAAK,SAAS,CAAA;QAC5D,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,IAAI,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC,GAAG,GAAG,CAAC,IAAI,SAAS,CAAA;QACjG,IAAI,aAAa,EAAE,CAAC;YAClB,iBAAiB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAG,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,CAAA;QAC3F,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAA;IAErC,OAAO,CACL,KAAC,YAAY,cACX,MAAC,SAAS,IACR,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,IAAI,EAChB,OAAO,QACP,OAAO,EAAE,CAAC,aAEV,KAAC,QAAQ,IAAC,WAAW,EAAC,YAAY,EAAC,SAAS,EAAC,UAAU,EAAC,eAAe,EAAE,KAAK,GAAI,EAClF,KAAC,UAAU,KAAG,IACJ,GACC,CAChB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAY,EAAE,EAAE,CAAC,CACzC,KAAC,iBAAiB,cAChB,KAAC,IAAI,OAAK,KAAK,GAAI,GACD,CACrB,CAAA"}
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
import { Edge } from '@xyflow/react';
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
sourcePosition: string;
|
|
7
|
-
position: {
|
|
8
|
-
x: number;
|
|
9
|
-
y: number;
|
|
10
|
-
};
|
|
11
|
-
id: string;
|
|
12
|
-
type: "step" | "planning" | "answer" | "tool";
|
|
13
|
-
data?: import("./types.js").NodeData;
|
|
14
|
-
}[];
|
|
2
|
+
import { NodeFullProps } from './types.js';
|
|
3
|
+
export type LayoutDirection = 'TB' | 'BT' | 'LR' | 'RL';
|
|
4
|
+
export declare function useLayoutedElements(nodes: NodeFullProps[], edges: Edge[], direction?: LayoutDirection): {
|
|
5
|
+
nodes: NodeFullProps[];
|
|
15
6
|
edges: Edge[];
|
|
16
7
|
};
|
|
17
8
|
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../src/views/Steps/FlowChart/layout.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../src/views/Steps/FlowChart/layout.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAY,MAAM,eAAe,CAAA;AAG9C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AASvC,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAevD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,SAAS,GAAE,eAAsB;;;EA2C3G"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import dagre from '@dagrejs/dagre';
|
|
2
|
+
import { Position } from '@xyflow/react';
|
|
2
3
|
import { useMemo } from 'react';
|
|
3
4
|
import { answerNodeSize, planningNodeSize, stepNodeSize } from './styled.js';
|
|
4
5
|
const nodesSizes = {
|
|
@@ -7,30 +8,47 @@ const nodesSizes = {
|
|
|
7
8
|
answer: answerNodeSize,
|
|
8
9
|
tool: stepNodeSize,
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
+
const getHandlePositions = (direction) => {
|
|
12
|
+
switch (direction) {
|
|
13
|
+
case 'TB':
|
|
14
|
+
return { target: Position.Top, source: Position.Bottom };
|
|
15
|
+
case 'BT':
|
|
16
|
+
return { target: Position.Bottom, source: Position.Top };
|
|
17
|
+
case 'LR':
|
|
18
|
+
return { target: Position.Left, source: Position.Right };
|
|
19
|
+
case 'RL':
|
|
20
|
+
return { target: Position.Right, source: Position.Left };
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
export function useLayoutedElements(nodes, edges, direction = 'LR') {
|
|
11
24
|
const dagreGraph = useMemo(() => new dagre.graphlib.Graph().setDefaultEdgeLabel(() => ({})), []);
|
|
12
25
|
return useMemo(() => {
|
|
13
|
-
dagreGraph.setGraph({ rankdir:
|
|
26
|
+
dagreGraph.setGraph({ rankdir: direction });
|
|
14
27
|
nodes.forEach((node) => {
|
|
15
28
|
const { width, height } = nodesSizes[node.type];
|
|
16
|
-
|
|
29
|
+
const nodeWidth = node.width ?? width;
|
|
30
|
+
const nodeHeight = node.height ?? height;
|
|
31
|
+
dagreGraph.setNode(node.id, { width: nodeWidth, height: nodeHeight });
|
|
17
32
|
});
|
|
18
33
|
edges.forEach((edge) => {
|
|
19
34
|
dagreGraph.setEdge(edge.source, edge.target);
|
|
20
35
|
});
|
|
21
36
|
dagre.layout(dagreGraph);
|
|
37
|
+
const { target, source } = getHandlePositions(direction);
|
|
22
38
|
const newNodes = nodes.map((node) => {
|
|
23
39
|
const { width, height } = nodesSizes[node.type];
|
|
40
|
+
const nodeWidth = node?.width ?? width;
|
|
41
|
+
const nodeHeight = node.height ?? height;
|
|
24
42
|
const nodeWithPosition = dagreGraph.node(node.id);
|
|
25
43
|
const newNode = {
|
|
26
44
|
...node,
|
|
27
|
-
targetPosition:
|
|
28
|
-
sourcePosition:
|
|
45
|
+
targetPosition: target,
|
|
46
|
+
sourcePosition: source,
|
|
29
47
|
// We are shifting the dagre node position (anchor=center center) to the top left
|
|
30
48
|
// so it matches the React Flow node anchor point (top left).
|
|
31
49
|
position: {
|
|
32
|
-
x: nodeWithPosition.x -
|
|
33
|
-
y: nodeWithPosition.y -
|
|
50
|
+
x: nodeWithPosition.x - nodeWidth / 2,
|
|
51
|
+
y: nodeWithPosition.y - nodeHeight / 2,
|
|
34
52
|
},
|
|
35
53
|
};
|
|
36
54
|
return newNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../../src/views/Steps/FlowChart/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../../src/views/Steps/FlowChart/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,gBAAgB,CAAA;AAClC,OAAO,EAAQ,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAGzE,MAAM,UAAU,GAAG;IACjB,IAAI,EAAE,YAAY;IAClB,QAAQ,EAAE,gBAAgB;IAC1B,MAAM,EAAE,cAAc;IACtB,IAAI,EAAE,YAAY;CACnB,CAAA;AAID,MAAM,kBAAkB,GAAG,CAAC,SAA0B,EAAE,EAAE;IACxD,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,IAAI;YACP,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAA;QAC1D,KAAK,IAAI;YACP,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAA;QAC1D,KAAK,IAAI;YACP,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAA;QAC1D,KAAK,IAAI;YACP,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,E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K,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAC/C,MAAM,SAAS,GAAG,IAAI,EAAE,KAAK,IAAI,KAAK,CAAA;YACtC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,IAAI,MAAM,CAAA;YACxC,MAAM,gBAAgB,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YACjD,MAAM,OAAO,GAAG;gBACd,GAAG,IAAI;gBACP,cAAc,EAAE,MAAM;gBACtB,cAAc,EAAE,MAAM;gBACtB,iFAAiF;gBACjF,6DAA6D;gBAC7D,QAAQ,EAAE;oBACR,CAAC,EAAE,gBAAgB,CAAC,CAAC,GAAG,SAAS,GAAG,CAAC;oBACrC,CAAC,EAAE,gBAAgB,CAAC,CAAC,GAAG,UAAU,GAAG,CAAC;iBACvC;aACF,CAAA;YAED,OAAO,OAAO,CAAA;QAChB,CAAC,CAAC,CAAA;QAEF,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;IACnC,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAA;AACpB,CAAC"}
|
|
@@ -10,6 +10,5 @@ export declare const answerNodeSize: {
|
|
|
10
10
|
width: number;
|
|
11
11
|
height: number;
|
|
12
12
|
};
|
|
13
|
-
export declare const runningColor = "#0097FA";
|
|
14
13
|
export declare const FlowChartBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
15
14
|
//# sourceMappingURL=styled.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../../src/views/Steps/FlowChart/styled.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY;;;CAA8B,CAAA;AACvD,eAAO,MAAM,gBAAgB;;;CAA6B,CAAA;AAC1D,eAAO,MAAM,cAAc;;;CAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../../src/views/Steps/FlowChart/styled.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY;;;CAA8B,CAAA;AACvD,eAAO,MAAM,gBAAgB;;;CAA6B,CAAA;AAC1D,eAAO,MAAM,cAAc;;;CAA6B,CAAA;AAExD,eAAO,MAAM,YAAY,wOAqJxB,CAAA"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { theme } from '@stack-spot/portal-theme';
|
|
2
2
|
import { styled } from 'styled-components';
|
|
3
|
-
export const stepNodeSize = { width:
|
|
4
|
-
export const planningNodeSize = { width:
|
|
5
|
-
export const answerNodeSize = { width:
|
|
6
|
-
export const runningColor = '#0097FA';
|
|
3
|
+
export const stepNodeSize = { width: 400, height: 167 };
|
|
4
|
+
export const planningNodeSize = { width: 400, height: 61 };
|
|
5
|
+
export const answerNodeSize = { width: 400, height: 40 };
|
|
7
6
|
export const FlowChartBox = styled.div `
|
|
8
7
|
width: 100%;
|
|
9
8
|
height: 100%;
|
|
@@ -17,31 +16,35 @@ export const FlowChartBox = styled.div `
|
|
|
17
16
|
border: 1px solid ${theme.color.light[600]};
|
|
18
17
|
background-color: ${theme.color.light[500]};
|
|
19
18
|
box-sizing: border-box;
|
|
20
|
-
justify-content: center;
|
|
21
|
-
|
|
22
|
-
&.running .source-handle {
|
|
23
|
-
background-color: ${runningColor};
|
|
24
|
-
}
|
|
19
|
+
justify-content: center;
|
|
20
|
+
width: 400px;
|
|
25
21
|
|
|
26
22
|
&.pending .source-handle {
|
|
27
23
|
opacity: 0.3;
|
|
28
24
|
}
|
|
29
25
|
|
|
26
|
+
.source-handle {
|
|
27
|
+
transition: opacity 1s ease; opacity: 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&.running .source-handle {
|
|
31
|
+
opacity: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
30
34
|
&.step {
|
|
31
35
|
width: ${stepNodeSize.width}px;
|
|
32
|
-
height: ${stepNodeSize.height}px;
|
|
36
|
+
min-height: ${stepNodeSize.height}px;
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
&.planning {
|
|
36
40
|
width: ${planningNodeSize.width}px;
|
|
37
|
-
height: ${planningNodeSize.height}px;
|
|
41
|
+
min-height: ${planningNodeSize.height}px;
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
&.answer {
|
|
41
45
|
width: ${answerNodeSize.width}px;
|
|
42
|
-
height: ${answerNodeSize.height}px;
|
|
46
|
+
min-height: ${answerNodeSize.height}px;
|
|
43
47
|
}
|
|
44
|
-
|
|
45
48
|
header {
|
|
46
49
|
display: flex;
|
|
47
50
|
gap: 4px;
|
|
@@ -69,7 +72,7 @@ export const FlowChartBox = styled.div `
|
|
|
69
72
|
flex-direction: column;
|
|
70
73
|
align-items: start;
|
|
71
74
|
justify-content: space-between;
|
|
72
|
-
gap:
|
|
75
|
+
gap: 8px;
|
|
73
76
|
overflow: hidden;
|
|
74
77
|
|
|
75
78
|
.step-description {
|
|
@@ -87,6 +90,28 @@ export const FlowChartBox = styled.div `
|
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
92
|
}
|
|
93
|
+
|
|
94
|
+
.wrapper-tool {
|
|
95
|
+
&:not(:last-child) {
|
|
96
|
+
border-bottom: 1px solid ${theme.color.light[600]};
|
|
97
|
+
padding-bottom: 8px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.tool {
|
|
101
|
+
padding: 8px;
|
|
102
|
+
border-radius: 4px;
|
|
103
|
+
min-height: 48px;
|
|
104
|
+
border: 1px solid ${theme.color.light[500]};
|
|
105
|
+
background-color: ${theme.color.light[400]};
|
|
106
|
+
border-bottom: 1px solid ${theme.color.light[300]};
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
|
|
109
|
+
&:hover .title {
|
|
110
|
+
text-decoration: underline;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
90
115
|
}
|
|
91
116
|
|
|
92
117
|
.source-handle {
|
|
@@ -119,7 +144,6 @@ export const FlowChartBox = styled.div `
|
|
|
119
144
|
opacity: 0.3;
|
|
120
145
|
}
|
|
121
146
|
&.running path {
|
|
122
|
-
stroke: ${runningColor};
|
|
123
147
|
stroke-dasharray: 5, 5;
|
|
124
148
|
}
|
|
125
149
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.js","sourceRoot":"","sources":["../../../../src/views/Steps/FlowChart/styled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE1C,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAA;AACvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;AAC1D,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"styled.js","sourceRoot":"","sources":["../../../../src/views/Steps/FlowChart/styled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE1C,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAA;AACvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;AAC1D,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;AAExD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;wBAUd,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;wBACtB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;eAkB/B,YAAY,CAAC,KAAK;oBACb,YAAY,CAAC,MAAM;;;;eAIxB,gBAAgB,CAAC,KAAK;oBACjB,gBAAgB,CAAC,MAAM;;;;eAI5B,cAAc,CAAC,KAAK;oBACf,cAAc,CAAC,MAAM;;;;;;;;;;;;;;;;eAgB1B,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;0BAKX,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCA6Bb,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;4BAQ7B,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;4BACtB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;mCACf,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;;;;wBAYjC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;wBAStB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;;;;;gBAa9B,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;CAerC,CAAA"}
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import { ChatStep } from '@stack-spot/portal-network';
|
|
2
|
+
import { Node } from '@xyflow/react';
|
|
3
|
+
import { ChatEntry } from '../../../state/ChatEntry.js';
|
|
4
|
+
export type NodeType = 'step' | 'planning' | 'answer' | 'tool';
|
|
2
5
|
export interface NodeData {
|
|
3
6
|
nextStatus: ChatStep['status'] | undefined;
|
|
4
|
-
onClick?: () => void;
|
|
7
|
+
onClick?: (toolIndex?: number) => void;
|
|
5
8
|
step: ChatStep;
|
|
6
9
|
index: number;
|
|
10
|
+
message: ChatEntry;
|
|
11
|
+
onResize?: (size: {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}) => void;
|
|
7
15
|
}
|
|
8
16
|
export interface NodeWithoutLayout {
|
|
9
17
|
id: string;
|
|
10
|
-
type:
|
|
18
|
+
type: NodeType;
|
|
11
19
|
data?: NodeData;
|
|
12
20
|
}
|
|
21
|
+
export type NodeDataFullProps = NodeData & Record<string, unknown>;
|
|
22
|
+
export interface NodeFullProps extends Node<NodeDataFullProps> {
|
|
23
|
+
type: NodeType;
|
|
24
|
+
}
|
|
13
25
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/views/Steps/FlowChart/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/views/Steps/FlowChart/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEpD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAA;AAE9D,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IAC3C,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC,EAAG,MAAM,KAAK,IAAI,CAAC;IACxC,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAC9D;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAElE,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,iBAAiB,CAAC;IAC5D,IAAI,EAAE,QAAQ,CAAC;CAChB"}
|
|
@@ -2,8 +2,9 @@ import { ChatEntry } from '../../state/ChatEntry.js';
|
|
|
2
2
|
interface Props {
|
|
3
3
|
message: ChatEntry;
|
|
4
4
|
stepId: string | undefined;
|
|
5
|
+
toolIndex?: number;
|
|
5
6
|
onClose: () => void;
|
|
6
7
|
}
|
|
7
|
-
export declare const StepModal: ({ message, stepId, onClose }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const StepModal: ({ message, stepId, toolIndex, onClose }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export {};
|
|
9
10
|
//# sourceMappingURL=StepModal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepModal.d.ts","sourceRoot":"","sources":["../../../src/views/Steps/StepModal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StepModal.d.ts","sourceRoot":"","sources":["../../../src/views/Steps/StepModal.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAIjD,UAAU,KAAK;IACb,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAiHD,eAAO,MAAM,SAAS,4CAA6C,KAAK,4CAmGvE,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
import { Badge, IconButton, Row, Text } from '@stack-spot/citric-react';
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Avatar, Badge, Divider, IconButton, Row, Text } from '@stack-spot/citric-react';
|
|
3
3
|
import { theme } from '@stack-spot/portal-theme';
|
|
4
|
+
import { isNil } from 'lodash';
|
|
4
5
|
import { useMemo, useState } from 'react';
|
|
5
6
|
import { styled } from 'styled-components';
|
|
6
7
|
import { Code } from '../../components/Code.js';
|
|
@@ -36,16 +37,26 @@ const StyledSection = styled.section `
|
|
|
36
37
|
align-items: start;
|
|
37
38
|
align-self: stretch;
|
|
38
39
|
gap: 6px;
|
|
39
|
-
background-color: ${theme.color.light[
|
|
40
|
+
background-color: ${theme.color.light[400]};
|
|
40
41
|
border-radius: 5px;
|
|
41
|
-
padding: 6px;
|
|
42
|
+
padding: 0 6px;
|
|
42
43
|
|
|
43
44
|
&:not(:last-child) {
|
|
44
45
|
border-bottom: 1px solid ${theme.color.light[500]};
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
hr {
|
|
49
|
+
margin: 16px 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.header-code {
|
|
53
|
+
background-color: ${theme.color.light[300]};
|
|
54
|
+
}
|
|
55
|
+
|
|
47
56
|
.tool-input {
|
|
48
57
|
align-self: stretch;
|
|
58
|
+
border: 1px solid ${theme.color.light[600]};
|
|
59
|
+
margin-top: 8px;
|
|
49
60
|
&, .highlighter {
|
|
50
61
|
background: ${theme.color.light[300]} !important;
|
|
51
62
|
}
|
|
@@ -109,14 +120,20 @@ const ExecutionBox = styled.div `
|
|
|
109
120
|
}
|
|
110
121
|
}
|
|
111
122
|
`;
|
|
112
|
-
export const StepModal = ({ message, stepId, onClose }) => {
|
|
123
|
+
export const StepModal = ({ message, stepId, toolIndex, onClose }) => {
|
|
113
124
|
const t = useStepsDictionary();
|
|
114
125
|
const entry = useChatEntry(message);
|
|
115
126
|
const [attempt, setAttempt] = useState(0);
|
|
116
127
|
const stepIndex = useMemo(() => entry.steps?.findIndex(s => s.id === stepId) ?? -1, [entry, stepId]);
|
|
117
128
|
const step = entry.steps?.[stepIndex];
|
|
118
|
-
const
|
|
119
|
-
const
|
|
129
|
+
const showSingleTool = !isNil(toolIndex);
|
|
130
|
+
const attemptTools = step?.type === 'step' ? step.attempts[attempt]?.tools : undefined;
|
|
131
|
+
const toolsToRender = showSingleTool && attemptTools ? [attemptTools[toolIndex]].filter(Boolean) : attemptTools;
|
|
132
|
+
const tools = toolsToRender?.map(tool => (_jsxs("div", { className: "tool", children: [!showSingleTool && _jsx(ToolBadge, { name: tool.name ?? '', duration: tool.duration, image: tool.image, description: tool.description }), tool.input && _jsxs(_Fragment, { children: [_jsx(Badge, { appearance: "square", colorPalette: "cyan", children: t.input }), _jsx(Code, { language: "json", className: "tool-input", showLineNumbers: false, showActionBar: true, children: tool.input })] }), tool.output && _jsxs(_Fragment, { children: [_jsx(Divider, {}), _jsx(Badge, { appearance: "square", colorPalette: "cyan", children: t.response }), _jsx(Code, { language: "json", className: "tool-input", showLineNumbers: false, showActionBar: true, children: tool.output })] })] }, tool.id)));
|
|
133
|
+
const singleTool = showSingleTool ? toolsToRender?.[0] : undefined;
|
|
134
|
+
const title = (showSingleTool
|
|
135
|
+
? _jsxs(Row, { flex: 1, gap: "8px", children: [!!singleTool?.name && _jsx(Avatar, { size: "xxs", image: singleTool?.image, name: singleTool?.name }), _jsx(Text, { appearance: "h6", children: singleTool?.name ?? t.finalAnswer })] })
|
|
136
|
+
: _jsxs(Row, { flex: 1, justifyContent: "space-between", children: [_jsx(Text, { appearance: "h6", children: getTitle(t, step, stepIndex) }), _jsxs(ExecutionBox, { children: [_jsxs(Text, { className: "time", appearance: "microtext1", children: [step?.status === 'running' && t.running, step?.status === 'pending' && t.pending, step?.status === 'success' && `${t.executionTime}: ${step?.duration ? `${toPrecision(step?.duration)}s` : t.unknown}`] }), step?.type === 'step' && step.attempts.length > 1 && _jsxs("div", { className: "navigator", children: [attempt > 0 && (_jsx(IconButton, { icon: "ChevronLeft", size: "xs", title: t.previousAttempt, "aria-label": t.previousAttempt, onClick: () => setAttempt(attempt - 1) })), _jsxs(Text, { appearance: "microtext1", children: [attempt + 1, "/", step.attempts.length] }), attempt < step.attempts.length - 1 && (_jsx(IconButton, { icon: "ChevronRight", size: "xs", title: t.nextAttempt, "aria-label": t.nextAttempt, onClick: () => setAttempt(attempt + 1) }))] })] })] }));
|
|
120
137
|
return (_jsxs(Modal, { open: !!step, onClose: onClose, title: title, children: [step?.type === 'answer' && _jsx(StyledSection, { className: "restrict-image-size", children: entry.type === 'md' ? _jsx(Markdown, { children: entry.content }) : _jsx(Text, { children: entry.content }) }), step?.type === 'planning' && _jsxs(StyledSection, { style: { alignItems: 'stretch' }, children: [_jsx(Badge, { appearance: "square", colorPalette: "blue", style: { alignSelf: 'start' }, children: "Prompt" }), _jsx(Text, { children: step.goal }), _jsx("ul", { className: "steps", children: entry.steps?.filter(s => s.type === 'step').map((s, index) => (_jsxs("li", { children: [_jsx(Row, { mb: 2, children: _jsxs(Text, { children: [t.step, " ", index + 1, ": ", _jsx("span", { className: "step-description", children: s.input })] }) }), !!s.attempts[0].tools?.length && _jsx("ul", { className: "side-by-side-tools", children: s.attempts[0].tools.map((tool) => (_jsx("li", { children: _jsx(ToolBadge, { name: tool.name ?? '', image: tool.image }) }, tool.id))) })] }, index))) })] }), step?.type === 'step' && step?.input && _jsxs(StyledSection, { children: [_jsx(Badge, { appearance: "square", colorPalette: "blue", children: "Prompt" }), _jsx(Text, { children: step.input })] }), !!tools?.length && _jsx(StyledSection, { children: tools })] }));
|
|
121
138
|
};
|
|
122
139
|
//# sourceMappingURL=StepModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepModal.js","sourceRoot":"","sources":["../../../src/views/Steps/StepModal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"StepModal.js","sourceRoot":"","sources":["../../../src/views/Steps/StepModal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAExF,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC9B,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAS/C,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;wBA0BZ,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;iCAKb,KAAK,CAAC,KAAK,CAAC,KAAK,CA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/StepsPanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StepsPanel.d.ts","sourceRoot":"","sources":["../../../src/views/Steps/StepsPanel.tsx"],"names":[],"mappings":"AAQA,QAAA,MAAM,UAAU,0BAA2B;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,mDAoB/E,CAAA;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/* eslint-disable import/no-default-export */
|
|
3
2
|
import { useMemo, useState } from 'react';
|
|
4
3
|
import { useWidget } from '../../context/hooks.js';
|
|
5
4
|
import { FlowChart } from './FlowChart/index.js';
|
|
6
5
|
import { StepModal } from './StepModal.js';
|
|
7
6
|
const StepsPanel = ({ chatId, messageId }) => {
|
|
8
7
|
const [currentStepId, setCurrentStepId] = useState();
|
|
8
|
+
const [toolIndex, setToolIndex] = useState();
|
|
9
9
|
const widget = useWidget();
|
|
10
10
|
const message = useMemo(() => widget.chatTabs.getAll().find(c => c.id === chatId)?.getMessages().find(m => m.id === messageId), [chatId, messageId]);
|
|
11
|
-
|
|
11
|
+
const handleClick = (step, tooIndex) => {
|
|
12
|
+
setCurrentStepId(step.id);
|
|
13
|
+
setToolIndex(tooIndex);
|
|
14
|
+
};
|
|
15
|
+
return message ? (_jsxs(_Fragment, { children: [_jsx(FlowChart, { message: message, onClick: handleClick, direction: "TB" }), _jsx(StepModal, { message: message, stepId: currentStepId, toolIndex: toolIndex, onClose: () => setCurrentStepId(undefined) })] })) : null;
|
|
12
16
|
};
|
|
13
17
|
export default StepsPanel;
|
|
14
18
|
//# sourceMappingURL=StepsPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepsPanel.js","sourceRoot":"","sources":["../../../src/views/Steps/StepsPanel.tsx"],"names":[],"mappings":";
|
|
1
|
+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AE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,SAAS,CAAC,GAAI,IACvH,CACJ,CAAC,CAAC,CAAC,IAAI,CAAA;AACV,CAAC,CAAA;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -16,6 +16,8 @@ export declare const dictionary: {
|
|
|
16
16
|
open: string;
|
|
17
17
|
close: string;
|
|
18
18
|
input: string;
|
|
19
|
+
finalAnswer: string;
|
|
20
|
+
userPrompt: string;
|
|
19
21
|
};
|
|
20
22
|
pt: {
|
|
21
23
|
stepsPanelDescription: string;
|
|
@@ -32,8 +34,10 @@ export declare const dictionary: {
|
|
|
32
34
|
nextAttempt: string;
|
|
33
35
|
previousAttempt: string;
|
|
34
36
|
input: string;
|
|
37
|
+
finalAnswer: string;
|
|
38
|
+
userPrompt: string;
|
|
35
39
|
};
|
|
36
40
|
};
|
|
37
|
-
export declare function useStepsDictionary(): Record<"pending" | "input" | "step" | "steps" | "answer" | "running" | "tools" | "planning" | "unknown" | "stepsPanelDescription" | "response" | "executionTime" | "nextAttempt" | "previousAttempt", string>;
|
|
41
|
+
export declare function useStepsDictionary(): Record<"pending" | "input" | "step" | "steps" | "answer" | "running" | "tools" | "planning" | "unknown" | "stepsPanelDescription" | "response" | "executionTime" | "nextAttempt" | "previousAttempt" | "finalAnswer" | "userPrompt", string>;
|
|
38
42
|
export type ToolsDictionary = typeof dictionary['en'];
|
|
39
43
|
//# sourceMappingURL=dictionary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../src/views/Steps/dictionary.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../src/views/Steps/dictionary.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCD,CAAA;AAEtB,wBAAgB,kBAAkB,iPAEjC;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,UAAU,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -17,6 +17,8 @@ export const dictionary = {
|
|
|
17
17
|
open: 'Open',
|
|
18
18
|
close: 'Close',
|
|
19
19
|
input: 'Input',
|
|
20
|
+
finalAnswer: 'Final answer',
|
|
21
|
+
userPrompt: 'User prompt',
|
|
20
22
|
},
|
|
21
23
|
pt: {
|
|
22
24
|
stepsPanelDescription: 'Os passos e ferramentas usados para chegar na resposta',
|
|
@@ -33,6 +35,8 @@ export const dictionary = {
|
|
|
33
35
|
nextAttempt: 'Próxima execução',
|
|
34
36
|
previousAttempt: 'Execução anterior',
|
|
35
37
|
input: 'Entrada',
|
|
38
|
+
finalAnswer: 'Resposta final',
|
|
39
|
+
userPrompt: 'Prompt do usuário',
|
|
36
40
|
},
|
|
37
41
|
};
|
|
38
42
|
export function useStepsDictionary() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../../../src/views/Steps/dictionary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAEvE,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,EAAE,EAAE;QACF,qBAAqB,EAAE,8CAA8C;QACrE,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,cAAc;QACtB,aAAa,EAAE,MAAM;QACrB,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,SAAS;QAClB,WAAW,EAAE,gBAAgB;QAC7B,eAAe,EAAE,oBAAoB;QACrC,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,OAAO;
|
|
1
|
+
{"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../../../src/views/Steps/dictionary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAEvE,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,EAAE,EAAE;QACF,qBAAqB,EAAE,8CAA8C;QACrE,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,cAAc;QACtB,aAAa,EAAE,MAAM;QACrB,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,SAAS;QAClB,WAAW,EAAE,gBAAgB;QAC7B,eAAe,EAAE,oBAAoB;QACrC,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,cAAc;QAC3B,UAAU,EAAE,aAAa;KAC1B;IACD,EAAE,EAAE;QACF,qBAAqB,EAAE,wDAAwD;QAC/E,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,aAAa;QACpB,QAAQ,EAAE,cAAc;QACxB,MAAM,EAAE,gBAAgB;QACxB,aAAa,EAAE,OAAO;QACtB,OAAO,EAAE,cAAc;QACvB,OAAO,EAAE,YAAY;QACrB,OAAO,EAAE,YAAY;QACrB,WAAW,EAAE,kBAAkB;QAC/B,eAAe,EAAE,mBAAmB;QACpC,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,gBAAgB;QAC7B,UAAU,EAAE,mBAAmB;KAChC;CACmB,CAAA;AAEtB,MAAM,UAAU,kBAAkB;IAChC,OAAO,YAAY,CAAC,UAAU,CAAC,CAAA;AACjC,CAAC"}
|
|
@@ -12,8 +12,8 @@ export function getStatusIcon(status) {
|
|
|
12
12
|
}
|
|
13
13
|
export function getTypeIcon(type) {
|
|
14
14
|
switch (type) {
|
|
15
|
-
case 'planning': return { group: '
|
|
16
|
-
default: return { group: '
|
|
15
|
+
case 'planning': return { group: 'fill', icon: 'ChevronRight' };
|
|
16
|
+
default: return { group: 'outline', icon: 'StackSpot' };
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
export function getTitle(translation, step, index) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/views/Steps/utils.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAY,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAEhD,MAAM,UAAU,aAAa,CAAC,MAA0B;IACtD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,SAAS,CAAC,CAAC,OAAO,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,aAAa,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,GAAI,CAAA;QAC3G,KAAK,OAAO,CAAC,CAAC,OAAO,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,aAAa,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAI,CAAA;QACxG,KAAK,SAAS,CAAC,CAAC,OAAO,KAAC,gBAAgB,IAAC,WAAW,EAAC,SAAS,EAAC,IAAI,EAAC,IAAI,GAAG,CAAA;QAC3E,OAAO,CAAC,CAAC,OAAO,IAAI,CAAA;IACtB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAsB;IAChD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,UAAU,CAAC,CAAC,OAAO,EAAE,KAAK,EAA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