Repository navigation
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
Conversation
… 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
| " alt="" class="size-6 shrink-0" /> | ||
| <span class="min-w-0 truncate" :title="paragraph.documentName">{{ paragraph.documentName }}</span> | ||
| </div> | ||
| </el-card> |
There was a problem hiding this comment.
Here's my review of the diff:
Potential Issues
-
Inconsistent import path / file extension
import { useViewType } from '@/conversation-panel/view/index.ts'— Most bundlers (Vite/Webpack) resolve without the.tsextension, and other imports in this file omit it (./document-preview/index.vue,../index, etc.). Including.tsis inconsistent and can break resolution depending onresolve.extensionsconfig or when using TypeScript strict settings with certain module resolution modes (bundler/node16). Drop the extension:@/conversation-panel/view. -
viewTypemay be undefined/null
The template uses comparisons likeviewType === 'EMBED'andviewType !== 'EMBED'. IfuseViewType()returnsundefinedor 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. -
Loss of reactivity if
useViewTypereturns a plain value
IfuseViewType()returns a static string rather than aref/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). -
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
-
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. -
The
<img>src expression is now awkwardly wrapped across lines mid-attribute-argument, reducing readability. Extract to a method likegetIcon(paragraph):const getIcon = (p) => getFileIconUrl(p.documentName, p.knowledgeType, p.documentResourceType === DOCUMENT_RESOURCE_TYPE.IMAGE)
then
<img :src="getIcon(paragraph)" ... />.
UX Observations
-
Symmetry check — In
EMBEDmode, back button shows and close button hides; in non-embed, only close shows. That's likely intentional, but confirmcloseRightSide()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. -
Accessibility — Icon-only buttons (
back/close) should havearia-labelor accessible text for screen readers.
Summary of Suggested Changes
- Remove
.tsextension from import. - Ensure
viewTypeis 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> |
There was a problem hiding this comment.
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 havearia-label(e.g.,aria-label="Back"/aria-label="Close"), and optionallytitle.
Potential Issues
-
Two buttons perform the exact same action
InEMBEDmode you show a back arrow that callscloseRightSide(), and in non-EMBEDmode you show a close button that also callscloseRightSide(). 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. -
viewTypeusage in the template depends on its type
IfuseViewType()returns aRef<string>, Vue will auto-unwrap it in the template, soviewType === 'EMBED'works. If you ever useviewTypein the script, remember to useviewType.value. -
Layout / alignment
Wrapping theh4in a<div class="flex">inside the existingflex-betweencontainer could change vertical alignment and padding. Make sure the existing CSS still looks correct, especially if theel-buttonadds extra height or margins.
Optimization Suggestions
-
Use
v-elseinstead ofv-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
Addaria-labeland/ortitleto 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.
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