Conversation
|
文件解析失败,挨个点击解析效率比较低。请问有考虑增加一键重新解析的功能吗? |
Contributor
There was a problem hiding this comment.
Pull request overview
本 PR(WIP)完善“个人工作区文件管理”能力:新增用户级 workspace 后端 API 与路由,并在前端增加独立的“工作区”页面用于浏览/预览/编辑/上传/下载/删除文件,同时将工作区 agents/AGENTS.md 内容注入到 agent 的 system prompt。
Changes:
- 新增 workspace 后端服务与路由:目录树、文件读取/写入、上传、下载、删除,并初始化默认
agents/AGENTS.md - 新增前端工作区页面与组件:侧边栏、文件列表、预览/编辑面板、API 封装,并接入主导航与路由
- Agent 输入上下文增强:读取并合并
agents/AGENTS.md到 system prompt(带最大字节数与截断提示)
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| web/src/views/WorkspaceView.vue | 新增工作区主页面:目录加载、预览/编辑、上传下载删除、内联预览布局与拖拽分栏 |
| web/src/views/DataBaseView.vue | 轻量格式调整(标题/注释缩进) |
| web/src/router/index.js | 新增 /workspace 路由并挂载到 AppLayout |
| web/src/layouts/AppLayout.vue | 主导航新增“工作区”入口 |
| web/src/components/workspace/WorkspaceSidebar.vue | 新增工作区侧边栏:个人工作区、快速访问、知识库占位、共享空间占位 |
| web/src/components/workspace/WorkspacePreviewPane.vue | 新增内联预览面板封装(复用 AgentFilePreview) |
| web/src/components/workspace/WorkspaceFileList.vue | 新增文件列表:面包屑、表格、批量选择/删除、下载入口 |
| web/src/components/shared/InfoCard.vue | 模板排版/格式整理 |
| web/src/components/extensions/SkillDetailView.vue | 移除未使用的 computed(格式/清理) |
| web/src/components/extensions/McpDetailView.vue | 样式空行清理 |
| web/src/components/ShareConfigForm.vue | 样式格式化(transition 多行) |
| web/src/components/ConversationNavSection.vue | 样式格式化(linear-gradient 多行) |
| web/src/components/AgentPanel.vue | 文件系统面板交互调整:默认展开目录、预览关闭按钮变体、移除上传/新建等工具栏能力 |
| web/src/components/AgentInputArea.vue | “文件”按钮图标替换(FolderCode → FolderKanban) |
| web/src/components/AgentFilePreview.vue | 预览组件增强:可编辑模式(md/txt)、保存/取消、关闭按钮变体与无障碍属性 |
| web/src/assets/css/main.css | 调整 .layout-container 样式(移除全局 padding) |
| web/src/apis/workspace_api.js | 新增前端 workspace API 封装(tree/file/save/delete/upload/download) |
| docs/develop-guides/roadmap.md | 路线图记录:工作区能力与扩展管理界面重构等 |
| backend/test/unit/services/test_workspace_service.py | 新增 workspace_service 单元测试(默认文件、路径安全、读写限制等) |
| backend/test/unit/services/test_chat_service_sync.py | 更新/新增测试:注入 AGENTS.md prompt、补齐仓库依赖 monkeypatch |
| backend/server/routers/workspace_router.py | 新增 workspace 路由:tree/file CRUD/upload/download |
| backend/server/routers/init.py | 注册 workspace router 到 /api/workspace/* |
| backend/package/yuxi/utils/paths.py | 增加 workspace agents 常量(agents 目录与 AGENTS.md 文件名) |
| backend/package/yuxi/services/workspace_service.py | 新增 workspace 核心服务:路径解析防穿越、列表、读写、上传、下载、删除 |
| backend/package/yuxi/services/chat_service.py | 构建 agent 输入上下文时合并 agents/AGENTS.md 到 system prompt(限制 64KB) |
| backend/package/yuxi/agents/backends/sandbox/paths.py | 新增 default workspace 文件初始化(ensure_workspace_default_files)并在 ensure_thread_dirs 中调用 |
| backend/package/yuxi/agents/backends/sandbox/init.py | 导出新增的 sandbox paths 工具函数 |
| CLAUDE.md | 更新开发准则文档内容(更细化的行为/改动边界建议) |
| AGENTS.md | 补充代码组织建议(避免过度拆分 helper 等) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+229
to
+242
| async def upload_workspace_file(*, parent_path: str, file: UploadFile, current_user: User) -> dict: | ||
| root = _workspace_root(current_user) | ||
| file_name = _validate_child_name(Path(file.filename or "").name, field_name="文件名") | ||
| parent = _resolve_parent_directory(current_user, parent_path) | ||
| target = _resolve_new_child(root, parent, file_name) | ||
| created_file = False | ||
| upload_completed = False | ||
|
|
||
| try: | ||
| async with aiofiles.open(target, "xb") as buffer: | ||
| created_file = True | ||
| while chunk := await file.read(1024 * 1024): | ||
| await buffer.write(chunk) | ||
| upload_completed = True |
Comment on lines
+235
to
+241
| if (previewType === 'image' || previewType === 'pdf') { | ||
| const response = await downloadWorkspaceFile(entry.path) | ||
| const blob = await response.blob() | ||
| revokePreviewObjectUrl() | ||
| previewObjectUrl.value = URL.createObjectURL(blob) | ||
| file.previewUrl = previewObjectUrl.value | ||
| } |
Comment on lines
+559
to
+563
| const resizePreview = (event) => { | ||
| if (!workspaceMainRef.value || resizePointerId === null) return | ||
| const rect = workspaceMainRef.value.getBoundingClientRect() | ||
| const relativeX = event.clientX - rect.left | ||
| const nextPreviewPercent = Math.round(((rect.width - relativeX) / rect.width) * 100) |
Comment on lines
+172
to
+176
| const breadcrumbItems = computed(() => { | ||
| const normalizedPath = props.currentPath || '/' | ||
| if (normalizedPath === '/') { | ||
| return [{ name: '工作区', path: '/' }] | ||
| } |
新增独立用户级 workspace 只读接口和工作区页面,支持文件列表浏览及宽屏内嵌/窄屏弹窗预览,便于后续扩展团队空间与知识库浏览。 Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更描述
完善个人工作区能力:新增后端工作区文件服务与路由,补充前端工作区视图、侧边栏、文件列表、预览面板和 API 封装,并优化工作区路径选择与面包屑导航体验。
变更类型
测试
相关日志或者截图
说明
WIP PR,用于提前对齐个人工作区文件管理相关改动;合并前仍需补充 Docker 环境测试、功能验证与必要的 lint 检查。
💡 提示: 提交前可以运行
make lint和make format检查代码规范