Skip to content

fix: [Intelligent agent] Floating window embedding. After opening the knowledge source or executing details, the closing button of the floating window and the knowledge source overlap, making it impossible to close the knowledge source drawer - #8211

Merged
shaohuzhang1 merged 1 commit into
v3from
pr@v3@fix_embed
Nov 27, 2026

Conversation

@shaohuzhang1

Copy link
Copy Markdown
Contributor

fix: [Intelligent agent] Floating window embedding. After opening the knowledge source or executing details, the closing button of the floating window and the knowledge source overlap, making it impossible to close the knowledge source drawer

… knowledge source or executing details, the closing button of the floating window and the knowledge source overlap, making it impossible to close the knowledge source drawer
@shaohuzhang1
shaohuzhang1 merged commit a169a9f into v3 Nov 27, 2026
3 of 4 checks passed
@shaohuzhang1
shaohuzhang1 deleted the pr@v3@fix_embed branch November 27, 2026 10:47
" alt="" class="size-6 shrink-0" />
<span class="min-w-0 truncate" :title="paragraph.documentName">{{ paragraph.documentName }}</span>
</div>
</el-card>

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:

Potential Issues

  1. Inconsistent import path / file extension
    import { useViewType } from '@/conversation-panel/view/index.ts' — Most bundlers (Vite/Webpack) resolve without the .ts extension, and other imports in this file omit it (./document-preview/index.vue, ../index, etc.). Including .ts is inconsistent and can break resolution depending on resolve.extensions config or when using TypeScript strict settings with certain module resolution modes (bundler/node16). Drop the extension: @/conversation-panel/view.

  2. viewType may be undefined/null
    The template uses comparisons like viewType === 'EMBED' and viewType !== 'EMBED'. If useViewType() returns undefined or a ref that hasn't resolved yet, both buttons could render (back-button hidden, close-button shown) rather than a sensible default. Consider initializing a default value (e.g., non-embed) inside the composable so the UI behaves predictably on first render.

  3. Loss of reactivity if useViewType returns a plain value
    If useViewType() returns a static string rather than a ref/computed, template updates won't react to changes. Verify it returns a reactive source (or destructure properly if it returns a { viewType } object with a ref — a possible mismatch here).

  4. Inline function call in template re-evaluated per render
    getFileIconUrl(...) is called inline on every render. This is minor but can be extracted to a computed helper/method if the list is large.

Style / Formatting

  1. Reformatting-only churn
    Several blocks (el-image, el-card, img) were re-wrapped purely for line length. These add noise to the diff and make the functional change (the embed back-button) harder to review. Prefer isolating formatting changes from logic changes.

  2. The <img> src expression is now awkwardly wrapped across lines mid-attribute-argument, reducing readability. Extract to a method like getIcon(paragraph):

    const getIcon = (p) => getFileIconUrl(p.documentName, p.knowledgeType, p.documentResourceType === DOCUMENT_RESOURCE_TYPE.IMAGE)

    then <img :src="getIcon(paragraph)" ... />.

UX Observations

  1. Symmetry check — In EMBED mode, back button shows and close button hides; in non-embed, only close shows. That's likely intentional, but confirm closeRightSide() is truly the correct behavior for the back arrow in embed mode (semantically "go back" vs. "close"). Mixing the two actions under one handler may confuse future maintainers.

  2. Accessibility — Icon-only buttons (back / close) should have aria-label or accessible text for screen readers.

Summary of Suggested Changes

  • Remove .ts extension from import.
  • Ensure viewType is reactive and has a safe default.
  • Extract getFileIconUrl(...) into a computed/method.
  • Add aria-labels to icon buttons.
  • Separate pure formatting diffs from logic changes.

<el-button v-if="viewType !== 'EMBED'" text @click="closeRightSide()">
<MkIcon name="icon_close_outlined" size="18" />
</el-button>
</div>

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 a review of the changes:

Irregularities

  • Inconsistent semicolon
    import { useViewType } from '@/conversation-panel/view'; has a trailing semicolon, while the other imports don’t. This is a minor style inconsistency.

  • Icon-only buttons have no accessible name
    Both the back arrow and the close “X” are <el-button> elements with only an icon inside. They should have aria-label (e.g., aria-label="Back" / aria-label="Close"), and optionally title.

Potential Issues

  • Two buttons perform the exact same action
    In EMBED mode you show a back arrow that calls closeRightSide(), and in non-EMBED mode you show a close button that also calls closeRightSide(). The user-facing meaning may be different, but the behavior is identical. Confirm this is intentional; if the back arrow is meant to be “back” rather than “close”, it may need distinct logic.

  • viewType usage in the template depends on its type
    If useViewType() returns a Ref<string>, Vue will auto-unwrap it in the template, so viewType === 'EMBED' works. If you ever use viewType in the script, remember to use viewType.value.

  • Layout / alignment
    Wrapping the h4 in a <div class="flex"> inside the existing flex-between container could change vertical alignment and padding. Make sure the existing CSS still looks correct, especially if the el-button adds extra height or margins.

Optimization Suggestions

  • Use v-else instead of v-if + v-if="!==
    Since the back button and close button are mutually exclusive, you can simplify:

    <el-button v-if="viewType === 'EMBED'" text @click="closeRightSide()">
      <MkIcon name="icon_arrow-left_outlined" size="18" />
    </el-button>
    <el-button v-else text @click="closeRightSide()">
      <MkIcon name="icon_close_outlined" size="18" />
    </el-button>

    This is clearer and avoids double conditionals.

  • Add accessible labels
    Add aria-label and/or title to both buttons.

  • Remove the semicolon for code-style consistency.

  • Consider extracting the conditional icon/button into a small computed property or dedicated component if more variants appear later.

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.

1 participant