diff --git a/web/app/components/app/text-generate/item/index.tsx b/web/app/components/app/text-generate/item/index.tsx index d65587fe75..7da907210e 100644 --- a/web/app/components/app/text-generate/item/index.tsx +++ b/web/app/components/app/text-generate/item/index.tsx @@ -58,6 +58,7 @@ export type IGenerationItemProps = { innerClassName?: string contentClassName?: string footerClassName?: string + hideProcessDetail?: boolean } export const SimpleBtn = ({ className, isDisabled, onClick, children }: { @@ -108,6 +109,7 @@ const GenerationItem: FC = ({ varList, innerClassName, contentClassName, + hideProcessDetail, }) => { const { t } = useTranslation() const params = useParams() @@ -291,7 +293,7 @@ const GenerationItem: FC = ({
{workflowProcessData && ( - + )} {workflowProcessData && !isError && ( diff --git a/web/app/components/base/chat/chat-with-history/chat-wrapper.tsx b/web/app/components/base/chat/chat-with-history/chat-wrapper.tsx index 9e20bddada..99c106293d 100644 --- a/web/app/components/base/chat/chat-with-history/chat-wrapper.tsx +++ b/web/app/components/base/chat/chat-with-history/chat-wrapper.tsx @@ -140,6 +140,7 @@ const ChatWrapper = () => { allToolIcons={appMeta?.tool_icons || {}} onFeedback={handleFeedback} suggestedQuestions={suggestedQuestions} + hideProcessDetail /> ) } diff --git a/web/app/components/base/chat/chat/answer/index.tsx b/web/app/components/base/chat/chat/answer/index.tsx index d338efc7e5..f2739f6374 100644 --- a/web/app/components/base/chat/chat/answer/index.tsx +++ b/web/app/components/base/chat/chat/answer/index.tsx @@ -31,6 +31,7 @@ type AnswerProps = { allToolIcons?: Record showPromptLog?: boolean chatAnswerContainerInner?: string + hideProcessDetail?: boolean } const Answer: FC = ({ item, @@ -42,6 +43,7 @@ const Answer: FC = ({ allToolIcons, showPromptLog, chatAnswerContainerInner, + hideProcessDetail, }) => { const { t } = useTranslation() const { @@ -129,7 +131,7 @@ const Answer: FC = ({ } { workflowProcess && ( - + ) } { diff --git a/web/app/components/base/chat/chat/answer/workflow-process.tsx b/web/app/components/base/chat/chat/answer/workflow-process.tsx index 43f412b50f..4eef0b938f 100644 --- a/web/app/components/base/chat/chat/answer/workflow-process.tsx +++ b/web/app/components/base/chat/chat/answer/workflow-process.tsx @@ -18,12 +18,14 @@ type WorkflowProcessProps = { grayBg?: boolean expand?: boolean hideInfo?: boolean + hideProcessDetail?: boolean } const WorkflowProcessItem = ({ data, grayBg, expand = false, hideInfo = false, + hideProcessDetail = false, }: WorkflowProcessProps) => { const { t } = useTranslation() const [collapse, setCollapse] = useState(!expand) @@ -94,6 +96,7 @@ const WorkflowProcessItem = ({
)) diff --git a/web/app/components/base/chat/chat/index.tsx b/web/app/components/base/chat/chat/index.tsx index 4c9718de7f..a66074e8ba 100644 --- a/web/app/components/base/chat/chat/index.tsx +++ b/web/app/components/base/chat/chat/index.tsx @@ -54,6 +54,7 @@ export type ChatProps = { chatNode?: ReactNode onFeedback?: (messageId: string, feedback: Feedback) => void chatAnswerContainerInner?: string + hideProcessDetail?: boolean } const Chat: FC = ({ config, @@ -78,6 +79,7 @@ const Chat: FC = ({ chatNode, onFeedback, chatAnswerContainerInner, + hideProcessDetail, }) => { const { t } = useTranslation() const { currentLogItem, setCurrentLogItem, showPromptLogModal, setShowPromptLogModal, showAgentLogModal, setShowAgentLogModal } = useAppStore(useShallow(state => ({ @@ -204,6 +206,7 @@ const Chat: FC = ({ allToolIcons={allToolIcons} showPromptLog={showPromptLog} chatAnswerContainerInner={chatAnswerContainerInner} + hideProcessDetail={hideProcessDetail} /> ) } diff --git a/web/app/components/share/text-generation/result/index.tsx b/web/app/components/share/text-generation/result/index.tsx index 8678e65ea5..cf6c31c6c3 100644 --- a/web/app/components/share/text-generation/result/index.tsx +++ b/web/app/components/share/text-generation/result/index.tsx @@ -332,6 +332,7 @@ const Result: FC = ({ taskId={isCallBatchAPI ? ((taskId as number) < 10 ? `0${taskId}` : `${taskId}`) : undefined} controlClearMoreLikeThis={controlClearMoreLikeThis} isShowTextToSpeech={isShowTextToSpeech} + hideProcessDetail /> ) diff --git a/web/app/components/workflow/nodes/llm/components/config-prompt.tsx b/web/app/components/workflow/nodes/llm/components/config-prompt.tsx index b79ecfa62a..6a76a58a43 100644 --- a/web/app/components/workflow/nodes/llm/components/config-prompt.tsx +++ b/web/app/components/workflow/nodes/llm/components/config-prompt.tsx @@ -146,7 +146,7 @@ const ConfigPrompt: FC = ({ { - if ((payload as PromptItem[])?.[0].role === PromptRole.system && list[0].p.role !== PromptRole.system) + if ((payload as PromptItem[])?.[0].role === PromptRole.system && list[0].p?.role !== PromptRole.system) return onChange(list.map(item => item.p)) diff --git a/web/app/components/workflow/nodes/llm/default.ts b/web/app/components/workflow/nodes/llm/default.ts index e68b0cb318..803add6f00 100644 --- a/web/app/components/workflow/nodes/llm/default.ts +++ b/web/app/components/workflow/nodes/llm/default.ts @@ -44,7 +44,14 @@ const nodeDefault: NodeDefault = { if (!errorMessages && !payload.memory) { const isChatModel = payload.model.mode === 'chat' - const isPromptyEmpty = isChatModel ? !(payload.prompt_template as PromptItem[]).some(t => t.text !== '') : (payload.prompt_template as PromptItem).text === '' + const isPromptyEmpty = isChatModel + ? !(payload.prompt_template as PromptItem[]).some((t) => { + if (t.edition_type === EditionType.jinja2) + return t.jinja2_text !== '' + + return t.text !== '' + }) + : ((payload.prompt_template as PromptItem).edition_type === EditionType.jinja2 ? (payload.prompt_template as PromptItem).jinja2_text === '' : (payload.prompt_template as PromptItem).text === '') if (isPromptyEmpty) errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t('workflow.nodes.llm.prompt') }) } diff --git a/web/app/components/workflow/run/node.tsx b/web/app/components/workflow/run/node.tsx index 237ac1c3de..fbab1b342f 100644 --- a/web/app/components/workflow/run/node.tsx +++ b/web/app/components/workflow/run/node.tsx @@ -1,7 +1,7 @@ 'use client' import { useTranslation } from 'react-i18next' import type { FC } from 'react' -import { useEffect, useState } from 'react' +import { useCallback, useEffect, useState } from 'react' import cn from 'classnames' import BlockIcon from '../block-icon' import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor' @@ -14,10 +14,20 @@ import type { NodeTracing } from '@/types/workflow' type Props = { nodeInfo: NodeTracing hideInfo?: boolean + hideProcessDetail?: boolean } -const NodePanel: FC = ({ nodeInfo, hideInfo = false }) => { - const [collapseState, setCollapseState] = useState(true) +const NodePanel: FC = ({ + nodeInfo, + hideInfo = false, + hideProcessDetail, +}) => { + const [collapseState, doSetCollapseState] = useState(true) + const setCollapseState = useCallback((state: boolean) => { + if (hideProcessDetail) + return + doSetCollapseState(state) + }, [hideProcessDetail]) const { t } = useTranslation() const getTime = (time: number) => { @@ -39,7 +49,7 @@ const NodePanel: FC = ({ nodeInfo, hideInfo = false }) => { useEffect(() => { setCollapseState(!nodeInfo.expand) - }, [nodeInfo.expand]) + }, [nodeInfo.expand, setCollapseState]) return (
@@ -52,12 +62,15 @@ const NodePanel: FC = ({ nodeInfo, hideInfo = false }) => { )} onClick={() => setCollapseState(!collapseState)} > - + {!hideProcessDetail && ( + + )} +
= ({ nodeInfo, hideInfo = false }) => { )} {nodeInfo.status === 'running' && (
- - Running + Running +
)}
- {!collapseState && ( + {!collapseState && !hideProcessDetail && (
{nodeInfo.status === 'stopped' && (