Repository navigation
fix: limit AI answer height in workflow execution details - #8235
Conversation
| </el-scrollbar> | ||
| </div> | ||
| </DetailContainer> | ||
| </template> |
There was a problem hiding this comment.
Here is my review of the diff:
Potential Issues
-
Commented-out "thinking process" block left in code
- Instead of commenting out the entire
div, it's cleaner to delete it (or gate it withv-if="false"/ a feature flag). Dead commented markup is a maintenance smell and may confuse reviewers. - If you intend to re-enable it later, add a comment explaining why it's disabled (e.g.,
<!-- Disabled: reasoning_content temporarily hidden -->).
- Instead of commenting out the entire
-
el-scrollbarrequires Element Plus import/registration- Ensure
ElScrollbaris globally registered or explicitly imported. If this component is tree-shaken, an unresolved<el-scrollbar>will fail silently or warn at runtime.
- Ensure
-
max-height="500"unit ambiguity- In Element Plus,
max-heightaccepts a number (interpreted as px) or a string with units. A bare500works but is less explicit. Prefermax-height="500px"for clarity and to avoid confusion across versions.
- In Element Plus,
-
Magic offset classes (
-mr-3,pr-3)- The negative margin + compensating padding pattern is fragile. It ties layout to Tailwind spacing scale and can break if the parent container's padding changes. Consider documenting why this offset exists (scrollbar gutter compensation) or solve it via CSS on the scrollbar itself.
-
v-elsefallback withel-scrollbar- When
data.answeris empty, the scrollbar wrapper still renders around-. That's fine functionally, but the max-height/scroll styling applies even to the trivial placeholder. Minor: consider only wrapping withel-scrollbarinside thev-ifbranch, e.g.:<el-scrollbar v-if="data.answer" max-height="500px">…</el-scrollbar> <template v-else>-</template>
- When
-
view-class="pr-3"— verifyview-classis a supported prop in your installed Element Plus version (it was added around 2.2.x). If on an older version, this prop is ignored and the padding won't apply. -
No exponential/markdown injection concerns changed here, but confirm
MdPreviewsanitizes HTML when renderingdata.answer(user/AI-generated content), since it's now inside a scroll viewport — no functional change, just reaffirming security.
Optimization Suggestions
- Remove the commented-out block entirely, or replace it with a proper conditional (
v-if="showReasoning && data.reasoning_content") so it can be toggled. - Use explicit units:
max-height="500px". - Extract the scroll offset (
-mr-3+pr-3) into a named CSS class (e.g..scroll-gutter) for reuse and clarity. - If long answers are common, consider adding
always(always show scrollbar) to prevent layout shift when content grows past the max height:<el-scrollbar max-height="500px" always>. - Add a
keyor transition only if content toggles frequently; otherwise not needed.
Summary
No blocking bugs, but the primary concerns are: dead commented code, explicit units for max-height, version compatibility of view-class, and fragile negative-margin scroll gutter styling. Addressing these improves maintainability and cross-version safety.
| </el-scrollbar> | ||
| </div> | ||
| </DetailContainer> | ||
| </template> |
There was a problem hiding this comment.
Here's my review of the diff:
Issues / Observations
-
Commented-out block left in place – The "思考过程" (thinking process) section is fully commented out rather than removed. Dead code adds noise and can drift from reality; if it's temporary, add a
TODO/ticket reference. If intentional, consider deleting it (git history preserves it). -
No conditional hiding logic – You comment out the thinking box statically. If
data.reasoning_contentmay or may not be present at runtime, it would be better to usev-if="data.reasoning_content"(and keep one wrapper) instead of hardcoding its absence. This keeps the UI adaptive and avoids maintaining commented code. -
el-scrollbar+ Markdown rendering pitfallsmax-height="500"— confirm whether Element Plus expects a number (px) or string here; passing"500"as a string attribute becomes a string prop. Use:max-height="500"for a typed numeric value.- Height on a scroll container with rendered markdown: tall tables/pre/code blocks may need
word-break/overflow-xhandling. Verify horizontal overflow inside the scrollbar (long code lines). MdPreviewlazy/dynamic content can change height after mount; ensure the scrollbar recalculates (update()ref) if you programmatically set content.
-
Class naming mismatch –
-mr-3/view-class="pr-3"uses Tailwind-style utilities. Ensure these classes exist in your build pipeline when applied both to theel-scrollbarroot and toview-class(the inner wrapper). Double-check that negative margin on the outer element doesn't clip the scrollbar track. -
Accessibility – The scroll region has no accessible label. Consider
aria-label="{{ t('workflow.answer.aiLabel') }}"or similar on the scrollable area so screen readers identify it. -
<template v-else>-</template>– Fine, but ensure the fallback renders inside the newel-scrollbarwrapper as intended (it does in this diff; just confirm visual alignment vs. previous plain<div>). -
Diff hunk header
@@ -64,20 +64,20 @@ defineProps<{– Unusual hunk context; verify the surrounding template structure (matching tags) is intact after edits, since commenting only the inner div but not checking indentation across the block could leave stray whitespace/newline differences.
Optimization suggestions
- Prefer
v-if="data.reasoning_content"over static commenting if visibility depends on data. - Use
:max-height="500"(bind) instead ofmax-height="500". - Add
alwaysor hide-on-pause options only if needed (avoid unnecessary scrollbar chrome for short answers). - Extract the repeated
mk-gray-card-smcard wrapper into a small component/slot if this pattern recurs. - If long answers are common, consider virtualization or a "show more" collapse beyond 500px for better UX.
Summary
The change itself (wrapping the answer in a scrollbar) is reasonable, but don't leave commented-out code, bind max-height numerically, and verify markdown overflow + scrollbar recalculation. Consider replacing the comment with a functional v-if.
| </el-scrollbar> | ||
| </div> | ||
| </DetailContainer> | ||
| </template> |
There was a problem hiding this comment.
Review Findings
1. Commented-out code left in template
The "thinking process" block is commented out rather than removed. If this is temporary, fine — but it should not be committed as dead code. Either:
- Delete it if the feature is permanently gone, or
- Gate it with a feature flag /
v-ifso it can be re-enabled cleanly.
Leaving large commented template blocks hurts maintainability and review clarity.
2. Inconsistent scroll behavior
Only the answer card now uses <el-scrollbar>; the hidden thinking process card (when re-enabled) would not. Consider extracting a reusable wrapper/component so both cards behave consistently, avoiding drift later.
3. Layout dependency on negative margin (-mr-3 + pr-3)
The -mr-3 view-class="pr-3" combo is a common pattern to hide the scrollbar gutter, but it's fragile:
- It hardcodes Tailwind spacing scale; if container padding changes, alignment breaks.
- It relies on Element Plus
el-scrollbarinternal structure (view class). This is not part of its public API contract strictly — pin the EP version or document it. - Recommend a scoped CSS utility instead (e.g.,
.hide-scrollbar-gutter) for clarity and stability.
4. max-height="500" unit omission
Element Plus accepts a number and appends px, but being explicit helps readability and avoids confusion:
<el-scrollbar max-height="500px" ...>5. Accessibility / UX
- Scrollable regions should ideally be keyboard-focusable.
el-scrollbarcontent isn't focusable by default; long markdown answers may be hard to navigate for keyboard users. Considertabindex="0"on the wrapper or verifying focus behavior. - No visual affordance that content is scrollable when it overflows (minor).
6. Performance consideration for MdPreview
Markdown rendering inside a scroll region is fine, but:
- If
data.answerupdates frequently (streaming), re-rendering full markdown on every chunk can be costly. Confirm whether throttling/debouncing is handled upstream. - Also verify
MdPreviewdoesn't query DOM dimensions per render (common source of layout thrash with scroll containers).
7. Duplication
Both cards share the same structure (mk-gray-card-sm → h6 → content w/ fallback template {{ '-' }}). Extract a small GrayCard component — reduces duplication and keeps the fallback logic in one place.
8. Minor: empty-state placement
With el-scrollbar, an empty answer shows - inside a scroll container, which may produce a slight height/scroll oddity. Confirm the empty state renders without unexpected scrollbars.
Suggested refactor sketch
<GrayCard :title="t('workflow.answer.aiLabel')">
<el-scrollbar max-height="500px" class="hide-scrollbar-gutter" tabindex="0">
<div class="space-y-2 pr-3">
<MdPreview v-if="data.answer" :model-value="data.answer" noImgZoomIn />
<template v-else>-</template>
</div>
</el-scrollbar>
</GrayCard>with
.hide-scrollbar-gutter { margin-right: -0.75rem; }Summary: Main issues are (a) dead commented code, (b) fragile negative-margin scrollbar hack tied to Tailwind scale, (c) missing accessibility/focus handling for scrollable content, and (d) duplication ripe for extraction. None are blocking, but they're worth addressing before merge.
fix: limit AI answer height in workflow execution details