Skip to content

fix: limit AI answer height in workflow execution details - #8235

Merged
wangdan-fit2cloud merged 1 commit into
v3from
pr@v3@fix_execution
Nov 30, 2026
Merged

wangdan-fit2cloud merged 1 commit into
v3from
pr@v3@fix_execution

Conversation

@shaohuzhang1

Copy link
Copy Markdown
Contributor

fix: limit AI answer height in workflow execution details

</el-scrollbar>
</div>
</DetailContainer>
</template>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is my review of the diff:

Potential Issues

  1. Commented-out "thinking process" block left in code

    • Instead of commenting out the entire div, it's cleaner to delete it (or gate it with v-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 -->).
  2. el-scrollbar requires Element Plus import/registration

    • Ensure ElScrollbar is globally registered or explicitly imported. If this component is tree-shaken, an unresolved <el-scrollbar> will fail silently or warn at runtime.
  3. max-height="500" unit ambiguity

    • In Element Plus, max-height accepts a number (interpreted as px) or a string with units. A bare 500 works but is less explicit. Prefer max-height="500px" for clarity and to avoid confusion across versions.
  4. 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.
  5. v-else fallback with el-scrollbar

    • When data.answer is 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 with el-scrollbar inside the v-if branch, e.g.:
      <el-scrollbar v-if="data.answer" max-height="500px">…</el-scrollbar>
      <template v-else>-</template>
  6. view-class="pr-3" — verify view-class is 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.

  7. No exponential/markdown injection concerns changed here, but confirm MdPreview sanitizes HTML when rendering data.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 key or 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>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's my review of the diff:

Issues / Observations

  1. 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).

  2. No conditional hiding logic – You comment out the thinking box statically. If data.reasoning_content may or may not be present at runtime, it would be better to use v-if="data.reasoning_content" (and keep one wrapper) instead of hardcoding its absence. This keeps the UI adaptive and avoids maintaining commented code.

  3. el-scrollbar + Markdown rendering pitfalls

    • max-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-x handling. Verify horizontal overflow inside the scrollbar (long code lines).
    • MdPreview lazy/dynamic content can change height after mount; ensure the scrollbar recalculates (update() ref) if you programmatically set content.
  4. 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 the el-scrollbar root and to view-class (the inner wrapper). Double-check that negative margin on the outer element doesn't clip the scrollbar track.

  5. 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.

  6. <template v-else>-</template> – Fine, but ensure the fallback renders inside the new el-scrollbar wrapper as intended (it does in this diff; just confirm visual alignment vs. previous plain <div>).

  7. 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 of max-height="500".
  • Add always or hide-on-pause options only if needed (avoid unnecessary scrollbar chrome for short answers).
  • Extract the repeated mk-gray-card-sm card 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>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-if so 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-scrollbar internal 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-scrollbar content isn't focusable by default; long markdown answers may be hard to navigate for keyboard users. Consider tabindex="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.answer updates frequently (streaming), re-rendering full markdown on every chunk can be costly. Confirm whether throttling/debouncing is handled upstream.
  • Also verify MdPreview doesn'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.

@wangdan-fit2cloud
wangdan-fit2cloud merged commit 00f9d09 into v3 Nov 30, 2026
3 of 4 checks passed
@wangdan-fit2cloud
wangdan-fit2cloud deleted the pr@v3@fix_execution branch November 30, 2026 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants