Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ui/src/api/API_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ Workspace、System 资源管理和 System 共享资源均在各自 `knowledge/kn
`postKnowledgeHitTest(knowledgeId, payload)`,向知识库的 `/hit_test` 提交 POST,直接返回命中分段数组。
请求使用 `KnowledgeHitTestPayload`,包含 `query_text`、`image_list`、`top_number`、`similarity` 和
`search_mode`;检索模式复用 `KNOWLEDGE_SEARCH_MODE`。文本和图片至少提供一项,图片仅支持向量或混合检索。
结果使用 `KnowledgeHitTestResult`,保留分段、得分及图片命中信息。Workspace 共享暂无对应接口,不回退其他范围。
结果使用 `KnowledgeHitTestResult`,保留分段、得分及图片命中信息;可选 `knowledge_type` 使用 `KnowledgeType` 数字枚举,用于来源图标匹配。Workspace 共享暂无对应接口,不回退其他范围。
向量标签依据 `hit_unit_type`(`KNOWLEDGE_HIT_UNIT_TYPE`):`image` 显示“图片向量”,`text` 显示“文本向量”,图片描述命中也属于文本向量。
`document_resource_type` 表示来源文档类型,`document_image_id` 用于展示图片文档原图,不用于判断命中向量类型。
`query_unit_type` 表示产生该命中的查询输入类型,与 `hit_unit_type` 分别描述查询端和命中端。
Expand Down Expand Up @@ -509,6 +509,7 @@ Chat 协议及认证接口见 [chat/README.md](chat/README.md)。
`ChatLogRecord.question` 与 `messages` 使用该内容项类型,扩展字段保留为 `unknown`。
`paragraph_list` 为 `ChatParagraphSource[]`,后端仅在开启「显示知识来源」或调试、日志时返回;
其 `meta` 在历史快照中可能是 JSON 字符串,使用方需兼容字符串与对象。
分段的 `knowledge_type` 使用可选的 `KnowledgeType` 数字枚举,展示类型映射前先判断字段是否存在。
Chat、Workspace 调试和 System 调试的记录分页及详情均声明 `ChatLogRecord` 返回类型,
消息列表依赖从 `ConversationApiAdapter` 选取对应接口约定。
`conversation-panel/core/stream.ts` 的 `ConversationStream<Chunk>` 通过回调推断分片类型,
Expand Down
4 changes: 2 additions & 2 deletions ui/src/api/types/chat-log.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CHAT_LOG_SOURCE } from '@/api/enums'
import type { Dict } from './common'
import type { DocumentResourceType } from './document'
import type { KnowledgeHitTestAsset } from './knowledge'
import type { KnowledgeHitTestAsset, KnowledgeType } from './knowledge'

export type ChatLogSource = (typeof CHAT_LOG_SOURCE)[keyof typeof CHAT_LOG_SOURCE]

Expand Down Expand Up @@ -77,7 +77,7 @@ export interface ChatParagraphSource {
hit_asset?: KnowledgeHitTestAsset | null
knowledge_id?: string
knowledge_name?: string
knowledge_type?: string
knowledge_type?: KnowledgeType
/** 历史快照中可能为 JSON 字符串 */
meta?: ChatParagraphSourceMeta | string | null
}
Expand Down
1 change: 1 addition & 0 deletions ui/src/api/types/knowledge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ export interface KnowledgeHitTestAsset {

/** 召回测试返回的分段与命中得分。 */
export interface KnowledgeHitTestResult extends ParagraphItem {
knowledge_type?: KnowledgeType | null
document_image_id?: string | null
document_resource_type?: DocumentResourceType | null
knowledge_id: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { computed, ref } from 'vue'
import { DOCUMENT_RESOURCE_TYPE } from '@/api/enums'
import type { ChatParagraphSource, ChatParagraphSourceMeta } from '@/api/types'
import type { ChatParagraphSource, ChatParagraphSourceMeta, DocumentResourceType, KnowledgeType } from '@/api/types'
import { downloadByURL, getFileUrl } from '@/utils/common'
import { MsgInfo } from '@/utils/message'
import { isPdfDocument, type PreviewDocument } from './document-preview/index'
Expand Down Expand Up @@ -28,12 +28,13 @@ export interface KnowledgeSourceParagraph {
vectorLabel: string
imageUrl: string
documentName: string
documentResourceType?: DocumentResourceType | null
documentAction: SourceDocumentAction
/** 来源文档地址,UNAVAILABLE 时为空字符串 */
documentUrl: string
allowDownload: boolean
knowledgeName: string
knowledgeType?: string
knowledgeType?: KnowledgeType
}

// 历史快照中 meta 可能是 JSON 字符串,解析失败按无元数据处理
Expand Down Expand Up @@ -79,6 +80,7 @@ function toSourceParagraph(paragraph: ChatParagraphSource, index: number): Knowl
vectorLabel: paragraph.document_resource_type === DOCUMENT_RESOURCE_TYPE.IMAGE || paragraph.hit_asset ? '图片向量' : '文本向量',
imageUrl: getImageUrl(paragraph),
documentName,
documentResourceType: paragraph.document_resource_type,
documentAction: documentTarget.action,
documentUrl: documentTarget.url,
allowDownload: meta.allow_download !== false,
Expand Down
17 changes: 12 additions & 5 deletions ui/src/conversation-panel/right-sidebar/knowledge-source/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { getFileIconUrl } from '@/utils/icon'
import { DOCUMENT_RESOURCE_TYPE } from '@/api/enums'
import { useRightSidebarStore } from '../index'
import DocumentPreview from './document-preview/index.vue'

Expand Down Expand Up @@ -39,23 +40,29 @@ const { previewDocument, sourceParagraphs, count, openDocument } = knowledgeSour
</div>
</template>

<MdPreview :model-value="paragraph.content" no-img-zoom-in />

<!-- 放大预览召回图片 -->
<el-image
v-if="paragraph.imageUrl"
:src="paragraph.imageUrl"
:alt="paragraph.title"
fit="cover"
class="mt-2 w-full rounded-lg"
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)">
<div class="flex-align-center gap-2">
<img :src="getFileIconUrl(paragraph.documentName)" alt="" width="24" />
<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>

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.

Code Review

Potential Issues

  1. getFileIconUrl signature mismatch risk
    The original call passes only documentName. The new call passes three arguments including a boolean derived from paragraph.documentResourceType === DOCUMENT_RESOURCE_TYPE.IMAGE. Ensure the utility actually accepts these new params (and their order/types match). If not, this will silently produce wrong icons.

  2. paragraph.knowledgeType may be undefined / not part of the type
    Verify the paragraph model declares knowledgeType and documentResourceType. If DOCUMENT_RESOURCE_TYPE isn't exhaustive or these fields are optional, guard with a fallback to avoid runtime surprises.

  3. Order change of MdPreview vs el-image
    Moving MdPreview below the image changes visual/output semantics: previously content rendered before the image, now after. Confirm this is intentional (e.g., captions/image-first layout). Also, if paragraph.content itself contains images, the manual el-image plus markdown images could duplicate rendering — verify no double-render.

  4. fit="contain" + removed width class
    Dropping w-full rounded-lg while switching to contain may collapse the image size for small/portrait images (no explicit width). Consider adding w-full back or explicit max sizing to keep layout consistent.

  5. size-6 vs prior width="24"
    size-6 = 1.5rem (24px assuming default root 16px), so equivalent only if root font-size is default. If the app scales rem, icon size differs from the old fixed 24px. Minor, but worth confirming intent.

Optimization Suggestions

  • Memoize computed booleans rather than inlining the comparison in the template attribute — e.g. derive an isImageResource per item, keeping template cleaner.
  • Accessibility: el-image's alt uses paragraph.title; ensure it's meaningful (empty alt is better for decorative images). Fine as-is if title is descriptive.
  • Overly long inline expression on :src hurts readability; extracting to a helper or computed improves maintainability.
  • Ensure DOCUMENT_RESOURCE_TYPE.IMAGE exists at compile time (typo-safety); importing the enum is good practice.

Summary

Main risks are the changed getFileIconUrl contract, possible undefined fields, and the intentional reorder/style changes. Verify the utility signature and paragraph typing, then this diff is otherwise clean.

Expand Down
4 changes: 3 additions & 1 deletion ui/src/utils/UTILS_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ warning 类型;输入和普通警告弹窗继续直接使用 `ElMessageBox`。

`icon.ts` 的 `getFileExtension()` 返回不含点号的大写后缀,无有效后缀时返回空字符串。
`isImage()`、`isDocument()`、`isAudio()`、`isVideo()` 统一复用 `constants/file-type.ts` 的四组常量。
`getFileIconUrl()` 为文档返回对应后缀图标,为音视频分别返回 `file-audio-icon.svg`、
`getFileIconUrl(fileName, knowledgeType?, isImageType?)` 支持可选的知识库类型和图片标记。
`isImageType` 为 `true` 时优先返回 `file-image-icon.svg`,其次 Web 知识库返回 `web-link-icon.svg`;
未命中时按文件后缀匹配:为文档返回对应后缀图标,为音视频分别返回 `file-audio-icon.svg`、
`file-video-icon.svg`,其他类型回退到 `unknown-icon.svg`;图片预览由调用方单独处理。
DOC、ZIP 保留历史图标兼容,但不加入消息附件的文档类型白名单。
11 changes: 9 additions & 2 deletions ui/src/utils/icon.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/** 提供跨页面复用的文件后缀识别、类型校验和图标匹配函数。 */

import type { KnowledgeType } from '@/api/types'
import { KNOWLEDGE_TYPE_KEY, KNOWLEDGE_TYPE_MAP } from '@/constants/knowledge'
import fileImageIcon from '@/assets/file-type/file-image-icon.svg'
import webLinkIcon from '@/assets/file-type/web-link-icon.svg'
import { IMAGE_EXTENSIONS, DOCUMENT_EXTENSIONS, VIDEO_EXTENSIONS, AUDIO_EXTENSIONS } from '@/constants/file-type'

/** 获取文件名中不含点号的大写后缀;无有效后缀时返回空字符串。 */
Expand Down Expand Up @@ -31,8 +35,11 @@ export function isVideo(fileName: string): boolean {
return VIDEO_EXTENSIONS.includes(getFileExtension(fileName))
}

/** 返回文档或音视频图标 URL;图片由调用方预览,其他类型回退到 unknown 图标。 */
export function getFileIconUrl(fileName: string): string {
/** 返回文件图标 URL;图片标记优先于 Web 知识库类型,未传时按后缀匹配。 */
export function getFileIconUrl(fileName: string, knowledgeType?: KnowledgeType | null, isImageType?: boolean): string {
if (isImageType) return fileImageIcon
if (knowledgeType != null && KNOWLEDGE_TYPE_MAP[knowledgeType] === KNOWLEDGE_TYPE_KEY.WEB) return webLinkIcon

const extension = getFileExtension(fileName)
let iconName = 'unknown'

Expand Down
4 changes: 1 addition & 3 deletions ui/src/views/document-detail/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { provideDocumentDetailContext } from './context'
import type { ParamsPage } from '@/api/admin/core/types'
import type { DocumentItem, ParagraphItem, ParagraphQuery } from '@/api/types'
import { getFileIconUrl } from '@/utils/icon'
import { KNOWLEDGE_TYPE_KEY } from '@/constants/knowledge'
import { MsgConfirm, MsgSuccess } from '@/utils/message'
import { useParagraphSort } from './action-dropdown/move/useParagraphSort'
import CreateParagraphDialog from './paragraph-dialog/CreateParagraphDialog.vue'
Expand Down Expand Up @@ -271,8 +270,7 @@ onMounted(() => {
<!-- 返回文档列表 -->
<el-button text @click="handleBack"><MkIcon name="icon_arrow-left_outlined" :size="20" /></el-button>
<template v-if="documentDetail">
<img v-if="route.params.type === KNOWLEDGE_TYPE_KEY.WEB" src="@/assets/file-type/web-link-icon.svg" alt="" class="size-6 shrink-0" />
<img v-else :src="getFileIconUrl(documentDetail.name)" alt="" class="size-6 shrink-0" />
<img :src="getFileIconUrl(documentDetail.name, documentDetail.type)" alt="" class="size-6 shrink-0" />
</template>
<h4 class="truncate" :title="documentDetail?.name">{{ documentDetail?.name ?? '-' }}</h4>
</div>
Expand Down
7 changes: 5 additions & 2 deletions ui/src/views/knowledge-detail/hit-test/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import type { KnowledgeHitTestPayload, KnowledgeHitTestResult, ParagraphItem } f
import { useKnowledgeDetailContext } from '@/views/knowledge-detail/context'
import ParagraphDialog from '@/views/document-detail/paragraph-dialog/ParagraphDialog.vue'
import emptyHitTestImage from '@/assets/empty/hit-test.png'
import fileImageIcon from '@/assets/file-type/file-image-icon.svg'
import HitTestInput from './components/HitTestInput.vue'
import { getFileUrl } from '@/utils/common'
import { getFileIconUrl } from '@/utils/icon'
Expand Down Expand Up @@ -228,7 +227,11 @@ function testKnowledge(query: Required<Pick<KnowledgeHitTestPayload, 'query_text

<template #footer>
<div class="flex-align-center min-w-0 gap-2 text-sm text-N600">
<img :src="paragraph.isImgaeDoc ? fileImageIcon : getFileIconUrl(paragraph.document_name)" alt="" class="size-4 shrink-0" />
<img
:src="getFileIconUrl(paragraph.document_name, paragraph.knowledge_type, paragraph.isImgaeDoc)"
alt=""
class="size-4 shrink-0"
/>
<span class="truncate" :title="paragraph.document_name">{{ paragraph.document_name }}</span>
</div>
</template>
Expand Down
3 changes: 1 addition & 2 deletions ui/src/views/knowledge-detail/library/document/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,7 @@ onBeforeUnmount(() => {
:disabled="isWorkspaceSharedResource() || !knowledgeDocPermission('docEdit')"
>
<template #prefix>
<img v-if="knowledgeType === KNOWLEDGE_TYPE_KEY.WEB" src="@/assets/file-type/web-link-icon.svg" alt="" class="size-5" />
<img v-else :src="getFileIconUrl(row.name)" alt="" class="size-5" />
<img :src="getFileIconUrl(row.name, row.type)" alt="" class="size-5" />
</template>
</MkEditName>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import type { Dict, DocumentItem, KnowledgeTagUpdatePayload } from '@/api/types'
import { getFileIconUrl } from '@/utils/icon'
import { datetimeFormat } from '@/utils/time'
import { MsgSuccess } from '@/utils/message'
import { isWorkspaceSharedResource,isSystemResource, isSystemSharedResource } from '@/utils/resource-context'
import { isWorkspaceSharedResource, isSystemResource, isSystemSharedResource } from '@/utils/resource-context'
import { perm } from '@/permission'

/**
* 知识库「文档」权限判断
*/
type KnowledgeDocPermissionMethod = | 'docRead' | 'docEdit'
type KnowledgeDocPermissionMethod = 'docRead' | 'docEdit'

function knowledgeDocPermission(method: KnowledgeDocPermissionMethod): boolean {
if (isSystemResource()) return Boolean(perm.knowledge.system[method]())
Expand Down Expand Up @@ -156,7 +156,7 @@ defineExpose({ open })
</el-tabs>
<div class="flex-between gap-3">
<!-- 批量关联或取消关联文档 -->
<el-button plain :disabled="!selectedDocuments.length || loading && !knowledgeDocPermission('docEdit')" @click="handleBatchLinkDocuments">
<el-button plain :disabled="!selectedDocuments.length || (loading && !knowledgeDocPermission('docEdit'))" @click="handleBatchLinkDocuments">
<MkIcon :name="activeTab === 'linked' ? 'icon_unlink_outlined' : 'icon_link-record_outlined'" />
<span>{{ activeTab === 'linked' ? '取消关联' : '关联' }}</span>
</el-button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import MkSearchList from '@/components/mk-search-list/index.vue'
import type { ParamsPage } from '@/api/admin/core/types'
import { DOCUMENT_RESOURCE_TYPE } from '@/api/enums'
import type { DocumentItem, DocumentResourceType, ParagraphItem, ProblemParagraphReference } from '@/api/types'
import { KNOWLEDGE_TYPE_KEY, KNOWLEDGE_TYPE_MAP } from '@/constants/knowledge'
import { getFileUrl } from '@/utils/common'
import { getFileIconUrl } from '@/utils/icon'
import { MsgSuccess } from '@/utils/message'
Expand Down Expand Up @@ -203,13 +202,7 @@ defineExpose({ open })
:alt="row.name"
fit="cover"
/>
<img
v-else-if="KNOWLEDGE_TYPE_MAP[row.type] === KNOWLEDGE_TYPE_KEY.WEB"
src="@/assets/file-type/web-link-icon.svg"
alt=""
class="size-4"
/>
<img v-else :src="getFileIconUrl(row.name)" class="size-4 shrink-0" alt="" />
<img v-else :src="getFileIconUrl(row.name, row.type)" class="size-4 shrink-0" alt="" />
<span class="min-w-0 flex-1 truncate" :title="row.name">{{ row.name }}</span>
<!-- 关联数字 -->
<span v-if="getSelectedCount(row.id)" class="mk-badge">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ import MkEditName from '@/components/mk-edit-name/index.vue'
import { MsgSuccess } from '@/utils/message'
import { useKnowledgeDetailContext } from '@/views/knowledge-detail/context'
import ParagraphDialog from '@/views/document-detail/paragraph-dialog/ParagraphDialog.vue'
import fileImageIcon from '@/assets/file-type/file-image-icon.svg'
import { getFileIconUrl } from '@/utils/icon'
import { getFileUrl } from '@/utils/common'
import { DOCUMENT_RESOURCE_TYPE } from '@/api/enums'
import { KNOWLEDGE_TYPE_KEY, KNOWLEDGE_TYPE_MAP } from '@/constants/knowledge'
import { isWorkspaceSharedResource,isSystemResource, isSystemSharedResource } from '@/utils/resource-context'
import { isWorkspaceSharedResource, isSystemResource, isSystemSharedResource } from '@/utils/resource-context'
import { perm } from '@/permission'

/**
Expand Down Expand Up @@ -158,14 +156,13 @@ defineExpose({ refresh: handleLoadParagraphs })
<div class="flex-align-center gap-2 text-sm text-N600">
<span class="shrink-0">{{ paragraph.content.length }} 字符</span>
<el-divider direction="vertical" />
<img v-if="paragraph.document_resource_type === DOCUMENT_RESOURCE_TYPE.IMAGE" :src="fileImageIcon" class="size-4 shrink-0" />
<img
v-else-if="paragraph.knowledge_type != null && KNOWLEDGE_TYPE_MAP[paragraph.knowledge_type] === KNOWLEDGE_TYPE_KEY.WEB"
src="@/assets/file-type/web-link-icon.svg"
:src="
getFileIconUrl(paragraph.document_name, paragraph.knowledge_type, paragraph.document_resource_type === DOCUMENT_RESOURCE_TYPE.IMAGE)
"
alt=""
class="size-4 shrink-0"
/>
<img v-else :src="getFileIconUrl(paragraph.document_name)" class="size-4 shrink-0" alt="" />
<span class="truncate" :title="paragraph.document_name">{{ paragraph.document_name }}</span>
</div>
</el-card>
Expand All @@ -175,7 +172,7 @@ defineExpose({ refresh: handleLoadParagraphs })
</div>
<template #footer>
<!-- 关联当前问题的分段 -->
<el-button plain :disabled="loading" v-if="knowledgeProblemPermission('problemRelate')" @click="emit('associate')">关联分段</el-button>
<el-button plain :disabled="loading" v-if="knowledgeProblemPermission('problemRelate')" @click="emit('associate')">关联分段</el-button>
<!-- 查看上一个问题 -->
<el-button plain :disabled="loading || !hasPrevious" @click="emit('previous')">上一个</el-button>
<!-- 查看下一个问题 -->

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.

Code Review

1. Unused imports removed — good, but verify

fileImageIcon, KNOWLEDGE_TYPE_KEY, and KNOWLEDGE_TYPE_MAP were removed. Confirm these are no longer referenced elsewhere in the file (e.g., in <script> logic beyond the template). If they were unused, this is a correct cleanup.

2. Signature change of getFileIconUrl — main concern

The call was changed from:

getFileIconUrl(paragraph.document_name)

to:

getFileIconUrl(paragraph.document_name, paragraph.knowledge_type, paragraph.document_resource_type === DOCUMENT_RESOURCE_TYPE.IMAGE)

Potential issues:

  • API contract: Ensure getFileIconUrl in @/utils/icon actually accepts three parameters in that order. If its current signature is (documentName), the extra args are silently ignored and the refactor loses the image/web-link icon distinction.
  • Positional booleans (true for "is image") are error-prone. Consider passing an options object ({ knowledgeType, isImage }) or the whole paragraph for readability and future extensibility.
  • knowledge_type may be null (the old code explicitly guarded paragraph.knowledge_type != null). Make sure getFileIconUrl handles null/undefined gracefully rather than throwing or returning a broken URL.
  • Behavior parity: Previously the web-link check compared KNOWLEDGE_TYPE_MAP[paragraph.knowledge_type] === KNOWLEDGE_TYPE_KEY.WEB. If the mapping/logic now lives inside getFileIconUrl, confirm it resolves the same way (mapped value vs raw key).

3. Template simplification — positive

Collapsing the three-way v-if / v-else-if / v-else into a single computed :src improves readability and reduces duplication. ✔️

  • Minor: the multi-line :src expression adds indentation complexity; extracting a small computed helper (e.g., function paragraphIcon(p)) in <script setup> would make the template cleaner and testable.

4. Whitespace-only change

The el-button line only removed a double space before @click. Harmless; fine to keep, but unrelated to the functional change — consider separating cosmetic diffs from behavioral ones for cleaner history.

Summary

Item Verdict
Removed unused imports ✅ Good (verify truly unused)
Consolidated icon logic ✅ Good, but depends on getFileIconUrl supporting new args
New getFileIconUrl args ⚠️ Verify signature, null handling, and behavioral parity
Positional boolean arg 💡 Suggest options object
Inline multi-line :src 💡 Consider computed function
Whitespace-only edit ℹ️ Separate from functional changes

Key action: Confirm the updated getFileIconUrl implementation exists in @/utils/icon with matching params; otherwise the image/web-link icons will regress.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import DetailContainer from '@/workflow-canvas/execution-details/DetailContainer
import BaseHeader from '@/workflow-canvas/execution-details/BaseHeader.vue'
import type { ExecutionNodeDetail } from '@/workflow-canvas/execution-details/types'
import { getFileIconUrl } from '@/utils/icon'
import { KNOWLEDGE_TYPE } from '@/api/enums'

defineOptions({ name: 'DataSourceWebNodeDetail' })

Expand Down Expand Up @@ -63,8 +64,7 @@ watch(documents, () => {
@click="selectedDocumentIndex = index"
>
<div class="flex-align-center gap-2">
<img v-if="file.meta?.source_type === 'web'" src="@/assets/file-type/web-link-icon.svg" alt="" width="24" />
<img v-else :src="getFileIconUrl(file.name || '')" alt="" width="24" />
<img :src="getFileIconUrl(file.name || '', file.meta?.source_type === 'web' ? KNOWLEDGE_TYPE.WEB : undefined)" alt="" width="24" />
<span class="min-w-0 truncate" :title="file.name">{{ file.name || '-' }}</span>
</div>
</el-card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import DetailContainer from '@/workflow-canvas/execution-details/DetailContainer
import BaseHeader from '@/workflow-canvas/execution-details/BaseHeader.vue'
import type { ExecutionNodeDetail } from '@/workflow-canvas/execution-details/types'
import { getFileIconUrl } from '@/utils/icon'
import { KNOWLEDGE_TYPE } from '@/api/enums'

defineOptions({ name: 'DocumentExtractNodeDetail' })

Expand Down Expand Up @@ -56,8 +57,7 @@ watch(documents, () => {
@click="selectedDocumentIndex = index"
>
<div class="flex-align-center gap-2">
<img v-if="file.meta?.source_type === 'web'" src="@/assets/file-type/web-link-icon.svg" alt="" width="24" />
<img v-else :src="getFileIconUrl(file.name || '')" alt="" width="24" />
<img :src="getFileIconUrl(file.name || '', file.meta?.source_type === 'web' ? KNOWLEDGE_TYPE.WEB : undefined)" alt="" width="24" />
<span class="min-w-0 truncate" :title="file.name">{{ file.name || '-' }}</span>
</div>
</el-card>
Expand Down
Loading
Loading