mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
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:
@@ -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
|
||||
|
@@ -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,
|
||||
|
@@ -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
|
||||
};
|
||||
|
||||
|
@@ -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,
|
||||
|
@@ -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;
|
||||
|
@@ -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) => {
|
||||
|
@@ -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,
|
||||
|
@@ -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) => {
|
||||
|
@@ -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: {
|
||||
|
@@ -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",
|
||||
|
@@ -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": "变量更新",
|
||||
|
@@ -24,6 +24,7 @@ import { useSystem } from '@fastgpt/web/hooks/useSystem';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { formatTime2YMDHMS } from '@fastgpt/global/common/string/time';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { useDatasetStore } from '@/web/core/dataset/store/dataset';
|
||||
|
||||
const Header = ({
|
||||
appForm,
|
||||
@@ -38,6 +39,7 @@ const Header = ({
|
||||
const { toast } = useToast();
|
||||
const { appId, appDetail, onSaveApp, currentTab } = useContextSelector(AppContext, (v) => v);
|
||||
const { lastAppListRouteType } = useSystemStore();
|
||||
const { allDatasets } = useDatasetStore();
|
||||
|
||||
const { data: paths = [] } = useRequest2(() => getAppFolderPath(appId), {
|
||||
manual: false,
|
||||
@@ -70,7 +72,7 @@ const Header = ({
|
||||
chatConfig: data.chatConfig
|
||||
}
|
||||
);
|
||||
}, [appDetail.chatConfig, appDetail.modules, appForm, t]);
|
||||
}, [appDetail.chatConfig, appDetail.modules, appForm, allDatasets, t]);
|
||||
|
||||
const onSubmitPublish = useCallback(
|
||||
async (data: AppSimpleEditFormType) => {
|
||||
|
@@ -49,10 +49,7 @@ type Props = {
|
||||
};
|
||||
|
||||
const OutLink = ({
|
||||
outLinkUid,
|
||||
appName,
|
||||
appIntro,
|
||||
appAvatar
|
||||
outLinkUid
|
||||
}: Props & {
|
||||
outLinkUid: string;
|
||||
}) => {
|
||||
@@ -240,8 +237,6 @@ const OutLink = ({
|
||||
|
||||
return (
|
||||
<>
|
||||
<NextHead title={appName} desc={appIntro} icon={appAvatar} />
|
||||
|
||||
<PageContainer
|
||||
isLoading={loading}
|
||||
{...(isEmbed
|
||||
@@ -367,17 +362,26 @@ const OutLink = ({
|
||||
const Render = (props: Props) => {
|
||||
const { shareId, authToken } = props;
|
||||
const { localUId, loaded } = useShareChatStore();
|
||||
const [isLoaded, setIsLoaded] = useState(false);
|
||||
|
||||
const contextParams = useMemo(() => {
|
||||
return { shareId, outLinkUid: authToken || localUId };
|
||||
}, [authToken, localUId, shareId]);
|
||||
|
||||
if (!loaded || !contextParams.outLinkUid) return <></>;
|
||||
useMount(() => {
|
||||
setIsLoaded(true);
|
||||
});
|
||||
const systemLoaded = isLoaded && loaded && contextParams.outLinkUid;
|
||||
|
||||
return (
|
||||
<ChatContextProvider params={contextParams}>
|
||||
<OutLink {...props} outLinkUid={contextParams.outLinkUid} />;
|
||||
</ChatContextProvider>
|
||||
<>
|
||||
<NextHead title={props.appName} desc={props.appIntro} icon={props.appAvatar} />
|
||||
{systemLoaded && (
|
||||
<ChatContextProvider params={contextParams}>
|
||||
<OutLink {...props} outLinkUid={contextParams.outLinkUid} />;
|
||||
</ChatContextProvider>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
@@ -29,7 +29,7 @@ import {
|
||||
AiChatQuoteTemplate
|
||||
} from '@fastgpt/global/core/workflow/template/system/aiChat/index';
|
||||
import { DatasetSearchModule } from '@fastgpt/global/core/workflow/template/system/datasetSearch';
|
||||
import { ReadFilesNodes } from '@fastgpt/global/core/workflow/template/system/readFiles';
|
||||
import { ReadFilesNode } from '@fastgpt/global/core/workflow/template/system/readFiles';
|
||||
import { i18nT } from '@fastgpt/web/i18n/utils';
|
||||
import { Input_Template_UserChatInput } from '@fastgpt/global/core/workflow/template/input';
|
||||
|
||||
@@ -325,17 +325,17 @@ export function form2AppWorkflow(
|
||||
? {
|
||||
nodes: [
|
||||
{
|
||||
nodeId: ReadFilesNodes.id,
|
||||
name: t(ReadFilesNodes.name),
|
||||
intro: t(ReadFilesNodes.intro),
|
||||
avatar: ReadFilesNodes.avatar,
|
||||
flowNodeType: ReadFilesNodes.flowNodeType,
|
||||
nodeId: ReadFilesNode.id,
|
||||
name: t(ReadFilesNode.name),
|
||||
intro: t(ReadFilesNode.intro),
|
||||
avatar: ReadFilesNode.avatar,
|
||||
flowNodeType: ReadFilesNode.flowNodeType,
|
||||
showStatus: true,
|
||||
position: {
|
||||
x: 974.6209854328943,
|
||||
y: 587.6378828744465
|
||||
},
|
||||
version: '489',
|
||||
version: ReadFilesNode.version,
|
||||
inputs: [
|
||||
{
|
||||
key: NodeInputKeyEnum.fileUrlList,
|
||||
@@ -345,13 +345,13 @@ export function form2AppWorkflow(
|
||||
value: [workflowStartNodeId, 'userFiles']
|
||||
}
|
||||
],
|
||||
outputs: ReadFilesNodes.outputs
|
||||
outputs: ReadFilesNode.outputs
|
||||
}
|
||||
],
|
||||
edges: [
|
||||
{
|
||||
source: toolNodeId,
|
||||
target: ReadFilesNodes.id,
|
||||
target: ReadFilesNode.id,
|
||||
sourceHandle: 'selectedTools',
|
||||
targetHandle: 'selectedTools'
|
||||
}
|
||||
|
Reference in New Issue
Block a user