From e0fc51850bb14772ac8de7dc52630b9d66db8434 Mon Sep 17 00:00:00 2001 From: wusumac <736139669@qq.com> Date: Thu, 17 Sep 2026 08:16:46 +0800 Subject: [PATCH] fix(web): stop repeating the ask inside a requirement card The card showed the same sentence up to four times: as the title, in the 'your ask' block, in a separate 'original ask' block and again as the opening human message in the timeline. Now the ask appears once at the top (clamped to three lines while collapsed, full text when expanded) and the opening human message is hidden inside the process view. --- .../components/teams/TeamRequirementCard.tsx | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/web/src/components/teams/TeamRequirementCard.tsx b/web/src/components/teams/TeamRequirementCard.tsx index f35bca8e..c1648882 100644 --- a/web/src/components/teams/TeamRequirementCard.tsx +++ b/web/src/components/teams/TeamRequirementCard.tsx @@ -39,15 +39,21 @@ export function TeamRequirementCard(props: { const [expanded, setExpanded] = useState(hasPendingDecision) const [showAll, setShowAll] = useState(false) - const milestones = useMemo(() => selectMilestones(messages), [messages]) - const hiddenCount = messages.length - milestones.length + // The opening human message IS the ask shown at the top; hide it here so the + // same sentence is not repeated inside the process. + const openingAskSeq = requirement ? (messages.find((message) => message.fromKind === 'human')?.seq ?? null) : null + const timelineMessages = openingAskSeq === null + ? messages + : messages.filter((message) => message.seq !== openingAskSeq) + const milestones = useMemo(() => selectMilestones(timelineMessages), [timelineMessages]) + const hiddenCount = timelineMessages.length - milestones.length const outcome = requirementOutcome(requirement, tasks, messages) const askText = requirement?.body?.trim() || requirement?.title || null const title = requirement ? requirement.title : t('team.requirement.other') const assignees = Array.from(new Set(tasks .map((task) => props.members.find((member) => member.sessionId === task.assigneeSessionId)?.role) .filter((role): role is string => Boolean(role)))) - const shown = showAll ? messages : milestones + const shown = showAll ? timelineMessages : milestones return (
) : null} - {title} + {askText ? null : ( + {title} + )} {hasPendingDecision ? ( {t('team.reply.pending')} @@ -78,7 +86,9 @@ export function TeamRequirementCard(props: { {askText ? (
{t('team.requirement.yourAsk')}
-
{askText}
+
+ {askText} +
) : null} @@ -138,14 +148,6 @@ export function TeamRequirementCard(props: {
{expanded ? (
- {requirement?.body ? ( -
-
{t('team.requirement.original')}
-
- {requirement.body} -
-
- ) : null}
{showAll ? t('team.requirement.allProcess') : t('team.requirement.milestones')} {hiddenCount > 0 || showAll ? (