From 607e77e0a74ce627360a3031bf7d48af04aa4953 Mon Sep 17 00:00:00 2001 From: twwu Date: Tue, 6 Jan 2026 15:18:15 +0800 Subject: [PATCH] feat: add human input form divider background color and enhance chat answer component layout --- .../base/chat/chat/answer/index.tsx | 350 ++++++++++++------ web/tailwind-common-config.ts | 1 + web/themes/manual-dark.css | 1 + web/themes/manual-light.css | 1 + 4 files changed, 238 insertions(+), 115 deletions(-) diff --git a/web/app/components/base/chat/chat/answer/index.tsx b/web/app/components/base/chat/chat/answer/index.tsx index b6c4a2bed3..e9a24d10a5 100644 --- a/web/app/components/base/chat/chat/answer/index.tsx +++ b/web/app/components/base/chat/chat/answer/index.tsx @@ -72,6 +72,8 @@ const Answer: FC = ({ humanInputFilledFormDataList, } = item const hasAgentThoughts = !!agent_thoughts?.length + const hasHumanInputs = !!humanInputFormDataList?.length || !!humanInputFilledFormDataList?.length + const hasHumanInputFormSubmitted = !!humanInputFilledFormDataList?.length const [containerWidth, setContainerWidth] = useState(0) const [contentWidth, setContentWidth] = useState(0) @@ -139,122 +141,240 @@ const Answer: FC = ({ )}
-
-
- { - !responding && ( - - ) - } - {/** Render workflow process */} - { - workflowProcess && ( - - ) - } - { - responding && contentIsEmpty && !hasAgentThoughts && ( -
- -
- ) - } - { - humanInputFormDataList && humanInputFormDataList.length > 0 && ( - - ) - } - { - humanInputFilledFormDataList && humanInputFilledFormDataList.length > 0 && ( - - ) - } - { - !contentIsEmpty && !hasAgentThoughts && ( - - ) - } - { - (hasAgentThoughts) && ( - - ) - } - { - !!allFiles?.length && ( - - ) - } - { - !!message_files?.length && ( - - ) - } - { - annotation?.id && annotation.authorName && ( - - ) - } - - { - !!citation?.length && !responding && ( - - ) - } - { - item.siblingCount && item.siblingCount > 1 && item.siblingIndex !== undefined && ( - - ) - } + {/* Block 1: Workflow Process + Human Input Forms */} + {hasHumanInputs && ( +
+
+ {/** Render workflow process */} + { + workflowProcess && ( + + ) + } + { + humanInputFormDataList && humanInputFormDataList.length > 0 && ( + + ) + } + { + humanInputFilledFormDataList && humanInputFilledFormDataList.length > 0 && ( + + ) + } +
-
+ )} + + {/* Block 2: Response Content (when human inputs exist) */} + {hasHumanInputFormSubmitted && ( +
+
+
+ { + !responding && ( + + ) + } + { + responding && contentIsEmpty && !hasAgentThoughts && ( +
+ +
+ ) + } + { + !contentIsEmpty && !hasAgentThoughts && ( + + ) + } + { + hasAgentThoughts && ( + + ) + } + { + !!allFiles?.length && ( + + ) + } + { + !!message_files?.length && ( + + ) + } + { + annotation?.id && annotation.authorName && ( + + ) + } + + { + !!citation?.length && !responding && ( + + ) + } + { + item.siblingCount && item.siblingCount > 1 && item.siblingIndex !== undefined && ( + + ) + } +
+
+ )} + + {/* Original single block layout (when no human inputs) */} + {!hasHumanInputs && ( +
+
+ { + !responding && ( + + ) + } + {/** Render workflow process */} + { + workflowProcess && ( + + ) + } + { + responding && contentIsEmpty && !hasAgentThoughts && ( +
+ +
+ ) + } + { + !contentIsEmpty && !hasAgentThoughts && ( + + ) + } + { + hasAgentThoughts && ( + + ) + } + { + !!allFiles?.length && ( + + ) + } + { + !!message_files?.length && ( + + ) + } + { + annotation?.id && annotation.authorName && ( + + ) + } + + { + !!citation?.length && !responding && ( + + ) + } + { + item.siblingCount && item.siblingCount > 1 && item.siblingIndex !== undefined && ( + + ) + } +
+
+ )}
diff --git a/web/tailwind-common-config.ts b/web/tailwind-common-config.ts index d9a77ca79d..d9c554ec86 100644 --- a/web/tailwind-common-config.ts +++ b/web/tailwind-common-config.ts @@ -139,6 +139,7 @@ const config = { 'billing-plan-card-premium-bg': 'var(--color-billing-plan-card-premium-bg)', 'billing-plan-card-enterprise-bg': 'var(--color-billing-plan-card-enterprise-bg)', 'knowledge-pipeline-creation-footer-bg': 'var(--color-knowledge-pipeline-creation-footer-bg)', + 'chat-answer-human-input-form-divider-bg': 'var(--color-chat-answer-human-input-form-divider-bg)', }, animation: { 'spin-slow': 'spin 2s linear infinite', diff --git a/web/themes/manual-dark.css b/web/themes/manual-dark.css index 30ee93668e..d0a4789901 100644 --- a/web/themes/manual-dark.css +++ b/web/themes/manual-dark.css @@ -80,4 +80,5 @@ html[data-theme="dark"] { --color-billing-plan-card-premium-bg: linear-gradient(180deg, #F90 0%, rgba(255, 153, 0, 0.00) 100%); --color-billing-plan-card-enterprise-bg: linear-gradient(180deg, #03F 0%, rgba(0, 51, 255, 0.00) 100%); --color-knowledge-pipeline-creation-footer-bg: linear-gradient(90deg, rgba(34, 34, 37, 1) 4.89%, rgba(0, 0, 0, 0) 100%); + --color-chat-answer-human-input-form-divider-bg: linear-gradient(0deg, rgba(200, 206, 218, 0.14) 0%, rgba(0, 0, 0, 0) 212.5%); } diff --git a/web/themes/manual-light.css b/web/themes/manual-light.css index 74eff30892..85b7d26dcd 100644 --- a/web/themes/manual-light.css +++ b/web/themes/manual-light.css @@ -80,4 +80,5 @@ html[data-theme="light"] { --color-billing-plan-card-premium-bg: linear-gradient(180deg, #F90 0%, rgba(255, 153, 0, 0.00) 100%); --color-billing-plan-card-enterprise-bg: linear-gradient(180deg, #03F 0%, rgba(0, 51, 255, 0.00) 100%); --color-knowledge-pipeline-creation-footer-bg: linear-gradient(90deg, #FCFCFD 4.89%, rgba(255, 255, 255, 0.00) 100%); + --color-chat-answer-human-input-form-divider-bg: linear-gradient(0deg, rgba(16, 24, 40, 0.08) 0%, rgba(255, 255, 255, 0.00) 212.5%); }