Perf ui detail (#2775)

* perf: tool response tip

* perf: image extract

* perf: user question tool desc

* fix: simple mode load app module

* perf: simple mode plugin version

* perf: share page reload

* refresh simple mode data
This commit is contained in:
Archer
2024-09-24 18:04:11 +08:00
committed by GitHub
parent 434c03c955
commit afd2c394d8
14 changed files with 43 additions and 60 deletions

View File

@@ -97,7 +97,10 @@ export const appWorkflow2Form = ({
node.inputs,
NodeInputKeyEnum.datasetSearchExtensionBg
);
} else if (node.flowNodeType === FlowNodeTypeEnum.pluginModule) {
} else if (
node.flowNodeType === FlowNodeTypeEnum.pluginModule ||
node.flowNodeType === FlowNodeTypeEnum.appModule
) {
if (!node.pluginId) return;
defaultAppForm.selectedTools.push({
@@ -108,7 +111,7 @@ export const appWorkflow2Form = ({
intro: node.intro || '',
flowNodeType: node.flowNodeType,
showStatus: node.showStatus,
version: '481',
version: node.version,
inputs: node.inputs,
outputs: node.outputs,
templateType: FlowNodeTemplateTypeEnum.other

View File

@@ -27,7 +27,7 @@ import { VariableUpdateNode } from './system/variableUpdate';
import { CodeNode } from './system/sandbox';
import { TextEditorNode } from './system/textEditor';
import { CustomFeedbackNode } from './system/customFeedback';
import { ReadFilesNodes } from './system/readFiles';
import { ReadFilesNode } from './system/readFiles';
import { UserSelectNode } from './system/userSelect/index';
import { LoopNode } from './system/loop/loop';
import { LoopStartNode } from './system/loop/loopStart';
@@ -43,7 +43,7 @@ const systemNodes: FlowNodeTemplateType[] = [
StopToolNode,
ClassifyQuestionModule,
ContextExtractModule,
ReadFilesNodes,
ReadFilesNode,
HttpNode468,
AiQueryExtension,
LafModule,

View File

@@ -23,7 +23,7 @@ export const Input_Template_UserChatInput: FlowNodeInputItemType = {
renderTypeList: [FlowNodeInputTypeEnum.reference, FlowNodeInputTypeEnum.textarea],
valueType: WorkflowIOValueTypeEnum.string,
label: i18nT('workflow:user_question'),
toolDescription: i18nT('workflow:user_question'),
toolDescription: i18nT('workflow:user_question_tool_desc'),
required: true
};

View File

@@ -13,7 +13,7 @@ import {
import { FlowNodeTemplateType } from '../../../type/node';
import { getHandleConfig } from '../../utils';
export const ReadFilesNodes: FlowNodeTemplateType = {
export const ReadFilesNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.readFiles,
templateType: FlowNodeTemplateTypeEnum.tools,
flowNodeType: FlowNodeTypeEnum.readFiles,

View File

@@ -178,6 +178,11 @@ export const loadRequestMessages = async ({
});
});
// Too many images or too long text, return text
if (httpsImages.length > 4 || input.length > 1000) {
return [{ type: 'text', text: input || '' }];
}
// 添加原始input作为文本
result.push({ type: 'text', text: input });
return result;

View File

@@ -255,17 +255,6 @@ export const runToolWithFunctionCall = async (
];
// console.log(tokens, 'tool');
// Run tool status
if (node.showStatus) {
workflowStreamResponse?.({
event: SseResponseEventEnum.flowNodeStatus,
data: {
status: 'running',
name: node.name
}
});
}
// tool assistant
const toolAssistants = toolsRunResponse
.map((item) => {

View File

@@ -275,17 +275,6 @@ export const runToolWithPromptCall = async (
};
})();
// Run tool status
if (node.showStatus) {
workflowStreamResponse?.({
event: SseResponseEventEnum.flowNodeStatus,
data: {
status: 'running',
name: node.name
}
});
}
// 合并工具调用的结果,使用 functionCall 格式存储。
const assistantToolMsgParams: ChatCompletionAssistantMessageParam = {
role: ChatCompletionRequestMessageRoleEnum.Assistant,

View File

@@ -311,17 +311,6 @@ export const runToolWithToolChoice = async (
// console.log(tokens, 'tool');
// Run tool status
if (node.showStatus) {
workflowStreamResponse?.({
event: SseResponseEventEnum.flowNodeStatus,
data: {
status: 'running',
name: node.name
}
});
}
// tool assistant
const toolAssistants = toolsRunResponse
.map((item) => {

View File

@@ -497,7 +497,7 @@ export async function dispatchWorkFlow(data: Props): Promise<DispatchFlowRespons
result: Record<string, any>;
}> {
// push run status messages
if (node.showStatus) {
if (node.showStatus && !props.isToolCall) {
props.workflowStreamResponse?.({
event: SseResponseEventEnum.flowNodeStatus,
data: {

View File

@@ -149,6 +149,7 @@
"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_question": "User Question",
"user_question_tool_desc": "User input questions (questions need to be improved)",
"value_type": "Value type",
"variable_picker_tips": "Type node name or variable name to search",
"variable_update": "Variable Update",

View File

@@ -155,6 +155,7 @@
"update_specified_node_output_or_global_variable": "可以更新指定节点的输出值或更新全局变量",
"use_user_id": "使用者 ID",
"user_question": "用户问题",
"user_question_tool_desc": "用户输入的问题(问题需要完善)",
"value_type": "数据类型",
"variable_picker_tips": "可输入节点名或变量名搜索",
"variable_update": "变量更新",