发布

  • [OPIK-5931] [FE] feat: rework agent configuration form expanded/collapsed state (#6290)

    frostbyte_neo 发布于 2026-04-15 13:41:59 +00:00

    • [OPIK-5931] [FE] feat: rework agent configuration form expanded/collapsed state

    Consolidate the expand/collapse chevron onto the FieldSection primary row
    across all expandable fields (long scalars, text prompts, chat prompts),
    removing the inner CollapsibleBlock chevrons in "Prompt", "System" and
    "User" secondary headers. Chevron sits to the left of the type icon with a
    reserved 14px slot so expandable and non-expandable fields stay aligned,
    and field bodies are indented (pl-5) so values line up with the type icon
    column rather than the chevron.

    Wrap every scalar value in a SettingBlock body (rounded-md border bg-
    primary-foreground) in both read and edit modes — including numbers,
    booleans and short strings — matching the updated Figma design. When a
    field is collapsed, the SettingBlock body still shows a single-line
    truncated preview instead of disappearing. When expanded, scalars render
    a ghost Input inside the body to avoid double borders.

    Move the boolean Switch to the primary row next to the label (new
    afterLabel slot on FieldSection) using the sm size (h-5 w-9), so it fits
    the header height. Replace the BlueprintValueType.BOOLEAN type icon
    (ToggleLeft) with Split to match the Figma icon-split. Render boolean
    values as "True"/"False" (title case) via formatBlueprintValue so the
    read-mode display reads naturally.

    Implements OPIK-5931: Improve expanded/collapsed state of the agent
    configuration form.

    • fix(agent-config): use white background for scalar value body in edit mode

    Switch scalar value SettingBlock body from bg-primary-foreground to
    bg-background in edit mode so string/number fields use a white
    surface. Chat prompt message boxes are untouched.

    • fix(agent-config): hide expandable bodies when collapsed, default prompts collapsed
    • Collapsed expandable fields (long scalars, text prompts, chat prompts)
      render nothing below the primary row, matching the new design.
      Non-expandable scalars (bool/int/float/short string) still render
      inline as before.
    • On first data load, prompts default to collapsed while scalar
      multi-line fields default to expanded. useFieldsCollapse gains an
      initiallyExpandedKeys option, surfaced via AgentConfigurationEditView
      state and wired through all three callers (detail view, edit panel,
      trace list fallback) plus the AgentRunner seed state.
    • Read-only AgentConfigurationDetailView separator uses my-4 so the
      first field sits 16px below the divider.
    • BlueprintChatMessages / SortableMessage no longer track an expanded
      prop since collapsed chat prompts are now dropped upstream.
    • fix(agent-config): collapse all expandable fields by default

    Revert the split-default behavior and drop the initiallyExpandedKeys
    scaffolding (plus the collectNonPromptMultiLineKeys helper it was used
    for). Every expandable field — long strings, text prompts, chat prompts
    — now starts collapsed, and useFieldsCollapse is back to its simpler
    collapsibleKeys/defaultExpanded shape.

    • refactor(agent-config): gate loader on expanded state, drop unused CollapsibleBlock
    • Flip the early returns in BlueprintValuePromptCompact so collapsed
      prompt fields return null before the isPending/Loader check. Avoids
      briefly flashing a spinner in every collapsed prompt on first load
      while usePromptByCommit resolves. Hooks still run, so the prefetch
      and useImperativeHandle ref registration are unaffected.
    • Delete fields/CollapsibleBlock.tsx — the refactor moved all expand/
      collapse mechanics into FieldSection, leaving CollapsibleBlock with
      no importers in the repo.
    下载附件