Repository navigation
fix: details for document segments and images in the shared knowledge base are not displayed #8234
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 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -74,9 +74,10 @@ const { knowledge, resourceApi } = useKnowledgeDetailContext() | |||||||||||||
| /* 图片分段详情:取首个分段,弹窗关闭后卸载。 */ | ||||||||||||||
| const paragraphDialogRef = ref<InstanceType<typeof ParagraphDialog>>() | ||||||||||||||
| const selectedParagraph = ref<ParagraphItem & { source_file_id?: string }>() | ||||||||||||||
| const imageRowClassName = computed(() => (isWorkspaceSharedResource() ? '' : 'cursor-pointer')) | ||||||||||||||
|
|
||||||||||||||
| function handleOpenParagraph(document: DocumentItem, column?: TableColumnCtx<DocumentItem> | null) { | ||||||||||||||
| if (loading.value || operationLoading.value || selectedParagraph.value || column?.type === 'selection') return | ||||||||||||||
| if (isWorkspaceSharedResource() || loading.value || operationLoading.value || selectedParagraph.value || column?.type === 'selection') return | ||||||||||||||
| operationLoading.value = true | ||||||||||||||
| return resourceApi.paragraph | ||||||||||||||
| .getParagraphPage(knowledgeId.value, document.id, { currentPage: 1, pageSize: 1 }) | ||||||||||||||
|
|
@@ -333,7 +334,7 @@ onBeforeUnmount(() => { | |||||||||||||
| @size-change="loadDocuments()" | ||||||||||||||
| @selection-change="handleSelectionChange" | ||||||||||||||
| @row-click="handleOpenParagraph" | ||||||||||||||
| row-class-name="cursor-pointer" | ||||||||||||||
| :row-class-name="imageRowClassName" | ||||||||||||||
| resizable | ||||||||||||||
| > | ||||||||||||||
| <el-table-column type="selection" width="40" reserve-selection v-if="!isWorkspaceSharedResource()" /> | ||||||||||||||
|
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. Code Review1. Bug:
|
||||||||||||||
| Severity | Item |
|---|---|
| Behavior change for shared resources — confirm intent (item 1) | |
| 🟡 Low | Rename imageRowClassName (item 3) |
| 🟡 Low | Verify isWorkspaceSharedResource reactivity inside computed (item 4) |
| ℹ️ Info | Dead column?.type === 'selection' branch for shared resources (item 2) |
| ℹ️ Info | Verify operationLoading reset on error (item 6) |
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 my review of the changes:
Summary
The diff adds a "shared workspace resource" guard that disables paragraph interaction (opening detail, pointer cursor) when the workspace is a shared read-only resource. This is generally reasonable but has a few issues.
Issues & Suggestions
Inconsistent gating — click handler not guarded
cursor-pointerand blockhandleOpenParagraphDetail, but@click="handleClickParagraphCard(paragraph)"still fires. IfhandleClickParagraphCardinternally callshandleOpenParagraphDetail, that's fine; but if it triggers other side effects (selection, navigation), those will still run in shared mode.handleClickParagraphCardrespectsisWorkspaceSharedResource(), or guard at that level for a single source of truth.Batch mode / selection may still be allowed
selectableandactiveclasses are untouched. In shared mode withbatchMode, users can still select paragraphs (checkbox, highlight). Confirm whether batch operations should be disabled in shared mode too — if so, add a guard wherebatchModeis entered/enabled.Repeated
isWorkspaceSharedResource()calls:class) on every render, potentially per card. If it's a cheap computed getter this is fine; if it does any meaningful work (e.g., reading route/store traversal), consider exposing a computed likeisReadOnlyorcanEditParagraphsonce and reuse it in both template and methods.isReadOnly.value/isReadOnlyconsistently.Naming / semantics
isWorkspaceSharedResource()returning "should not edit" is an indirect signal. A dedicated predicate likeisReadOnlyView()orcanInteractWithParagraph()would make intent clearer at call sites.UX feedback
Template class binding readability
cursor-pointerinto an object key while other entries are static is fine but slightly inconsistent with prior style. Optional::class="[ { 'cursor-pointer': !isReadOnly }, { selectable: batchMode, active: batchMode && selectedParagraphIds.includes(paragraph.id), disabled: !paragraph.is_active } ]"disabledclass vs shared-mode visual state!paragraph.is_active, a.disabledstyle is applied. In shared mode, cards are also effectively non-interactive but get no visual cue besides missing pointer cursor. Consider adding a subtle shared/read-only visual state for consistency.Guard placement in
handleOpenParagraphDetaileditDialogMounted.value = trueandnextTick()— good, avoids mounting the dialog unnecessarily. ✅ No issue here.Minor Nit
if (loading.value || isWorkspaceSharedResource()) returnline now silently blocks opening the detail dialog even indetailmode (not justedit). If viewing details was intended to remain available in shared mode (read-only viewing), this is a behavior change worth confirming. If detail viewing should still be allowed, separate the guard:Overall: Functionally OK, but the main risk is partially gated interactions (click handler, batch selection) and a possible unintended block on read-only viewing. Clarify the intended UX and centralize the read-only check.