mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-24 13:53:50 +00:00
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
This commit is contained in:
@@ -46,8 +46,8 @@ export const FormInputNode: FlowNodeTemplateType = {
|
||||
id: NodeOutputKeyEnum.formInputResult,
|
||||
key: NodeOutputKeyEnum.formInputResult,
|
||||
required: true,
|
||||
label: i18nT('app:workflow.form_input_result'),
|
||||
description: i18nT('app:workflow.form_input_result_tip'),
|
||||
label: i18nT('workflow:form_input_result'),
|
||||
description: i18nT('workflow:form_input_result_tip'),
|
||||
valueType: WorkflowIOValueTypeEnum.object,
|
||||
type: FlowNodeOutputTypeEnum.static
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ import {
|
||||
UserInputFormItemType,
|
||||
UserInputInteractive
|
||||
} from '@fastgpt/global/core/workflow/template/system/interactive/type';
|
||||
import { addLog } from '../../../../common/system/log';
|
||||
|
||||
type Props = ModuleDispatchProps<{
|
||||
[NodeInputKeyEnum.description]: string;
|
||||
@@ -48,7 +49,8 @@ export const dispatchFormInput = async (props: Props): Promise<FormInputResponse
|
||||
try {
|
||||
return JSON.parse(text);
|
||||
} catch (error) {
|
||||
return text;
|
||||
addLog.warn('formInput error', { error });
|
||||
return {};
|
||||
}
|
||||
})();
|
||||
|
||||
|
@@ -47,15 +47,13 @@ export const dispatchRunPlugin = async (props: RunPluginProps): Promise<RunPlugi
|
||||
|
||||
const plugin = await getChildAppRuntimeById(pluginId);
|
||||
|
||||
const outputFilterMap = plugin.nodes
|
||||
.find((node) => node.flowNodeType === FlowNodeTypeEnum.pluginOutput)!
|
||||
.inputs.reduce(
|
||||
(acc, cur) => {
|
||||
const outputFilterMap =
|
||||
plugin.nodes
|
||||
.find((node) => node.flowNodeType === FlowNodeTypeEnum.pluginOutput)
|
||||
?.inputs.reduce<Record<string, boolean>>((acc, cur) => {
|
||||
acc[cur.key] = cur.isToolOutput === false ? false : true;
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, boolean>
|
||||
);
|
||||
}, {}) ?? {};
|
||||
|
||||
const runtimeNodes = storeNodes2RuntimeNodes(
|
||||
plugin.nodes,
|
||||
@@ -125,13 +123,12 @@ export const dispatchRunPlugin = async (props: RunPluginProps): Promise<RunPlugi
|
||||
moduleLogo: plugin.avatar,
|
||||
totalPoints: usagePoints,
|
||||
pluginOutput: output?.pluginOutput,
|
||||
pluginDetail:
|
||||
pluginData && pluginData.permission.hasWritePer // Not system plugin
|
||||
? flowResponses.filter((item) => {
|
||||
const filterArr = [FlowNodeTypeEnum.pluginOutput];
|
||||
return !filterArr.includes(item.moduleType as any);
|
||||
})
|
||||
: undefined
|
||||
pluginDetail: pluginData?.permission?.hasWritePer // Not system plugin
|
||||
? flowResponses.filter((item) => {
|
||||
const filterArr = [FlowNodeTypeEnum.pluginOutput];
|
||||
return !filterArr.includes(item.moduleType as any);
|
||||
})
|
||||
: undefined
|
||||
},
|
||||
[DispatchNodeResponseKeyEnum.nodeDispatchUsages]: [
|
||||
{
|
||||
@@ -143,14 +140,11 @@ export const dispatchRunPlugin = async (props: RunPluginProps): Promise<RunPlugi
|
||||
[DispatchNodeResponseKeyEnum.toolResponses]: output?.pluginOutput
|
||||
? Object.keys(output.pluginOutput)
|
||||
.filter((key) => outputFilterMap[key])
|
||||
.reduce(
|
||||
(acc, key) => {
|
||||
acc[key] = output.pluginOutput![key];
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, any>
|
||||
)
|
||||
: {},
|
||||
.reduce<Record<string, any>>((acc, key) => {
|
||||
acc[key] = output.pluginOutput![key];
|
||||
return acc;
|
||||
}, {})
|
||||
: null,
|
||||
...(output ? output.pluginOutput : {})
|
||||
};
|
||||
};
|
||||
|
@@ -145,8 +145,6 @@
|
||||
"workflow.file_url": "Document Link",
|
||||
"workflow.form_input": "Form input",
|
||||
"workflow.form_input_description_placeholder": "For example: \nAdd your information",
|
||||
"workflow.form_input_result": "Full input result",
|
||||
"workflow.form_input_result_tip": "An object of full result",
|
||||
"workflow.form_input_tip": " This module can configure multiple inputs to guide users in entering specific content.",
|
||||
"workflow.input_description_tip": "You can add a description to explain to users what they need to input",
|
||||
"workflow.read_files": "Document Parsing",
|
||||
|
@@ -430,7 +430,6 @@
|
||||
"core.chat.response.Read complete response tips": "Click to View Detailed Process",
|
||||
"core.chat.response.Tool call tokens": "Tool Call Tokens Consumption",
|
||||
"core.chat.response.context total length": "Total Context Length",
|
||||
"core.chat.response.form_input_result": "Form input result",
|
||||
"core.chat.response.loop_input": "Loop Input Array",
|
||||
"core.chat.response.loop_input_element": "Loop Input Element",
|
||||
"core.chat.response.loop_output": "Loop Output Array",
|
||||
|
@@ -50,6 +50,8 @@
|
||||
"field_required": "Required",
|
||||
"field_used_as_tool_input": "Used as Tool Call Parameter",
|
||||
"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}",
|
||||
"form_input_result": "User complete input result",
|
||||
"form_input_result_tip": "an object containing the complete result",
|
||||
"full_field_extraction": "Full Field Extraction",
|
||||
"full_field_extraction_description": "Returns true when all fields are fully extracted (success includes model extraction or using default values)",
|
||||
"full_response_data": "Full Response Data",
|
||||
@@ -79,7 +81,7 @@
|
||||
"is_equal_to": "Is Equal To",
|
||||
"is_not_empty": "Is Not Empty",
|
||||
"is_not_equal": "Is Not Equal",
|
||||
"is_tool_output": "Whether to use this field as tool output when the tool is called",
|
||||
"is_tool_output_label": "as tool response",
|
||||
"judgment_result": "Judgment Result",
|
||||
"knowledge_base_reference": "Dataset Reference",
|
||||
"knowledge_base_search_merge": "Dataset Search Merge",
|
||||
@@ -112,6 +114,7 @@
|
||||
"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.",
|
||||
"plugin.Instructions": "Instructions",
|
||||
"plugin_input": "Plugin Input",
|
||||
"plugin_output_tool": "When the plug-in is executed as a tool, whether this field responds as a result of the tool",
|
||||
"question_classification": "Question Classification",
|
||||
"question_optimization": "Question Optimization",
|
||||
"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 @@
|
||||
"update_link_error": "Error updating link",
|
||||
"update_specified_node_output_or_global_variable": "Can update the output value of a specified node or update global variables",
|
||||
"use_user_id": "User ID",
|
||||
"user_form_input_config": "Form configuration",
|
||||
"user_form_input_description": "describe",
|
||||
"user_form_input_name": "Name",
|
||||
"user_question": "User Question",
|
||||
"user_question_tool_desc": "User input questions (questions need to be improved)",
|
||||
"value_type": "Value type",
|
||||
|
@@ -145,8 +145,6 @@
|
||||
"workflow.file_url": "文档链接",
|
||||
"workflow.form_input": "表单输入",
|
||||
"workflow.form_input_description_placeholder": "例如:\n补充您的信息",
|
||||
"workflow.form_input_result": "完整输入结果",
|
||||
"workflow.form_input_result_tip": "一个包含完整结果的对象",
|
||||
"workflow.form_input_tip": "该模块可以配置多种输入,引导用户输入特定内容。",
|
||||
"workflow.input_description_tip": "你可以添加一段说明文字,用以向用户说明需要输入的内容",
|
||||
"workflow.read_files": "文档解析",
|
||||
@@ -156,7 +154,7 @@
|
||||
"workflow.select_description": "说明文字",
|
||||
"workflow.select_description_placeholder": "例如: \n冰箱里是否有西红柿?",
|
||||
"workflow.select_description_tip": "你可以添加一段说明文字,用以向用户说明每个选项代表的含义。",
|
||||
"workflow.select_result": "选择的结果",
|
||||
"workflow.select_result": "选择结果",
|
||||
"workflow.template.communication": "通信",
|
||||
"workflow.user_file_input": "文件链接",
|
||||
"workflow.user_file_input_desc": "用户上传的文档和图片链接",
|
||||
|
@@ -429,7 +429,6 @@
|
||||
"core.chat.response.Read complete response tips": "点击查看详细流程",
|
||||
"core.chat.response.Tool call tokens": "工具调用 tokens 消耗",
|
||||
"core.chat.response.context total length": "上下文总长度",
|
||||
"core.chat.response.form_input_result": "表单输入结果",
|
||||
"core.chat.response.loop_input": "输入数组",
|
||||
"core.chat.response.loop_input_element": "输入数组元素",
|
||||
"core.chat.response.loop_output": "输出数组",
|
||||
|
@@ -50,6 +50,8 @@
|
||||
"field_required": "必填",
|
||||
"field_used_as_tool_input": "作为工具调用参数",
|
||||
"filter_description": "目前支持标签和创建时间过滤,需按照以下格式填写:\n{\n \"tags\": {\n \"$and\": [\"标签 1\",\"标签 2\"],\n \"$or\": [\"有 $and 标签时,and 生效,or 不生效\"]\n },\n \"createTime\": {\n \"$gte\": \"YYYY-MM-DD HH:mm 格式即可,集合的创建时间大于该时间\",\n \"$lte\": \"YYYY-MM-DD HH:mm 格式即可,集合的创建时间小于该时间,可和 $gte 共同使用\"\n }\n}",
|
||||
"form_input_result": "用户完整输入结果",
|
||||
"form_input_result_tip": "一个包含完整结果的对象",
|
||||
"full_field_extraction": "字段完全提取",
|
||||
"full_field_extraction_description": "提取字段全部填充时返回 true (模型提取或使用默认值均属于成功)",
|
||||
"full_response_data": "完整响应数据",
|
||||
@@ -79,7 +81,7 @@
|
||||
"is_equal_to": "等于",
|
||||
"is_not_empty": "不为空",
|
||||
"is_not_equal": "不等于",
|
||||
"is_tool_output": "是否在工具调用时,将该字段作为工具输出",
|
||||
"is_tool_output_label": "作为工具响应",
|
||||
"judgment_result": "判断结果",
|
||||
"knowledge_base_reference": "知识库引用",
|
||||
"knowledge_base_search_merge": "知识库搜索引用合并",
|
||||
@@ -112,6 +114,7 @@
|
||||
"plugin.Instruction_Tip": "可以配置一段说明,以解释该插件的用途。每次使用插件前,会显示该段说明。支持标准 Markdown 语法。",
|
||||
"plugin.Instructions": "使用说明",
|
||||
"plugin_input": "插件输入",
|
||||
"plugin_output_tool": "插件作为工具执行时,该字段是否作为工具响应结果",
|
||||
"question_classification": "问题分类",
|
||||
"question_optimization": "问题优化",
|
||||
"quote_content_placeholder": "可以自定义引用内容的结构,以更好的适配不同场景。可以使用一些变量来进行模板配置\n{{q}} - 主要内容\n{{a}} - 辅助数据\n{{source}} - 来源名\n{{sourceId}} - 来源ID\n{{index}} - 第 n 个引用",
|
||||
@@ -157,6 +160,9 @@
|
||||
"update_link_error": "更新链接异常",
|
||||
"update_specified_node_output_or_global_variable": "可以更新指定节点的输出值或更新全局变量",
|
||||
"use_user_id": "使用者 ID",
|
||||
"user_form_input_config": "表单配置",
|
||||
"user_form_input_description": "描述",
|
||||
"user_form_input_name": "标题",
|
||||
"user_question": "用户问题",
|
||||
"user_question_tool_desc": "用户输入的问题(问题需要完善)",
|
||||
"value_type": "数据类型",
|
||||
|
Reference in New Issue
Block a user