mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-07 01:02:55 +08:00
perf: agent pause (#6588)
* doc * feat: Pause Recovery (#6494) * feat: Pause Recovery * agent pause * agent pause * fix:agent pause * fix:agent pause * perf: pause agent call * fix: test --------- Co-authored-by: archer <545436317@qq.com> * fix: image read and json error (Agent) (#6502) * fix: 1.image read 2.JSON parsing error * dataset cite and pause * perf: plancall second parse * add test --------- Co-authored-by: archer <545436317@qq.com> * master message * remove invalid code * fix: pause agent (#6595) * fix: ask and step result * delete console * udpate pnpm version * prettier --------- Co-authored-by: YeYuheng <57035043+YYH211@users.noreply.github.com>
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
import { LOGO_ICON } from '@fastgpt/global/common/system/constants';
|
||||
import Head from 'next/head';
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
const NextHead = ({ title, icon, desc }: { title?: string; icon?: string; desc?: string }) => {
|
||||
const formatIcon = useMemo(() => {
|
||||
if (!icon) return LOGO_ICON;
|
||||
if (!icon) return '/favicon.ico';
|
||||
if (icon.startsWith('http') || icon.startsWith('/')) {
|
||||
return icon;
|
||||
}
|
||||
return LOGO_ICON;
|
||||
return '/favicon.ico';
|
||||
}, [icon]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -60,11 +60,13 @@ const accordionButtonStyle = {
|
||||
const RenderResoningContent = React.memo(function RenderResoningContent({
|
||||
content,
|
||||
isChatting,
|
||||
isLastResponseValue
|
||||
isLastResponseValue,
|
||||
isDisabled
|
||||
}: {
|
||||
content: string;
|
||||
isChatting: boolean;
|
||||
isLastResponseValue: boolean;
|
||||
isDisabled?: boolean;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const showAnimation = isChatting && isLastResponseValue;
|
||||
@@ -90,7 +92,7 @@ const RenderResoningContent = React.memo(function RenderResoningContent({
|
||||
borderColor={'myGray.300'}
|
||||
color={'myGray.500'}
|
||||
>
|
||||
<Markdown source={content} showAnimation={showAnimation} />
|
||||
<Markdown source={content} showAnimation={showAnimation} isDisabled={isDisabled} />
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
@@ -100,12 +102,14 @@ const RenderText = React.memo(function RenderText({
|
||||
showAnimation,
|
||||
text,
|
||||
chatItemDataId,
|
||||
onOpenCiteModal
|
||||
onOpenCiteModal,
|
||||
isDisabled
|
||||
}: {
|
||||
showAnimation: boolean;
|
||||
text: string;
|
||||
chatItemDataId: string;
|
||||
onOpenCiteModal?: (e?: OnOpenCiteModalProps) => void;
|
||||
isDisabled?: boolean;
|
||||
}) {
|
||||
const appId = useContextSelector(WorkflowRuntimeContext, (v) => v.appId);
|
||||
const chatId = useContextSelector(WorkflowRuntimeContext, (v) => v.chatId);
|
||||
@@ -131,6 +135,7 @@ const RenderText = React.memo(function RenderText({
|
||||
showAnimation={showAnimation}
|
||||
chatAuthData={chatAuthData}
|
||||
onOpenCiteModal={onOpenCiteModal}
|
||||
isDisabled={isDisabled}
|
||||
/>
|
||||
);
|
||||
});
|
||||
@@ -424,6 +429,7 @@ const AIResponseBox = ({
|
||||
}) => {
|
||||
const showRunningStatus = useContextSelector(ChatItemContext, (v) => v.showRunningStatus);
|
||||
const tools = value.tool ? [value.tool] : value.tools;
|
||||
const disableStreamingInteraction = isChatting && isLastChild;
|
||||
|
||||
if ('text' in value && value.text) {
|
||||
return (
|
||||
@@ -432,6 +438,7 @@ const AIResponseBox = ({
|
||||
showAnimation={isChatting && isLastResponseValue}
|
||||
text={value.text.content}
|
||||
onOpenCiteModal={onOpenCiteModal}
|
||||
isDisabled={disableStreamingInteraction}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -441,6 +448,7 @@ const AIResponseBox = ({
|
||||
isChatting={isChatting}
|
||||
isLastResponseValue={isLastResponseValue}
|
||||
content={value.reasoning.content}
|
||||
isDisabled={disableStreamingInteraction}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -164,6 +164,13 @@ export function agentForm2AppWorkflow(
|
||||
...Input_Template_File_Link,
|
||||
value: [[workflowStartNodeId, NodeOutputKeyEnum.userFiles]]
|
||||
},
|
||||
{
|
||||
key: NodeInputKeyEnum.aiChatVision,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
label: '',
|
||||
valueType: WorkflowIOValueTypeEnum.boolean,
|
||||
value: true
|
||||
},
|
||||
{
|
||||
key: NodeInputKeyEnum.history,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.numberInput, FlowNodeInputTypeEnum.reference],
|
||||
|
||||
@@ -24,8 +24,7 @@ type AppPropsWithLayout = AppProps & {
|
||||
Component: NextPageWithLayout;
|
||||
};
|
||||
|
||||
// 哪些路由有自定义 Head
|
||||
const routesWithCustomHead = ['/chat', '/chat/share', '/app/detail/', '/dataset/detail'];
|
||||
const routesWithCustomHead = ['/chat', '/chat/share', '/app/detail', '/dataset/detail'];
|
||||
// 哪些路由不需要 Layout
|
||||
const routesWithoutLayout = ['/openapi'];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user