Commit 8ca5ebec by Finley Ge Committed by GitHub

perf: read file node return splited raw texts (#5881)

parent 7225ebec
...@@ -45,6 +45,14 @@ export const ReadFilesNode: FlowNodeTemplateType = { ...@@ -45,6 +45,14 @@ export const ReadFilesNode: FlowNodeTemplateType = {
valueType: WorkflowIOValueTypeEnum.string, valueType: WorkflowIOValueTypeEnum.string,
type: FlowNodeOutputTypeEnum.static type: FlowNodeOutputTypeEnum.static
}, },
{
id: NodeOutputKeyEnum.rawResponse,
key: NodeOutputKeyEnum.rawResponse,
label: i18nT('workflow:raw_response'),
description: i18nT('workflow:tool_raw_response_description'),
valueType: WorkflowIOValueTypeEnum.arrayObject,
type: FlowNodeOutputTypeEnum.static
},
Output_Template_Error_Message Output_Template_Error_Message
] ]
}; };
...@@ -22,6 +22,7 @@ type Props = ModuleDispatchProps<{ ...@@ -22,6 +22,7 @@ type Props = ModuleDispatchProps<{
}>; }>;
type Response = DispatchNodeResultType<{ type Response = DispatchNodeResultType<{
[NodeOutputKeyEnum.text]: string; [NodeOutputKeyEnum.text]: string;
[NodeOutputKeyEnum.rawResponse]: ReturnType<typeof formatResponseObject>[];
}>; }>;
const formatResponseObject = ({ const formatResponseObject = ({
...@@ -75,7 +76,8 @@ export const dispatchReadFiles = async (props: Props): Promise<Response> => { ...@@ -75,7 +76,8 @@ export const dispatchReadFiles = async (props: Props): Promise<Response> => {
return { return {
data: { data: {
[NodeOutputKeyEnum.text]: text [NodeOutputKeyEnum.text]: text,
[NodeOutputKeyEnum.rawResponse]: readFilesResult
}, },
[DispatchNodeResponseKeyEnum.nodeResponse]: { [DispatchNodeResponseKeyEnum.nodeResponse]: {
readFiles: readFilesResult.map((item) => ({ readFiles: readFilesResult.map((item) => ({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment