Skip to content

Commit 54e0a0e

Browse files
authored
4.8.11 code perf (#2804)
* perf: support child layout * perf: user form ui * perf: plugin tool output code * perf: code * perf: node fold hook
1 parent e6bad93 commit 54e0a0e

File tree

23 files changed

+153
-114
lines changed

23 files changed

+153
-114
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
blank_issues_enabled: false
22
contact_links:
33
- name: 飞书话题群
4-
url: https://oss.laf.run/otnvvf-imgs/1719505774252.jpg
4+
url: https://oss.laf.run/otnvvf-imgs/feishu3.png
55
about: FastGPT 全是问题群

docSite/content/zh-cn/docs/development/upgrading/4811.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,16 @@ weight: 813
9292
6. 新增 - 支持 Openai o1 模型,需增加模型的 `defaultConfig` 配置,覆盖 `temperature``max_tokens``stream`配置,o1 不支持 stream 模式, 详细可重新拉取 `config.json` 配置文件查看。
9393
7. 新增 - AI 对话节点知识库引用,支持配置 role=system 和 role=user,已配置的过自定义提示词的节点将会保持 user 模式,其余用户将转成 system 模式。
9494
8. 新增 - 插件支持上传系统文件。
95-
9. 新增 - 支持工作流嵌套子应用时,可以设置`非流模式`,同时简易模式也可以选择工作流作为插件了,简易模式调用子应用时,都将强制使用非流模式。
96-
10. 新增 - 调试模式下,子应用调用,支持返回详细运行数据。
97-
11. 新增 - 保留所有模式下子应用嵌套调用的日志。
98-
12. 优化 - 工作流嵌套层级限制 20 层,避免因编排不合理导致的无限死循环。
99-
13. 优化 - 工作流 handler 性能优化。
100-
14. 优化 - 工作流快捷键,避免调试测试时也会触发。
101-
15. 优化 - 流输出,切换 tab 时仍可以继续输出。
102-
16. 优化 - 完善外部文件知识库相关 API
103-
17. 修复 - 知识库选择权限问题。
104-
18. 修复 - 空 chatId 发起对话,首轮携带用户选择时会异常。
105-
19. 修复 - createDataset 接口,intro 为赋值。
106-
20. 修复 - 对话框渲染性能问题。
95+
9. 新增 - 插件输出,支持指定字段作为工具响应。
96+
10. 新增 - 支持工作流嵌套子应用时,可以设置`非流模式`,同时简易模式也可以选择工作流作为插件了,简易模式调用子应用时,都将强制使用非流模式。
97+
11. 新增 - 调试模式下,子应用调用,支持返回详细运行数据。
98+
12. 新增 - 保留所有模式下子应用嵌套调用的日志。
99+
13. 优化 - 工作流嵌套层级限制 20 层,避免因编排不合理导致的无限死循环。
100+
14. 优化 - 工作流 handler 性能优化。
101+
15. 优化 - 工作流快捷键,避免调试测试时也会触发。
102+
16. 优化 - 流输出,切换 tab 时仍可以继续输出。
103+
17. 优化 - 完善外部文件知识库相关 API
104+
18. 修复 - 知识库选择权限问题。
105+
19. 修复 - 空 chatId 发起对话,首轮携带用户选择时会异常。
106+
20. 修复 - createDataset 接口,intro 为赋值。
107+
21. 修复 - 对话框渲染性能问题。

packages/global/core/workflow/template/system/interactive/formInput.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ export const FormInputNode: FlowNodeTemplateType = {
4646
id: NodeOutputKeyEnum.formInputResult,
4747
key: NodeOutputKeyEnum.formInputResult,
4848
required: true,
49-
label: i18nT('app:workflow.form_input_result'),
50-
description: i18nT('app:workflow.form_input_result_tip'),
49+
label: i18nT('workflow:form_input_result'),
50+
description: i18nT('workflow:form_input_result_tip'),
5151
valueType: WorkflowIOValueTypeEnum.object,
5252
type: FlowNodeOutputTypeEnum.static
5353
}

packages/service/core/workflow/dispatch/interactive/formInput.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
UserInputFormItemType,
1010
UserInputInteractive
1111
} from '@fastgpt/global/core/workflow/template/system/interactive/type';
12+
import { addLog } from '../../../../common/system/log';
1213

