2026-01-24 15:24:25 +08:00
|
|
|
|
<template>
|
2026-05-22 00:59:05 +08:00
|
|
|
|
<div class="agent-panel" :class="{ resizing: isResizing }">
|
2026-03-26 06:07:18 +08:00
|
|
|
|
<div class="resize-handle" @pointerdown="startResize"></div>
|
2026-05-29 22:19:58 +08:00
|
|
|
|
<div class="panel-header side-panel__header">
|
2026-05-22 00:59:05 +08:00
|
|
|
|
<div class="panel-title">
|
|
|
|
|
|
<div v-if="hasActivePreview && normalizedPreviewTabs.length" class="preview-tabs-bar">
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-for="tab in normalizedPreviewTabs"
|
|
|
|
|
|
:key="tab.path"
|
|
|
|
|
|
class="preview-tab"
|
|
|
|
|
|
:class="{ active: tab.path === activePreviewPath }"
|
|
|
|
|
|
>
|
|
|
|
|
|
<button
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
class="preview-tab-main"
|
|
|
|
|
|
:title="tab.path"
|
|
|
|
|
|
@click="activatePreviewTab(tab.path)"
|
|
|
|
|
|
>
|
2026-06-05 01:29:34 +08:00
|
|
|
|
<FileTypeIcon :name="tab.path" :size="16" class="preview-tab-icon" />
|
2026-05-22 00:59:05 +08:00
|
|
|
|
<span class="preview-tab-name">{{ tab.name }}</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
class="preview-tab-close"
|
|
|
|
|
|
title="关闭预览"
|
|
|
|
|
|
aria-label="关闭预览"
|
|
|
|
|
|
@click.stop="closePreviewTab(tab.path)"
|
|
|
|
|
|
>
|
|
|
|
|
|
<X :size="13" />
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
2026-04-06 21:04:19 +08:00
|
|
|
|
</div>
|
2026-05-22 00:59:05 +08:00
|
|
|
|
<span v-else><strong>文件</strong></span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="window-actions">
|
|
|
|
|
|
<button
|
|
|
|
|
|
v-if="hasActivePreview"
|
|
|
|
|
|
class="header-action-btn"
|
|
|
|
|
|
:class="{ active: treePaneVisible }"
|
|
|
|
|
|
:title="treePaneVisible ? '隐藏文件列表' : '查看文件列表'"
|
|
|
|
|
|
:aria-label="treePaneVisible ? '隐藏文件列表' : '查看文件列表'"
|
|
|
|
|
|
@click="toggleFileTree"
|
|
|
|
|
|
>
|
2026-05-27 14:51:56 +08:00
|
|
|
|
<Folders :size="15" />
|
2026-05-22 00:59:05 +08:00
|
|
|
|
</button>
|
|
|
|
|
|
<button class="header-action-btn" title="刷新" aria-label="刷新" @click="emitRefresh">
|
|
|
|
|
|
<RefreshCw :size="15" />
|
|
|
|
|
|
</button>
|
2026-01-31 14:16:53 +08:00
|
|
|
|
</div>
|
2026-01-24 15:24:25 +08:00
|
|
|
|
</div>
|
2026-05-22 00:59:05 +08:00
|
|
|
|
|
2026-01-24 15:24:25 +08:00
|
|
|
|
<div class="tab-content">
|
2026-05-31 13:40:15 +08:00
|
|
|
|
<div
|
|
|
|
|
|
class="files-display"
|
|
|
|
|
|
:class="{ 'has-preview': hasActivePreview, 'with-tree': treePaneVisible }"
|
|
|
|
|
|
>
|
2026-05-22 00:59:05 +08:00
|
|
|
|
<div v-if="hasActivePreview" class="preview-pane">
|
|
|
|
|
|
<AgentFilePreview
|
|
|
|
|
|
v-if="currentFile"
|
|
|
|
|
|
containerClass="side-preview-shell"
|
|
|
|
|
|
contentClass="side-file-content"
|
|
|
|
|
|
:file="currentFile"
|
|
|
|
|
|
:filePath="currentFilePath"
|
|
|
|
|
|
:fullHeight="true"
|
|
|
|
|
|
:showFileIcon="false"
|
|
|
|
|
|
:borderless="true"
|
|
|
|
|
|
:showClose="false"
|
|
|
|
|
|
:showDownload="true"
|
|
|
|
|
|
:showFullscreen="true"
|
|
|
|
|
|
@download="downloadFile"
|
|
|
|
|
|
/>
|
|
|
|
|
|
<div v-else class="preview-empty">
|
|
|
|
|
|
<div class="preview-empty-title">选择交付物后可在此预览</div>
|
|
|
|
|
|
<div class="preview-empty-desc">也可以打开文件列表,浏览当前工作区文件。</div>
|
2026-03-26 06:07:18 +08:00
|
|
|
|
</div>
|
2026-05-22 00:59:05 +08:00
|
|
|
|
</div>
|
2026-03-26 06:07:18 +08:00
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
<div v-if="treePaneVisible" class="tree-pane">
|
|
|
|
|
|
<div v-if="!threadId" class="empty">创建对话后可查看工作区</div>
|
|
|
|
|
|
<div v-else-if="loadingFiles" class="empty">正在加载文件系统...</div>
|
|
|
|
|
|
<div v-else-if="filesystemError" class="empty error-state">
|
|
|
|
|
|
<div>{{ filesystemError }}</div>
|
|
|
|
|
|
<a-button type="link" size="small" @click="refreshFileSystem">重试</a-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-else-if="!fileTreeData.length" class="empty">当前工作区为空</div>
|
|
|
|
|
|
<div v-else class="file-tree-container">
|
|
|
|
|
|
<FileTreeComponent
|
|
|
|
|
|
v-model:selectedKeys="selectedKeys"
|
|
|
|
|
|
v-model:expandedKeys="expandedKeys"
|
|
|
|
|
|
:tree-data="fileTreeData"
|
|
|
|
|
|
:load-data="loadData"
|
|
|
|
|
|
@select="onFileSelect"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #title="{ node }">
|
|
|
|
|
|
<div class="tree-node-name" :title="node.title">
|
|
|
|
|
|
<span class="name-start">{{ node.nameStart || node.title }}</span>
|
|
|
|
|
|
<span class="name-end" v-if="node.nameEnd">{{ node.nameEnd }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template #actions="{ node }">
|
|
|
|
|
|
<div class="node-actions-container">
|
|
|
|
|
|
<button
|
|
|
|
|
|
v-if="node.isLeaf"
|
|
|
|
|
|
class="tree-action-btn tree-download-btn"
|
|
|
|
|
|
@click.stop="downloadFile(node.fileData)"
|
|
|
|
|
|
title="下载文件"
|
|
|
|
|
|
aria-label="下载文件"
|
|
|
|
|
|
>
|
|
|
|
|
|
<Download :size="14" />
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button
|
|
|
|
|
|
class="tree-action-btn tree-delete-btn"
|
|
|
|
|
|
:disabled="deletingPaths.has(node.key)"
|
|
|
|
|
|
@click.stop="confirmDeleteNode(node)"
|
|
|
|
|
|
:title="node.isLeaf ? '删除文件' : '删除文件夹'"
|
|
|
|
|
|
:aria-label="node.isLeaf ? '删除文件' : '删除文件夹'"
|
|
|
|
|
|
>
|
|
|
|
|
|
<Trash2 :size="14" />
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</FileTreeComponent>
|
2026-03-26 06:07:18 +08:00
|
|
|
|
</div>
|
2026-01-24 15:24:25 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2026-04-01 03:17:15 +08:00
|
|
|
|
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
|
2026-05-27 14:51:56 +08:00
|
|
|
|
import { Download, Folders, RefreshCw, Trash2, X } from 'lucide-vue-next'
|
2026-03-31 19:41:08 +08:00
|
|
|
|
import { Modal, message } from 'ant-design-vue'
|
2026-03-02 10:25:33 +08:00
|
|
|
|
import FileTreeComponent from '@/components/FileTreeComponent.vue'
|
2026-03-31 12:00:48 +08:00
|
|
|
|
import AgentFilePreview from '@/components/AgentFilePreview.vue'
|
2026-06-05 01:29:34 +08:00
|
|
|
|
import FileTypeIcon from '@/components/common/FileTypeIcon.vue'
|
2026-03-24 21:48:28 +08:00
|
|
|
|
import {
|
2026-03-31 19:41:08 +08:00
|
|
|
|
deleteViewerFile,
|
2026-03-24 21:48:28 +08:00
|
|
|
|
downloadViewerFile,
|
|
|
|
|
|
getViewerFileContent,
|
2026-04-30 22:26:12 +08:00
|
|
|
|
getViewerFileSystemTree
|
2026-03-24 21:48:28 +08:00
|
|
|
|
} from '@/apis/viewer_filesystem'
|
2026-01-24 15:24:25 +08:00
|
|
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
|
agentState: {
|
|
|
|
|
|
type: Object,
|
|
|
|
|
|
default: () => ({})
|
|
|
|
|
|
},
|
|
|
|
|
|
threadId: {
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
default: null
|
2026-02-02 21:44:10 +08:00
|
|
|
|
},
|
|
|
|
|
|
panelRatio: {
|
|
|
|
|
|
type: Number,
|
|
|
|
|
|
default: 0.35
|
2026-05-22 00:59:05 +08:00
|
|
|
|
},
|
|
|
|
|
|
previewTabs: {
|
|
|
|
|
|
type: Array,
|
|
|
|
|
|
default: () => []
|
|
|
|
|
|
},
|
|
|
|
|
|
activePreviewPath: {
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
default: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
viewMode: {
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
default: 'tree',
|
|
|
|
|
|
validator: (value) => ['tree', 'preview'].includes(value)
|
2026-01-24 15:24:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
const emit = defineEmits([
|
|
|
|
|
|
'refresh',
|
|
|
|
|
|
'resize',
|
|
|
|
|
|
'resizing',
|
|
|
|
|
|
'open-preview',
|
|
|
|
|
|
'activate-preview',
|
|
|
|
|
|
'close-preview-tab',
|
|
|
|
|
|
'close-preview-path',
|
|
|
|
|
|
'view-mode-change'
|
|
|
|
|
|
])
|
2026-05-16 13:36:35 +08:00
|
|
|
|
const DISPLAY_ROOT_DIRECTORY_NAME = 'user-data'
|
2026-01-24 15:24:25 +08:00
|
|
|
|
|
|
|
|
|
|
const currentFile = ref(null)
|
|
|
|
|
|
const currentFilePath = ref('')
|
2026-03-24 21:48:28 +08:00
|
|
|
|
const loadingFiles = ref(false)
|
|
|
|
|
|
const filesystemError = ref('')
|
|
|
|
|
|
|
|
|
|
|
|
const dynamicTreeData = ref([])
|
|
|
|
|
|
const selectedKeys = ref([])
|
2026-03-25 03:36:08 +08:00
|
|
|
|
const expandedKeys = ref([])
|
2026-03-31 19:41:08 +08:00
|
|
|
|
const deletingPaths = ref(new Set())
|
2026-05-22 00:59:05 +08:00
|
|
|
|
const isResizing = ref(false)
|
2026-01-24 15:24:25 +08:00
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
const normalizedPreviewTabs = computed(() =>
|
|
|
|
|
|
(props.previewTabs || [])
|
|
|
|
|
|
.filter((file) => file?.path)
|
|
|
|
|
|
.map((file) => ({
|
|
|
|
|
|
...file,
|
|
|
|
|
|
path: String(file.path),
|
|
|
|
|
|
name: file.name || getFileName(file)
|
|
|
|
|
|
}))
|
|
|
|
|
|
)
|
|
|
|
|
|
const hasActivePreview = computed(() => Boolean(props.activePreviewPath))
|
|
|
|
|
|
const treePaneVisible = computed(() => !hasActivePreview.value || props.viewMode === 'tree')
|
|
|
|
|
|
const activePreviewTab = computed(
|
|
|
|
|
|
() => normalizedPreviewTabs.value.find((file) => file.path === props.activePreviewPath) || null
|
|
|
|
|
|
)
|
|
|
|
|
|
const fileTreeData = computed(() => dynamicTreeData.value)
|
2026-01-24 15:24:25 +08:00
|
|
|
|
|
2026-03-24 21:48:28 +08:00
|
|
|
|
const buildDisplayName = (fullPath) => {
|
|
|
|
|
|
const normalized = String(fullPath || '').replace(/\/+$/, '')
|
|
|
|
|
|
if (!normalized || normalized === '/') return '/'
|
|
|
|
|
|
const parts = normalized.split('/').filter(Boolean)
|
|
|
|
|
|
return parts[parts.length - 1] || normalized
|
|
|
|
|
|
}
|
2026-02-02 21:44:10 +08:00
|
|
|
|
|
2026-03-24 21:48:28 +08:00
|
|
|
|
const sortEntries = (entries) => {
|
|
|
|
|
|
return [...entries].sort((left, right) => {
|
|
|
|
|
|
const leftIsDir = Boolean(left?.is_dir)
|
|
|
|
|
|
const rightIsDir = Boolean(right?.is_dir)
|
|
|
|
|
|
if (leftIsDir !== rightIsDir) {
|
|
|
|
|
|
return leftIsDir ? -1 : 1
|
2026-02-02 21:44:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-24 21:48:28 +08:00
|
|
|
|
const leftName = buildDisplayName(left?.path).toLowerCase()
|
|
|
|
|
|
const rightName = buildDisplayName(right?.path).toLowerCase()
|
|
|
|
|
|
return leftName.localeCompare(rightName, 'zh-Hans-CN')
|
2026-02-02 21:44:10 +08:00
|
|
|
|
})
|
2026-03-24 21:48:28 +08:00
|
|
|
|
}
|
2026-02-02 21:44:10 +08:00
|
|
|
|
|
2026-03-24 21:48:28 +08:00
|
|
|
|
const createTreeNode = (entry) => {
|
|
|
|
|
|
const fullPath = String(entry?.path || '')
|
|
|
|
|
|
const title = buildDisplayName(fullPath)
|
|
|
|
|
|
const isLeaf = !entry?.is_dir
|
|
|
|
|
|
|
|
|
|
|
|
let nameStart = title
|
|
|
|
|
|
let nameEnd = ''
|
|
|
|
|
|
|
2026-03-25 03:36:08 +08:00
|
|
|
|
if (isLeaf && title.length > 5) {
|
2026-03-24 21:48:28 +08:00
|
|
|
|
nameEnd = title.slice(-5)
|
|
|
|
|
|
nameStart = title.slice(0, -5)
|
2026-02-02 21:44:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-24 21:48:28 +08:00
|
|
|
|
return {
|
|
|
|
|
|
key: fullPath,
|
|
|
|
|
|
title,
|
|
|
|
|
|
nameStart,
|
|
|
|
|
|
nameEnd,
|
|
|
|
|
|
isLeaf,
|
2026-03-25 03:36:08 +08:00
|
|
|
|
children: isLeaf ? undefined : [],
|
2026-03-24 21:48:28 +08:00
|
|
|
|
fileData: {
|
|
|
|
|
|
...entry,
|
|
|
|
|
|
path: fullPath,
|
|
|
|
|
|
name: title,
|
|
|
|
|
|
type: isLeaf ? 'file' : 'directory'
|
|
|
|
|
|
},
|
|
|
|
|
|
class: isLeaf ? 'file-node' : 'folder-node'
|
2026-02-02 21:44:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-24 21:48:28 +08:00
|
|
|
|
const updateTreeChildren = (nodes, targetKey, children) => {
|
|
|
|
|
|
return nodes.map((node) => {
|
|
|
|
|
|
if (node.key === targetKey) {
|
|
|
|
|
|
return { ...node, children }
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!node.children?.length) {
|
|
|
|
|
|
return node
|
|
|
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
|
|
|
...node,
|
|
|
|
|
|
children: updateTreeChildren(node.children, targetKey, children)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2026-02-02 21:44:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-31 19:41:08 +08:00
|
|
|
|
const removeTreeNode = (nodes, targetKey) => {
|
|
|
|
|
|
return nodes.reduce((result, node) => {
|
|
|
|
|
|
if (node.key === targetKey) {
|
|
|
|
|
|
return result
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const nextNode = node.children?.length
|
|
|
|
|
|
? {
|
|
|
|
|
|
...node,
|
|
|
|
|
|
children: removeTreeNode(node.children, targetKey)
|
|
|
|
|
|
}
|
|
|
|
|
|
: node
|
|
|
|
|
|
|
|
|
|
|
|
result.push(nextNode)
|
|
|
|
|
|
return result
|
|
|
|
|
|
}, [])
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-01 04:04:55 +08:00
|
|
|
|
const normalizePathKey = (path) => String(path || '').replace(/\/+$/, '')
|
|
|
|
|
|
|
|
|
|
|
|
const isSameOrChildPath = (path, targetPath) => {
|
|
|
|
|
|
const normalizedPath = normalizePathKey(path)
|
|
|
|
|
|
const normalizedTargetPath = normalizePathKey(targetPath)
|
|
|
|
|
|
if (!normalizedPath || !normalizedTargetPath) return false
|
|
|
|
|
|
return (
|
|
|
|
|
|
normalizedPath === normalizedTargetPath || normalizedPath.startsWith(`${normalizedTargetPath}/`)
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-25 03:36:08 +08:00
|
|
|
|
const parseDownloadFilename = (contentDisposition) => {
|
|
|
|
|
|
if (!contentDisposition) return ''
|
2026-02-02 21:44:10 +08:00
|
|
|
|
|
2026-03-25 03:36:08 +08:00
|
|
|
|
const utf8Match = contentDisposition.match(/filename\*=UTF-8''([^;]+)/i)
|
|
|
|
|
|
if (utf8Match && utf8Match[1]) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
return decodeURIComponent(utf8Match[1])
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.warn('解析 UTF-8 文件名失败:', error)
|
2026-02-02 21:44:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-25 03:36:08 +08:00
|
|
|
|
const asciiMatch = contentDisposition.match(/filename="?([^";]+)"?/i)
|
|
|
|
|
|
if (asciiMatch && asciiMatch[1]) {
|
|
|
|
|
|
return asciiMatch[1]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return ''
|
|
|
|
|
|
}
|
2026-01-24 15:24:25 +08:00
|
|
|
|
|
|
|
|
|
|
const getFileName = (fileItem) => {
|
2026-05-22 00:59:05 +08:00
|
|
|
|
if (fileItem?.name) return fileItem.name
|
2026-03-25 03:36:08 +08:00
|
|
|
|
if (fileItem?.path) {
|
|
|
|
|
|
return String(fileItem.path).split('/').pop() || String(fileItem.path)
|
2026-01-24 15:24:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
return '未知文件'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-30 22:26:12 +08:00
|
|
|
|
const loadDirectoryChildren = async (directoryPath) => {
|
2026-05-24 00:47:08 +08:00
|
|
|
|
const res = await getViewerFileSystemTree(props.threadId, directoryPath)
|
2026-04-30 22:26:12 +08:00
|
|
|
|
return sortEntries(res?.entries || []).map((entry) => createTreeNode(entry))
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-24 21:48:28 +08:00
|
|
|
|
const refreshFileSystem = async () => {
|
|
|
|
|
|
if (!props.threadId) {
|
|
|
|
|
|
dynamicTreeData.value = []
|
|
|
|
|
|
filesystemError.value = ''
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
loadingFiles.value = true
|
|
|
|
|
|
filesystemError.value = ''
|
2026-03-25 03:36:08 +08:00
|
|
|
|
|
2026-03-04 08:53:50 +08:00
|
|
|
|
try {
|
2026-05-24 00:47:08 +08:00
|
|
|
|
const res = await getViewerFileSystemTree(props.threadId, '/')
|
2026-03-25 03:36:08 +08:00
|
|
|
|
if (res?.entries) {
|
2026-05-16 13:36:35 +08:00
|
|
|
|
const displayRootEntry = res.entries.find(
|
|
|
|
|
|
(entry) => entry?.is_dir && entry.name === DISPLAY_ROOT_DIRECTORY_NAME
|
|
|
|
|
|
)
|
2026-04-30 22:26:12 +08:00
|
|
|
|
|
2026-05-22 13:15:46 +08:00
|
|
|
|
dynamicTreeData.value = displayRootEntry
|
|
|
|
|
|
? await loadDirectoryChildren(displayRootEntry.path)
|
|
|
|
|
|
: []
|
2026-05-16 13:36:35 +08:00
|
|
|
|
expandedKeys.value = []
|
2026-05-22 00:59:05 +08:00
|
|
|
|
selectedKeys.value = props.activePreviewPath ? [props.activePreviewPath] : []
|
2026-03-25 03:36:08 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
dynamicTreeData.value = []
|
2026-03-24 21:48:28 +08:00
|
|
|
|
}
|
2026-03-25 03:36:08 +08:00
|
|
|
|
} catch (error) {
|
2026-03-24 21:48:28 +08:00
|
|
|
|
dynamicTreeData.value = []
|
2026-03-25 03:36:08 +08:00
|
|
|
|
filesystemError.value = error?.message || '加载文件系统失败'
|
|
|
|
|
|
console.error('Failed to load root files', error)
|
2026-03-24 21:48:28 +08:00
|
|
|
|
} finally {
|
|
|
|
|
|
loadingFiles.value = false
|
2026-02-02 21:44:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-30 22:26:12 +08:00
|
|
|
|
const loadData = async (treeNode) => {
|
|
|
|
|
|
if (treeNode.isLeaf || treeNode.children?.length || !props.threadId) return
|
2026-04-06 18:49:13 +08:00
|
|
|
|
|
2026-04-30 22:26:12 +08:00
|
|
|
|
try {
|
|
|
|
|
|
const children = await loadDirectoryChildren(treeNode.key)
|
|
|
|
|
|
dynamicTreeData.value = updateTreeChildren(dynamicTreeData.value, treeNode.key, children)
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('Failed to load children for', treeNode.key, error)
|
2026-04-06 18:49:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
let previewRequestSeq = 0
|
2026-03-26 06:07:18 +08:00
|
|
|
|
|
2026-03-26 05:14:50 +08:00
|
|
|
|
const revokeCurrentPreviewUrl = () => {
|
|
|
|
|
|
const previewUrl = currentFile.value?.previewUrl
|
|
|
|
|
|
if (previewUrl) {
|
|
|
|
|
|
window.URL.revokeObjectURL(previewUrl)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
const loadActivePreview = async () => {
|
|
|
|
|
|
const filePath = props.activePreviewPath
|
|
|
|
|
|
const requestSeq = ++previewRequestSeq
|
2026-03-24 21:48:28 +08:00
|
|
|
|
|
2026-03-26 05:14:50 +08:00
|
|
|
|
revokeCurrentPreviewUrl()
|
2026-05-22 00:59:05 +08:00
|
|
|
|
|
|
|
|
|
|
if (!filePath || !props.threadId) {
|
|
|
|
|
|
currentFile.value = null
|
|
|
|
|
|
currentFilePath.value = ''
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const baseFile = {
|
|
|
|
|
|
...(activePreviewTab.value || {}),
|
|
|
|
|
|
path: filePath,
|
|
|
|
|
|
name: activePreviewTab.value?.name || getFileName({ path: filePath }),
|
|
|
|
|
|
type: 'file'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
currentFilePath.value = filePath
|
2026-03-26 05:14:50 +08:00
|
|
|
|
currentFile.value = {
|
2026-05-22 00:59:05 +08:00
|
|
|
|
...baseFile,
|
2026-03-26 05:14:50 +08:00
|
|
|
|
content: 'Loading...',
|
|
|
|
|
|
supported: true,
|
|
|
|
|
|
previewType: 'text',
|
|
|
|
|
|
message: '',
|
|
|
|
|
|
previewUrl: ''
|
|
|
|
|
|
}
|
2026-03-24 21:48:28 +08:00
|
|
|
|
|
2026-03-25 03:36:08 +08:00
|
|
|
|
try {
|
2026-05-24 00:47:08 +08:00
|
|
|
|
const res = await getViewerFileContent(props.threadId, filePath)
|
|
|
|
|
|
if (requestSeq !== previewRequestSeq) return
|
|
|
|
|
|
|
2026-03-26 05:14:50 +08:00
|
|
|
|
const previewType = res?.preview_type || 'text'
|
|
|
|
|
|
let previewUrl = ''
|
|
|
|
|
|
|
|
|
|
|
|
if ((previewType === 'image' || previewType === 'pdf') && res?.supported) {
|
2026-05-24 00:47:08 +08:00
|
|
|
|
const response = await downloadViewerFile(props.threadId, filePath)
|
2026-03-26 05:14:50 +08:00
|
|
|
|
const blob = await response.blob()
|
|
|
|
|
|
previewUrl = window.URL.createObjectURL(blob)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
if (requestSeq !== previewRequestSeq) {
|
|
|
|
|
|
if (previewUrl) window.URL.revokeObjectURL(previewUrl)
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-04 08:53:50 +08:00
|
|
|
|
currentFile.value = {
|
2026-05-22 00:59:05 +08:00
|
|
|
|
...baseFile,
|
2026-03-26 05:14:50 +08:00
|
|
|
|
content: res?.content ?? '',
|
|
|
|
|
|
supported: res?.supported !== false,
|
|
|
|
|
|
previewType,
|
|
|
|
|
|
message: res?.message || '',
|
|
|
|
|
|
previewUrl
|
2026-03-04 08:53:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
2026-05-22 00:59:05 +08:00
|
|
|
|
if (requestSeq !== previewRequestSeq) return
|
|
|
|
|
|
|
2026-03-25 03:36:08 +08:00
|
|
|
|
currentFile.value = {
|
2026-05-22 00:59:05 +08:00
|
|
|
|
...baseFile,
|
2026-03-26 05:14:50 +08:00
|
|
|
|
content: `Error loading file: ${error?.message || 'unknown error'}`,
|
|
|
|
|
|
supported: false,
|
|
|
|
|
|
previewType: 'unsupported',
|
|
|
|
|
|
message: error?.message || '文件预览失败',
|
|
|
|
|
|
previewUrl: ''
|
2026-03-25 03:36:08 +08:00
|
|
|
|
}
|
2026-03-04 08:53:50 +08:00
|
|
|
|
}
|
2026-01-24 15:24:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
const onFileSelect = (nextSelectedKeys, { node }) => {
|
|
|
|
|
|
selectedKeys.value = nextSelectedKeys
|
|
|
|
|
|
if (!node?.isLeaf || !props.threadId) return
|
|
|
|
|
|
emit('open-preview', node.fileData, true)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const activatePreviewTab = (filePath) => {
|
|
|
|
|
|
emit('activate-preview', filePath)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const closePreviewTab = (filePath) => {
|
|
|
|
|
|
emit('close-preview-tab', filePath)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const toggleFileTree = () => {
|
|
|
|
|
|
emit('view-mode-change', treePaneVisible.value ? 'preview' : 'tree')
|
2026-01-24 15:24:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-01 04:04:55 +08:00
|
|
|
|
const pruneTreeStateAfterDelete = (targetPath) => {
|
|
|
|
|
|
selectedKeys.value = selectedKeys.value.filter((key) => !isSameOrChildPath(key, targetPath))
|
|
|
|
|
|
expandedKeys.value = expandedKeys.value.filter((key) => !isSameOrChildPath(key, targetPath))
|
2026-05-22 00:59:05 +08:00
|
|
|
|
emit('close-preview-path', targetPath)
|
2026-04-01 04:04:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const confirmDeleteNode = (node) => {
|
2026-03-31 19:41:08 +08:00
|
|
|
|
const fileName = node?.title || getFileName(node?.fileData)
|
2026-04-01 04:04:55 +08:00
|
|
|
|
const isDirectory = !node?.isLeaf
|
2026-03-31 19:41:08 +08:00
|
|
|
|
Modal.confirm({
|
2026-04-01 04:04:55 +08:00
|
|
|
|
title: isDirectory ? `确认删除文件夹「${fileName}」?` : `确认删除文件「${fileName}」?`,
|
|
|
|
|
|
content: isDirectory ? '将删除该文件夹及其所有内容,删除后不可恢复。' : '删除后不可恢复。',
|
2026-03-31 19:41:08 +08:00
|
|
|
|
okText: '删除',
|
|
|
|
|
|
okType: 'danger',
|
|
|
|
|
|
cancelText: '取消',
|
|
|
|
|
|
onOk: async () => {
|
|
|
|
|
|
const nextDeletingPaths = new Set(deletingPaths.value)
|
|
|
|
|
|
nextDeletingPaths.add(node.key)
|
|
|
|
|
|
deletingPaths.value = nextDeletingPaths
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
2026-05-24 00:47:08 +08:00
|
|
|
|
await deleteViewerFile(props.threadId, node.key)
|
2026-03-31 19:41:08 +08:00
|
|
|
|
dynamicTreeData.value = removeTreeNode(dynamicTreeData.value, node.key)
|
2026-04-01 04:04:55 +08:00
|
|
|
|
pruneTreeStateAfterDelete(node.key)
|
|
|
|
|
|
message.success(isDirectory ? '文件夹删除成功' : '文件删除成功')
|
2026-03-31 19:41:08 +08:00
|
|
|
|
} catch (error) {
|
2026-04-01 04:04:55 +08:00
|
|
|
|
console.error(isDirectory ? '删除文件夹失败:' : '删除文件失败:', error)
|
|
|
|
|
|
message.error(error?.message || (isDirectory ? '删除文件夹失败' : '删除文件失败'))
|
2026-03-31 19:41:08 +08:00
|
|
|
|
} finally {
|
|
|
|
|
|
const latestDeletingPaths = new Set(deletingPaths.value)
|
|
|
|
|
|
latestDeletingPaths.delete(node.key)
|
|
|
|
|
|
deletingPaths.value = latestDeletingPaths
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-05 22:50:38 +08:00
|
|
|
|
const downloadFile = async (fileItem) => {
|
|
|
|
|
|
if (!props.threadId || !fileItem?.path) return
|
2026-03-25 03:36:08 +08:00
|
|
|
|
|
2026-01-24 15:24:25 +08:00
|
|
|
|
try {
|
2026-05-24 00:47:08 +08:00
|
|
|
|
const response = await downloadViewerFile(props.threadId, fileItem.path)
|
2026-03-05 22:50:38 +08:00
|
|
|
|
const blob = await response.blob()
|
2026-03-24 21:48:28 +08:00
|
|
|
|
const contentDisposition =
|
|
|
|
|
|
response.headers.get('Content-Disposition') || response.headers.get('content-disposition')
|
|
|
|
|
|
const filename = parseDownloadFilename(contentDisposition) || getFileName(fileItem)
|
|
|
|
|
|
const url = window.URL.createObjectURL(blob)
|
2026-01-24 15:24:25 +08:00
|
|
|
|
const link = document.createElement('a')
|
|
|
|
|
|
link.href = url
|
2026-03-24 21:48:28 +08:00
|
|
|
|
link.download = filename
|
2026-01-24 15:24:25 +08:00
|
|
|
|
document.body.appendChild(link)
|
|
|
|
|
|
link.click()
|
|
|
|
|
|
document.body.removeChild(link)
|
2026-03-24 21:48:28 +08:00
|
|
|
|
window.URL.revokeObjectURL(url)
|
2026-01-24 15:24:25 +08:00
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('下载文件失败:', error)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const emitRefresh = () => {
|
2026-03-24 21:48:28 +08:00
|
|
|
|
refreshFileSystem()
|
|
|
|
|
|
emit('refresh', props.threadId)
|
2026-01-24 15:24:25 +08:00
|
|
|
|
}
|
2026-01-31 17:04:30 +08:00
|
|
|
|
|
2026-03-26 06:07:18 +08:00
|
|
|
|
let resizePointerId = null
|
|
|
|
|
|
let pendingClientX = 0
|
|
|
|
|
|
let resizeFrameId = 0
|
|
|
|
|
|
|
|
|
|
|
|
const flushResize = () => {
|
|
|
|
|
|
resizeFrameId = 0
|
|
|
|
|
|
if (!isResizing.value) return
|
|
|
|
|
|
emit('resize', pendingClientX)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const queueResize = (clientX) => {
|
|
|
|
|
|
pendingClientX = clientX
|
|
|
|
|
|
if (resizeFrameId) return
|
|
|
|
|
|
resizeFrameId = window.requestAnimationFrame(flushResize)
|
|
|
|
|
|
}
|
2026-01-31 17:04:30 +08:00
|
|
|
|
|
|
|
|
|
|
const startResize = (e) => {
|
2026-03-26 06:07:18 +08:00
|
|
|
|
if (e.button !== 0) return
|
|
|
|
|
|
|
2026-01-31 17:04:30 +08:00
|
|
|
|
isResizing.value = true
|
2026-03-26 06:07:18 +08:00
|
|
|
|
resizePointerId = e.pointerId
|
|
|
|
|
|
pendingClientX = e.clientX
|
|
|
|
|
|
emit('resizing', true, e.clientX)
|
2026-01-31 17:04:30 +08:00
|
|
|
|
document.body.style.cursor = 'col-resize'
|
|
|
|
|
|
document.body.style.userSelect = 'none'
|
2026-03-26 06:07:18 +08:00
|
|
|
|
|
|
|
|
|
|
e.currentTarget?.setPointerCapture?.(e.pointerId)
|
|
|
|
|
|
window.addEventListener('pointermove', onPointerMove)
|
|
|
|
|
|
window.addEventListener('pointerup', stopResize)
|
|
|
|
|
|
window.addEventListener('pointercancel', stopResize)
|
2026-01-31 17:04:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-26 06:07:18 +08:00
|
|
|
|
const onPointerMove = (e) => {
|
|
|
|
|
|
if (!isResizing.value || e.pointerId !== resizePointerId) return
|
|
|
|
|
|
queueResize(e.clientX)
|
2026-01-31 17:04:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-26 06:07:18 +08:00
|
|
|
|
const stopResize = (e) => {
|
|
|
|
|
|
if (!isResizing.value || (e && e.pointerId !== resizePointerId)) return
|
|
|
|
|
|
|
|
|
|
|
|
if (resizeFrameId) {
|
|
|
|
|
|
window.cancelAnimationFrame(resizeFrameId)
|
|
|
|
|
|
resizeFrameId = 0
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (e) {
|
|
|
|
|
|
pendingClientX = e.clientX
|
|
|
|
|
|
emit('resize', pendingClientX)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-25 03:36:08 +08:00
|
|
|
|
isResizing.value = false
|
2026-03-26 06:07:18 +08:00
|
|
|
|
resizePointerId = null
|
2026-03-25 03:36:08 +08:00
|
|
|
|
emit('resizing', false)
|
|
|
|
|
|
document.body.style.cursor = ''
|
|
|
|
|
|
document.body.style.userSelect = ''
|
2026-03-26 06:07:18 +08:00
|
|
|
|
window.removeEventListener('pointermove', onPointerMove)
|
|
|
|
|
|
window.removeEventListener('pointerup', stopResize)
|
|
|
|
|
|
window.removeEventListener('pointercancel', stopResize)
|
2026-01-31 17:04:30 +08:00
|
|
|
|
}
|
2026-03-25 03:36:08 +08:00
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
|
refreshFileSystem()
|
2026-03-26 06:07:18 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
|
|
if (resizeFrameId) {
|
|
|
|
|
|
window.cancelAnimationFrame(resizeFrameId)
|
|
|
|
|
|
resizeFrameId = 0
|
|
|
|
|
|
}
|
|
|
|
|
|
window.removeEventListener('pointermove', onPointerMove)
|
|
|
|
|
|
window.removeEventListener('pointerup', stopResize)
|
|
|
|
|
|
window.removeEventListener('pointercancel', stopResize)
|
|
|
|
|
|
document.body.style.cursor = ''
|
|
|
|
|
|
document.body.style.userSelect = ''
|
|
|
|
|
|
revokeCurrentPreviewUrl()
|
2026-03-25 03:36:08 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
2026-05-31 13:40:15 +08:00
|
|
|
|
watch(
|
|
|
|
|
|
() => props.threadId,
|
|
|
|
|
|
(threadId) => {
|
|
|
|
|
|
if (threadId) {
|
|
|
|
|
|
refreshFileSystem()
|
|
|
|
|
|
} else {
|
|
|
|
|
|
dynamicTreeData.value = []
|
|
|
|
|
|
expandedKeys.value = []
|
|
|
|
|
|
selectedKeys.value = []
|
|
|
|
|
|
filesystemError.value = ''
|
|
|
|
|
|
}
|
2026-03-25 03:36:08 +08:00
|
|
|
|
}
|
2026-05-31 13:40:15 +08:00
|
|
|
|
)
|
2026-03-26 06:07:18 +08:00
|
|
|
|
|
2026-05-24 00:47:08 +08:00
|
|
|
|
watch([() => props.threadId, () => props.activePreviewPath], loadActivePreview, { immediate: true })
|
2026-03-26 06:07:18 +08:00
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
watch(
|
|
|
|
|
|
() => props.activePreviewPath,
|
|
|
|
|
|
(filePath) => {
|
|
|
|
|
|
selectedKeys.value = filePath ? [filePath] : []
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
2026-01-24 15:24:25 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="less">
|
2026-01-31 17:04:30 +08:00
|
|
|
|
.resize-handle {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
left: -2px;
|
|
|
|
|
|
top: 50%;
|
|
|
|
|
|
transform: translateY(-50%);
|
|
|
|
|
|
height: 32px;
|
|
|
|
|
|
width: 4px;
|
|
|
|
|
|
cursor: col-resize;
|
|
|
|
|
|
background: var(--gray-300);
|
|
|
|
|
|
border-radius: 2px;
|
|
|
|
|
|
z-index: 10;
|
|
|
|
|
|
transition: background 0.2s;
|
2026-03-26 06:07:18 +08:00
|
|
|
|
touch-action: none;
|
2026-01-31 17:04:30 +08:00
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
background: var(--main-400);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-24 15:24:25 +08:00
|
|
|
|
.agent-panel {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
2026-05-22 00:59:05 +08:00
|
|
|
|
position: relative;
|
2026-01-24 15:24:25 +08:00
|
|
|
|
background: var(--gray-0);
|
2026-01-31 17:04:30 +08:00
|
|
|
|
transition: none;
|
|
|
|
|
|
|
|
|
|
|
|
&.resizing {
|
|
|
|
|
|
transition: none;
|
|
|
|
|
|
}
|
2026-01-24 15:24:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.panel-header {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: space-between;
|
2026-05-22 00:59:05 +08:00
|
|
|
|
gap: 8px;
|
|
|
|
|
|
padding: 4px 12px;
|
2026-04-07 12:51:15 +08:00
|
|
|
|
min-height: 44px;
|
2026-01-31 17:04:30 +08:00
|
|
|
|
background: var(--gray-25);
|
2026-05-22 00:59:05 +08:00
|
|
|
|
border-bottom: 1px solid var(--gray-100);
|
2026-01-24 15:24:25 +08:00
|
|
|
|
flex-shrink: 0;
|
2026-04-06 21:04:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-05 23:52:36 +08:00
|
|
|
|
.header-action-btn {
|
|
|
|
|
|
width: 28px;
|
|
|
|
|
|
height: 28px;
|
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
color: var(--gray-600);
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
transition: all 0.15s ease;
|
|
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
&:hover,
|
|
|
|
|
|
&.active {
|
2026-04-05 23:52:36 +08:00
|
|
|
|
background: var(--gray-100);
|
|
|
|
|
|
color: var(--gray-900);
|
|
|
|
|
|
}
|
2026-04-06 18:49:13 +08:00
|
|
|
|
|
|
|
|
|
|
&:disabled {
|
|
|
|
|
|
color: var(--gray-300);
|
|
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
}
|
2026-04-05 23:52:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-24 15:24:25 +08:00
|
|
|
|
.panel-title {
|
2026-04-06 21:04:19 +08:00
|
|
|
|
flex: 1;
|
|
|
|
|
|
min-width: 0;
|
2026-05-22 00:59:05 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2026-01-24 15:24:25 +08:00
|
|
|
|
font-weight: 600;
|
2026-01-31 17:44:51 +08:00
|
|
|
|
font-size: 14px;
|
2026-01-24 15:24:25 +08:00
|
|
|
|
color: var(--gray-900);
|
2026-01-31 14:16:53 +08:00
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
> span {
|
2026-04-06 21:04:19 +08:00
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
}
|
2026-01-24 15:24:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-06 21:04:19 +08:00
|
|
|
|
.window-actions {
|
2026-01-24 15:24:25 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 4px;
|
2026-04-06 21:04:19 +08:00
|
|
|
|
flex-shrink: 0;
|
2026-04-05 23:52:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-24 15:24:25 +08:00
|
|
|
|
.tab-content {
|
|
|
|
|
|
flex: 1;
|
2026-05-22 00:59:05 +08:00
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
min-height: 0;
|
|
|
|
|
|
}
|
2026-01-24 15:24:25 +08:00
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
.files-display {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
min-height: 0;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
}
|
2026-01-24 15:24:25 +08:00
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
.preview-pane {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
min-height: 0;
|
|
|
|
|
|
display: flex;
|
2026-01-24 15:24:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
.tree-pane {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
min-height: 0;
|
2026-03-24 21:48:28 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
2026-05-31 13:36:42 +08:00
|
|
|
|
padding: 6px;
|
2026-03-24 21:48:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
.files-display.has-preview.with-tree .tree-pane {
|
|
|
|
|
|
flex: 0 0 34%;
|
|
|
|
|
|
min-width: 260px;
|
|
|
|
|
|
max-width: 380px;
|
|
|
|
|
|
border-left: 1px solid var(--gray-100);
|
2026-03-26 06:07:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
.preview-tabs-bar {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 4px;
|
|
|
|
|
|
overflow-x: auto;
|
|
|
|
|
|
padding-bottom: 1px;
|
|
|
|
|
|
scrollbar-width: none;
|
|
|
|
|
|
|
|
|
|
|
|
&::-webkit-scrollbar {
|
|
|
|
|
|
display: none;
|
|
|
|
|
|
}
|
2026-03-26 06:07:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
.preview-tab {
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
max-width: 220px;
|
2026-03-26 06:07:18 +08:00
|
|
|
|
display: flex;
|
2026-05-22 00:59:05 +08:00
|
|
|
|
align-items: center;
|
|
|
|
|
|
border: 1px solid var(--gray-150);
|
|
|
|
|
|
border-radius: 8px;
|
2026-05-28 12:53:29 +08:00
|
|
|
|
background: var(--gray-25);
|
2026-05-22 00:59:05 +08:00
|
|
|
|
color: var(--gray-700);
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
|
|
|
|
|
|
&.active {
|
2026-05-28 12:53:29 +08:00
|
|
|
|
border-color: var(--main-600);
|
|
|
|
|
|
background: var(--gray-0);
|
2026-05-22 00:59:05 +08:00
|
|
|
|
color: var(--main-800);
|
|
|
|
|
|
}
|
2026-03-26 06:07:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
.preview-tab-main {
|
2026-03-26 06:07:18 +08:00
|
|
|
|
min-width: 0;
|
2026-05-22 00:59:05 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 6px;
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
color: inherit;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
padding: 5px 6px 5px 8px;
|
2026-03-26 06:07:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
.preview-tab-icon {
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
font-size: 14px;
|
2026-03-26 06:07:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
.preview-tab-name {
|
2026-03-26 06:07:18 +08:00
|
|
|
|
min-width: 0;
|
2026-05-22 00:59:05 +08:00
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.preview-tab-close {
|
|
|
|
|
|
width: 24px;
|
|
|
|
|
|
height: 24px;
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
color: var(--gray-500);
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
color: var(--gray-900);
|
|
|
|
|
|
background: var(--gray-100);
|
|
|
|
|
|
}
|
2026-03-26 06:07:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
.side-preview-shell {
|
2026-03-26 06:07:18 +08:00
|
|
|
|
flex: 1;
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
min-height: 0;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
border: 1px solid var(--gray-150);
|
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
|
background: var(--gray-0);
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
.side-preview-shell :deep(.file-content),
|
|
|
|
|
|
.side-preview-shell :deep(.side-file-content) {
|
2026-03-26 06:07:18 +08:00
|
|
|
|
flex: 1;
|
|
|
|
|
|
min-height: 0;
|
|
|
|
|
|
max-height: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
.preview-empty,
|
|
|
|
|
|
.empty {
|
2026-03-26 06:07:18 +08:00
|
|
|
|
flex: 1;
|
|
|
|
|
|
min-height: 0;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
text-align: center;
|
2026-05-22 00:59:05 +08:00
|
|
|
|
color: var(--gray-500);
|
|
|
|
|
|
padding: 24px;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.preview-empty {
|
2026-03-26 06:07:18 +08:00
|
|
|
|
border: 1px dashed var(--gray-200);
|
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
|
background: linear-gradient(180deg, var(--gray-25) 0%, var(--gray-0) 100%);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
.preview-empty-title {
|
2026-03-26 06:07:18 +08:00
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
color: var(--gray-800);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
.preview-empty-desc {
|
2026-03-26 06:07:18 +08:00
|
|
|
|
margin-top: 6px;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
line-height: 1.6;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-22 00:59:05 +08:00
|
|
|
|
.error-state {
|
|
|
|
|
|
gap: 8px;
|
2026-01-24 15:24:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-02 21:44:10 +08:00
|
|
|
|
.file-tree-container {
|
2026-05-22 00:59:05 +08:00
|
|
|
|
flex: 1;
|
2026-03-26 06:07:18 +08:00
|
|
|
|
min-height: 0;
|
|
|
|
|
|
overflow-y: auto;
|
2026-05-22 00:59:05 +08:00
|
|
|
|
|
|
|
|
|
|
&::-webkit-scrollbar {
|
|
|
|
|
|
width: 6px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&::-webkit-scrollbar-track {
|
|
|
|
|
|
background: var(--gray-50);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&::-webkit-scrollbar-thumb {
|
|
|
|
|
|
background: var(--gray-300);
|
|
|
|
|
|
border-radius: 3px;
|
|
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
background: var(--gray-400);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-02-02 21:44:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.tree-node-name {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
flex: 1;
|
2026-02-03 12:13:52 +08:00
|
|
|
|
min-width: 0;
|
2026-02-03 14:55:21 +08:00
|
|
|
|
font-family:
|
|
|
|
|
|
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
2026-02-03 02:28:51 +08:00
|
|
|
|
font-size: 14px;
|
2026-02-02 21:44:10 +08:00
|
|
|
|
color: var(--gray-800);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.name-start {
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.name-end {
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-02 10:25:33 +08:00
|
|
|
|
.node-actions-container {
|
2026-02-02 21:44:10 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2026-03-02 10:25:33 +08:00
|
|
|
|
gap: 4px;
|
2026-02-02 21:44:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-03 12:13:52 +08:00
|
|
|
|
.tree-action-btn {
|
2026-03-02 10:25:33 +08:00
|
|
|
|
display: flex;
|
2026-02-02 21:44:10 +08:00
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
width: 24px;
|
|
|
|
|
|
height: 24px;
|
|
|
|
|
|
border: none;
|
2026-02-03 12:13:52 +08:00
|
|
|
|
background: transparent;
|
2026-02-02 21:44:10 +08:00
|
|
|
|
color: var(--gray-500);
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
padding: 0;
|
2026-03-31 19:41:08 +08:00
|
|
|
|
|
|
|
|
|
|
&:disabled {
|
|
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
|
opacity: 0.45;
|
|
|
|
|
|
}
|
2026-02-03 12:13:52 +08:00
|
|
|
|
}
|
2026-02-02 21:44:10 +08:00
|
|
|
|
|
2026-02-03 12:13:52 +08:00
|
|
|
|
.tree-download-btn:hover {
|
|
|
|
|
|
color: var(--main-600);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-31 19:42:35 +08:00
|
|
|
|
.tree-delete-btn:hover:not(:disabled) {
|
|
|
|
|
|
color: var(--error-600, #dc2626);
|
|
|
|
|
|
}
|
2026-04-01 03:17:15 +08:00
|
|
|
|
</style>
|