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
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,9 +4,10 @@ import { DOCUMENT_RESOURCE_TYPE } from '@/api/enums' | |
| import { useRightSidebarStore } from '../index' | ||
| import DocumentPreview from './document-preview/index.vue' | ||
| import { getFileIconUrl } from '@/utils/icon' | ||
| import { useViewType } from '@/conversation-panel/view/index.ts' | ||
|
|
||
| defineOptions({ name: 'KnowledgeSource' }) | ||
|
|
||
| const viewType = useViewType() | ||
| const { t } = useI18n({ useScope: 'global' }) | ||
| const { knowledgeSource, closeRightSide } = useRightSidebarStore() | ||
| const { previewDocument, sourceParagraphs, count, openDocument } = knowledgeSource | ||
|
|
@@ -18,9 +19,14 @@ const { previewDocument, sourceParagraphs, count, openDocument } = knowledgeSour | |
| <!-- 分段列表预览文档时仅隐藏不卸载,返回后保留滚动位置 --> | ||
| <div class="flex-column h-full" :class="{ invisible: previewDocument }"> | ||
| <div class="flex-between shrink-0 px-6 py-4 border-b"> | ||
| <h4>{{ t('chat.knowledgeSource.label') }} ({{ count }})</h4> | ||
| <div class="flex"> | ||
| <el-button v-if="viewType === 'EMBED'" text @click="closeRightSide()"> | ||
| <MkIcon name="icon_arrow-left_outlined" size="18" /> | ||
| </el-button> | ||
| <h4>{{ t('chat.knowledgeSource.label') }} ({{ count }})</h4> | ||
| </div> | ||
| <!-- 关闭知识来源 --> | ||
| <el-button text @click="closeRightSide()"> | ||
| <el-button v-if="viewType !== 'EMBED'" text @click="closeRightSide()"> | ||
| <MkIcon name="icon_close_outlined" size="18" /> | ||
| </el-button> | ||
| </div> | ||
|
|
@@ -43,28 +49,17 @@ const { previewDocument, sourceParagraphs, count, openDocument } = knowledgeSour | |
| </template> | ||
|
|
||
| <!-- 放大预览召回图片 --> | ||
| <el-image | ||
| v-if="paragraph.imageUrl" | ||
| :src="paragraph.imageUrl" | ||
| :alt="paragraph.title" | ||
| fit="contain" | ||
| class="mb-2" | ||
| :preview-src-list="[paragraph.imageUrl]" | ||
| preview-teleported | ||
| /> | ||
| <el-image v-if="paragraph.imageUrl" :src="paragraph.imageUrl" :alt="paragraph.title" fit="contain" | ||
| class="mb-2" :preview-src-list="[paragraph.imageUrl]" preview-teleported /> | ||
|
|
||
| <MdPreview :model-value="paragraph.content" no-img-zoom-in /> | ||
|
|
||
| <!-- 打开来源文档:PDF 在知识来源内预览,其他文件下载,网页来源打开原网址 --> | ||
| <el-card v-if="paragraph.documentName" shadow="never" class="small mt-2 cursor-pointer" @click="openDocument(paragraph)"> | ||
| <el-card v-if="paragraph.documentName" shadow="never" class="small mt-2 cursor-pointer" | ||
| @click="openDocument(paragraph)"> | ||
| <div class="flex-align-center gap-2"> | ||
| <img | ||
| :src=" | ||
| getFileIconUrl(paragraph.documentName, paragraph.knowledgeType, paragraph.documentResourceType === DOCUMENT_RESOURCE_TYPE.IMAGE) | ||
| " | ||
| alt="" | ||
| class="size-6 shrink-0" | ||
| /> | ||
| <img :src="getFileIconUrl(paragraph.documentName, paragraph.knowledgeType, paragraph.documentResourceType === DOCUMENT_RESOURCE_TYPE.IMAGE) | ||
| " alt="" class="size-6 shrink-0" /> | ||
| <span class="min-w-0 truncate" :title="paragraph.documentName">{{ paragraph.documentName }}</span> | ||
| </div> | ||
| </el-card> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's my review of the diff: Potential Issues
Style / Formatting
UX Observations
Summary of Suggested Changes
|
||
|
|
||
There was a problem hiding this comment.
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 havearia-label(e.g.,aria-label="Back"/aria-label="Close"), and optionallytitle.Potential Issues
Two buttons perform the exact same action
In
EMBEDmode 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 typeIf
useViewType()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 the
h4in 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:
This is clearer and avoids double conditionals.
Add accessible labels
Add
aria-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.