1314
type Props = ModuleDispatchProps<{
1415
[NodeInputKeyEnum.description]: string;
@@ -48,7 +49,8 @@ export const dispatchFormInput = async (props: Props): Promise<FormInputResponse
4849
try {
4950
return JSON.parse(text);
5051
} catch (error) {
51-
return text;
52+
addLog.warn('formInput error', { error });
53+
return {};
5254
}
5355
})();
5456

packages/service/core/workflow/dispatch/plugin/run.ts

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,13 @@ export const dispatchRunPlugin = async (props: RunPluginProps): Promise<RunPlugi
4747

4848
const plugin = await getChildAppRuntimeById(pluginId);
4949

50-
const outputFilterMap = plugin.nodes
51-
.find((node) => node.flowNodeType === FlowNodeTypeEnum.pluginOutput)!
52-
.inputs.reduce(
53-
(acc, cur) => {
50+
const outputFilterMap =
51+
plugin.nodes
52+
.find((node) => node.flowNodeType === FlowNodeTypeEnum.pluginOutput)
53+
?.inputs.reduce<Record<string, boolean>>((acc, cur) => {
5454
acc[cur.key] = cur.isToolOutput === false ? false : true;
5555
return acc;
56-
},
57-
{} as Record<string, boolean>
58-
);
56+
}, {}) ?? {};
5957

6058
const runtimeNodes = storeNodes2RuntimeNodes(
6159
plugin.nodes,
@@ -125,13 +123,12 @@ export const dispatchRunPlugin = async (props: RunPluginProps): Promise<RunPlugi
125123
moduleLogo: plugin.avatar,
126124
totalPoints: usagePoints,
127125
pluginOutput: output?.pluginOutput,
128-
pluginDetail:
129-
pluginData && pluginData.permission.hasWritePer // Not system plugin
130-
? flowResponses.filter((item) => {
131-
const filterArr = [FlowNodeTypeEnum.pluginOutput];
132-
return !filterArr.includes(item.moduleType as any);
133-
})
134-
: undefined
126+
pluginDetail: pluginData?.permission?.hasWritePer // Not system plugin
127+
? flowResponses.filter((item) => {
128+
const filterArr = [FlowNodeTypeEnum.pluginOutput];
129+
return !filterArr.includes(item.moduleType as any);
130+
})
131+
: undefined
135132
},
136133
[DispatchNodeResponseKeyEnum.nodeDispatchUsages]: [
137134
{
@@ -143,14 +140,11 @@ export const dispatchRunPlugin = async (props: RunPluginProps): Promise<RunPlugi
143140
[DispatchNodeResponseKeyEnum.toolResponses]: output?.pluginOutput
144141
? Object.keys(output.pluginOutput)
145142
.filter((key) => outputFilterMap[key])
146-
.reduce(
147-
(acc, key) => {
148-
acc[key] = output.pluginOutput![key];
149-
return acc;
150-
},
151-
{} as Record<string, any>
152-
)
153-
: {},
143+
.reduce<Record<string, any>>((acc, key) => {
144+
acc[key] = output.pluginOutput![key];
145+
return acc;
146+
}, {})
147+
: null,
154148
...(output ? output.pluginOutput : {})
155149
};
156150
};

packages/web/i18n/en/app.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@
145145
"workflow.file_url": "Document Link",
146146
"workflow.form_input": "Form input",
147147
"workflow.form_input_description_placeholder": "For example: \nAdd your information",
148-
"workflow.form_input_result": "Full input result",
149-
"workflow.form_input_result_tip": "An object of full result",
150148
"workflow.form_input_tip": " This module can configure multiple inputs to guide users in entering specific content.",
151149
"workflow.input_description_tip": "You can add a description to explain to users what they need to input",
152150
"workflow.read_files": "Document Parsing",

packages/web/i18n/en/common.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,6 @@
430430
"core.chat.response.Read complete response tips": "Click to View Detailed Process",
431431
"core.chat.response.Tool call tokens": "Tool Call Tokens Consumption",
432432
"core.chat.response.context total length": "Total Context Length",
433-
"core.chat.response.form_input_result": "Form input result",
434433
"core.chat.response.loop_input": "Loop Input Array",
435434
"core.chat.response.loop_input_element": "Loop Input Element",
436435
"core.chat.response.loop_output": "Loop Output Array",

