Skip to content

Commit 4e7fa29

Browse files
authored
fix share page dataset search show (#4506)
* fix share page dataset search show * add comment * Fix
1 parent ec3bcfa commit 4e7fa29

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

packages/global/core/chat/utils.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ export const getHistoryPreview = (
7777
});
7878
};
7979

80+
export const filterModuleTypeList: any[] = [
81+
FlowNodeTypeEnum.pluginModule,
82+
FlowNodeTypeEnum.datasetSearchNode,
83+
FlowNodeTypeEnum.tools,
84+
FlowNodeTypeEnum.pluginOutput
85+
];
86+
8087
export const filterPublicNodeResponseData = ({
8188
flowResponses = [],
8289
responseDetail = false
@@ -87,12 +94,6 @@ export const filterPublicNodeResponseData = ({
8794
const filedList = responseDetail
8895
? ['quoteList', 'moduleType', 'pluginOutput', 'runningTime']
8996
: ['moduleType', 'pluginOutput', 'runningTime'];
90-
const filterModuleTypeList: any[] = [
91-
FlowNodeTypeEnum.pluginModule,
92-
FlowNodeTypeEnum.datasetSearchNode,
93-
FlowNodeTypeEnum.tools,
94-
FlowNodeTypeEnum.pluginOutput
95-
];
9697

9798
return flowResponses
9899
.filter((item) => filterModuleTypeList.includes(item.moduleType))

packages/global/core/workflow/runtime/type.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export type ChatDispatchProps = {
6161
workflowStreamResponse?: WorkflowResponseType;
6262
workflowDispatchDeep?: number;
6363
version?: 'v1' | 'v2';
64+
responseDetail?: boolean;
6465
};
6566

6667
export type ModuleDispatchProps<T> = ChatDispatchProps & {

packages/service/core/workflow/dispatch/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ import { dispatchLoopStart } from './loop/runLoopStart';
7373
import { dispatchFormInput } from './interactive/formInput';
7474
import { dispatchToolParams } from './agent/runTool/toolParams';
7575
import { getErrText } from '@fastgpt/global/common/error/utils';
76+
import { filterModuleTypeList } from '@fastgpt/global/core/chat/utils';
7677

7778
const callbackMap: Record<FlowNodeTypeEnum, Function> = {
7879
[FlowNodeTypeEnum.workflowStart]: dispatchWorkflowStart,
@@ -632,7 +633,8 @@ export async function dispatchWorkFlow(data: Props): Promise<DispatchFlowRespons
632633
version === 'v2' &&
633634
!props.isToolCall &&
634635
!props.runningAppInfo.isChildApp &&
635-
formatResponseData
636+
formatResponseData &&
637+
!(!props.responseDetail && filterModuleTypeList.includes(formatResponseData.moduleType))
636638
) {
637639
props.workflowStreamResponse?.({
638640
event: SseResponseEventEnum.flowNodeResponse,

projects/app/src/pages/api/v2/chat/completions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
296296
stream,
297297
maxRunTimes: WORKFLOW_MAX_RUN_TIMES,
298298
workflowStreamResponse: workflowResponseWrite,
299-
version: 'v2'
299+
version: 'v2',
300+
responseDetail
300301
});
301302
}
302303
return Promise.reject('您的工作流版本过低,请重新发布一次');

0 commit comments

Comments
 (0)