fix(knowledge): polish chunking-settings debug trigger and strategy hint

The chunking-settings debug trigger and strategy picker had two UX
issues reported by real usage:

- The test button used theme=primary + variant=outline, a combo that
  appears nowhere else in the project. A green-bordered green-text
  pill in the corner of the section header read as a misplaced
  promotional element rather than a secondary action.
- The strategy select's placeholder was "选择策略(默认使用经典递归分块)"
  / "Select strategy (defaults to classic recursive splitting)". Naming
  the fallback strategy inside the placeholder made the empty select
  look as if the user had already picked "classic recursive" — even
  though the value is actually empty.

- Move the debug trigger from the section header into the strategy
  row's right column, stacked below the select. Users meet the test
  action exactly when they're deciding which strategy to use.
- Switch the trigger to a text-style button and override TDesign's
  default hover/focus/active surfaces so the button reads as an inline
  link (text colour shift only, no filled background block).
- Rename the trigger to "测试分块效果" / "Preview chunking" so it
  describes what will be inspected rather than the input source.
- Drop the reference to the fallback strategy inside the placeholder.
  "不填则按长度切分" / "splits by length if left empty" preserves the
  original information about empty-value behaviour without looking
  like a selected option.
- Remove the now-unused 80px right padding the section header reserved
  to keep the old inline trigger clear of the modal close button.
This commit is contained in:
wizardchen
2026-05-07 11:07:00 +08:00
committed by lyingbug
parent d7478094a2
commit c577d0e474
6 changed files with 57 additions and 24 deletions
@@ -1,12 +1,15 @@
<template>
<div class="kb-chunking-debug">
<!-- Compact trigger sits inline with the section header so the test
action stays accessible no matter how far the form has scrolled. -->
<!-- Inline text trigger: sits next to the strategy selector so users
discover the test action exactly when they're thinking about which
strategy to pick. Kept as a text-style button to match the project's
secondary-action convention (no heavy outline / filled treatment). -->
<t-button
type="button"
theme="primary"
variant="outline"
size="small"
variant="text"
size="medium"
class="debug-trigger"
@click="open = true"
>
<template #icon><play-circle-icon /></template>
@@ -356,6 +359,29 @@ const tierTheme = (tier: StrategyTier) => {
flex-shrink: 0;
}
// TDesign's primary text-button renders a filled hover background that
// looks out of place in this right-aligned slot — it reads as a floating
// color block rather than a link. Strip the hover/focus/active surfaces
// and just shift the text colour, giving the trigger a lightweight
// "inline link" feel that matches the rest of the secondary actions.
.debug-trigger {
--td-bg-color-container-hover: transparent;
padding-left: 0;
padding-right: 0;
&:hover,
&:focus,
&.t-is-active,
&:active {
background-color: transparent !important;
color: var(--td-brand-color-hover);
}
&:active {
color: var(--td-brand-color-active);
}
}
.drawer-body {
display: flex;
flex-direction: column;