packages/web/i18n/en/workflow.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
"field_required": "Required",
5151
"field_used_as_tool_input": "Used as Tool Call Parameter",
5252
"filter_description": "Currently supports filtering by tags and creation time. Fill in the format as follows:\n{\n \"tags\": {\n \"$and\": [\"Tag 1\",\"Tag 2\"],\n \"$or\": [\"When there are $and tags, and is effective, or is not effective\"]\n },\n \"createTime\": {\n \"$gte\": \"YYYY-MM-DD HH:mm format, collection creation time greater than this time\",\n \"$lte\": \"YYYY-MM-DD HH:mm format, collection creation time less than this time, can be used with $gte\"\n }\n}",
53+
"form_input_result": "User complete input result",
54+
"form_input_result_tip": "an object containing the complete result",
5355
"full_field_extraction": "Full Field Extraction",
5456
"full_field_extraction_description": "Returns true when all fields are fully extracted (success includes model extraction or using default values)",
5557
"full_response_data": "Full Response Data",
@@ -79,7 +81,7 @@
7981
"is_equal_to": "Is Equal To",
8082
"is_not_empty": "Is Not Empty",
8183
"is_not_equal": "Is Not Equal",
82-
"is_tool_output": "Whether to use this field as tool output when the tool is called",
84+
"is_tool_output_label": "as tool response",
8385
"judgment_result": "Judgment Result",
8486
"knowledge_base_reference": "Dataset Reference",
8587
"knowledge_base_search_merge": "Dataset Search Merge",
@@ -112,6 +114,7 @@
112114
"plugin.Instruction_Tip": "You can configure an instruction to explain the purpose of the plugin. This instruction will be displayed each time the plugin is used. Supports standard Markdown syntax.",
113115
"plugin.Instructions": "Instructions",
114116
"plugin_input": "Plugin Input",
117+
"plugin_output_tool": "When the plug-in is executed as a tool, whether this field responds as a result of the tool",
115118
"question_classification": "Question Classification",
116119
"question_optimization": "Question Optimization",
117120
"quote_content_placeholder": "The structure of the reference content can be customized to better suit different scenarios. \nSome variables can be used for template configuration\n\n{{q}} - main content\n\n{{a}} - auxiliary data\n\n{{source}} - source name\n\n{{sourceId}} - source ID\n\n{{index}} - nth reference",
@@ -157,6 +160,9 @@
157160
"update_link_error": "Error updating link",
158161
"update_specified_node_output_or_global_variable": "Can update the output value of a specified node or update global variables",
159162
"use_user_id": "User ID",
163+
"user_form_input_config": "Form configuration",
164+
"user_form_input_description": "describe",
165+
"user_form_input_name": "Name",
160166
"user_question": "User Question",
161167
"user_question_tool_desc": "User input questions (questions need to be improved)",
162168
"value_type": "Value type",

packages/web/i18n/zh/app.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@
145145
"workflow.file_url": "文档链接",
146146
"workflow.form_input": "表单输入",
147147
"workflow.form_input_description_placeholder": "例如:\n补充您的信息",
148-
"workflow.form_input_result": "完整输入结果",
149-
"workflow.form_input_result_tip": "一个包含完整结果的对象",
150148
"workflow.form_input_tip": "该模块可以配置多种输入,引导用户输入特定内容。",
151149
"workflow.input_description_tip": "你可以添加一段说明文字,用以向用户说明需要输入的内容",
152150
"workflow.read_files": "文档解析",
@@ -156,7 +154,7 @@
156154
"workflow.select_description": "说明文字",
157155
"workflow.select_description_placeholder": "例如: \n冰箱里是否有西红柿?",
158156
"workflow.select_description_tip": "你可以添加一段说明文字,用以向用户说明每个选项代表的含义。",
159-
"workflow.select_result": "选择的结果",
157+
"workflow.select_result": "选择结果",
160158
"workflow.template.communication": "通信",
161159
"workflow.user_file_input": "文件链接",
162160
"workflow.user_file_input_desc": "用户上传的文档和图片链接",

packages/web/i18n/zh/common.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,6 @@
429429
"core.chat.response.Read complete response tips": "点击查看详细流程",
430430
"core.chat.response.Tool call tokens": "工具调用 tokens 消耗",
431431
"core.chat.response.context total length": "上下文总长度",
432-
"core.chat.response.form_input_result": "表单输入结果",
433432
"core.chat.response.loop_input": "输入数组",
434433
"core.chat.response.loop_input_element": "输入数组元素",
435434
"core.chat.response.loop_output": "输出数组",

0 commit comments

Comments
 (0)