balibabu
commited on
Commit
·
1b32c2b
1
Parent(s):
f2439de
Feat: Display the input parameters of begin in the output result table #3355 (#3534)
Browse files### What problem does this PR solve?
Feat: Display the input parameters of begin in the output result table
#3355
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
web/src/pages/flow/canvas/node/popover.tsx
CHANGED
@@ -3,7 +3,7 @@ import get from 'lodash/get';
|
|
3 |
import React, { MouseEventHandler, useCallback, useMemo } from 'react';
|
4 |
import JsonView from 'react18-json-view';
|
5 |
import 'react18-json-view/src/style.css';
|
6 |
-
import { useReplaceIdWithText } from '../../hooks';
|
7 |
|
8 |
import {
|
9 |
Popover,
|
@@ -39,11 +39,13 @@ export function NextNodePopover({ children, nodeId, name }: IProps) {
|
|
39 |
[],
|
40 |
);
|
41 |
const output = get(component, ['obj', 'params', 'output'], {});
|
42 |
-
const { replacedOutput
|
43 |
const stopPropagation: MouseEventHandler = useCallback((e) => {
|
44 |
e.stopPropagation();
|
45 |
}, []);
|
46 |
|
|
|
|
|
47 |
return (
|
48 |
<Popover>
|
49 |
<PopoverTrigger onClick={stopPropagation} asChild>
|
@@ -73,7 +75,7 @@ export function NextNodePopover({ children, nodeId, name }: IProps) {
|
|
73 |
<TableBody>
|
74 |
{inputs.map((x, idx) => (
|
75 |
<TableRow key={idx}>
|
76 |
-
<TableCell>{
|
77 |
<TableCell className="truncate">{x.content}</TableCell>
|
78 |
</TableRow>
|
79 |
))}
|
|
|
3 |
import React, { MouseEventHandler, useCallback, useMemo } from 'react';
|
4 |
import JsonView from 'react18-json-view';
|
5 |
import 'react18-json-view/src/style.css';
|
6 |
+
import { useGetComponentLabelByValue, useReplaceIdWithText } from '../../hooks';
|
7 |
|
8 |
import {
|
9 |
Popover,
|
|
|
39 |
[],
|
40 |
);
|
41 |
const output = get(component, ['obj', 'params', 'output'], {});
|
42 |
+
const { replacedOutput } = useReplaceIdWithText(output);
|
43 |
const stopPropagation: MouseEventHandler = useCallback((e) => {
|
44 |
e.stopPropagation();
|
45 |
}, []);
|
46 |
|
47 |
+
const getLabel = useGetComponentLabelByValue(nodeId);
|
48 |
+
|
49 |
return (
|
50 |
<Popover>
|
51 |
<PopoverTrigger onClick={stopPropagation} asChild>
|
|
|
75 |
<TableBody>
|
76 |
{inputs.map((x, idx) => (
|
77 |
<TableRow key={idx}>
|
78 |
+
<TableCell>{getLabel(x.component_id)}</TableCell>
|
79 |
<TableCell className="truncate">{x.content}</TableCell>
|
80 |
</TableRow>
|
81 |
))}
|
web/src/pages/flow/chat/hooks.ts
CHANGED
@@ -55,6 +55,7 @@ export const useSendNextMessage = () => {
|
|
55 |
} = useSelectNextMessages();
|
56 |
const { id: flowId } = useParams();
|
57 |
const { handleInputChange, value, setValue } = useHandleMessageInputChange();
|
|
|
58 |
|
59 |
const { send, answer, done } = useSendMessageWithSse(api.runCanvas);
|
60 |
|
@@ -75,9 +76,11 @@ export const useSendNextMessage = () => {
|
|
75 |
// cancel loading
|
76 |
setValue(message.content);
|
77 |
removeLatestMessage();
|
|
|
|
|
78 |
}
|
79 |
},
|
80 |
-
[flowId,
|
81 |
);
|
82 |
|
83 |
const handleSendMessage = useCallback(
|
@@ -112,8 +115,10 @@ export const useSendNextMessage = () => {
|
|
112 |
const sendRet = await send({ id: flowId });
|
113 |
if (receiveMessageError(sendRet)) {
|
114 |
message.error(sendRet?.data?.message);
|
|
|
|
|
115 |
}
|
116 |
-
}, [flowId, send]);
|
117 |
|
118 |
useEffect(() => {
|
119 |
fetchPrologue();
|
|
|
55 |
} = useSelectNextMessages();
|
56 |
const { id: flowId } = useParams();
|
57 |
const { handleInputChange, value, setValue } = useHandleMessageInputChange();
|
58 |
+
const { refetch } = useFetchFlow();
|
59 |
|
60 |
const { send, answer, done } = useSendMessageWithSse(api.runCanvas);
|
61 |
|
|
|
76 |
// cancel loading
|
77 |
setValue(message.content);
|
78 |
removeLatestMessage();
|
79 |
+
} else {
|
80 |
+
refetch(); // pull the message list after sending the message successfully
|
81 |
}
|
82 |
},
|
83 |
+
[flowId, send, setValue, removeLatestMessage, refetch],
|
84 |
);
|
85 |
|
86 |
const handleSendMessage = useCallback(
|
|
|
115 |
const sendRet = await send({ id: flowId });
|
116 |
if (receiveMessageError(sendRet)) {
|
117 |
message.error(sendRet?.data?.message);
|
118 |
+
} else {
|
119 |
+
refetch();
|
120 |
}
|
121 |
+
}, [flowId, refetch, send]);
|
122 |
|
123 |
useEffect(() => {
|
124 |
fetchPrologue();
|