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
5 changes: 4 additions & 1 deletion ui/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ ui/
│ ├── api/ # Request infrastructure, business APIs, and shared API types
│ │ ├── types/ # Types shared by APIs and their View or Component consumers
│ │ └── API_README.md # API layering, placement, typing, and request rules
│ ├── components/ # Shared UI components
│ ├── components/ # Shared UI and cross-page business components
│ │ ├── COMPONENT_README.md # Shared component conventions and usage
│ │ ├── business/ # Cross-page business components, imported explicitly
│ │ ├── global/ # Frequently used components auto-registered by Vite
│ │ │ └── mk-icon/ # Unified SVG Symbol and Element Plus icon component
│ │ └── <component-name>/ # Less-frequent shared components imported explicitly
Expand Down Expand Up @@ -95,6 +96,8 @@ Directories marked as reserved may be empty while their feature is being introdu

Structural responsibilities:

- Put cross-page business components in `components/business/`, name them after their business
responsibility without the `Mk` prefix, and keep page-specific components in their owning View.
- Put reusable application chrome in `layout/`, not in individual route views.
- Put server communication in `api/`, isolate Admin and Chat request systems, and group business APIs
by domain and resource according to `src/api/API_README.md`.
Expand Down
1 change: 1 addition & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
},
"dependencies": {
"@element-plus/icons-vue": "^2.3.2",
"@he-tree/vue": "^2.10.5",
"axios": "^1.19.0",
"dingtalk-jsapi": "^3.2.9",
"element-plus": "^2.14.2",
Expand Down
59 changes: 59 additions & 0 deletions ui/src/api/admin/workspace/folder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { del, get, post, put } from '../core/request'
import type {
FolderSource,
WorkspaceFolder,
WorkspaceFolderCreatePayload,
WorkspaceFolderQuery,
WorkspaceFolderUpdatePayload,
} from '@/api/types'

const getPrefix = (workspaceId: string, source: FolderSource) =>
`/workspace/${workspaceId}/${source}/folder`

/** 获取指定资源模块的 Workspace 文件夹树。 */
const getFolderTree = (workspaceId: string, source: FolderSource, query?: WorkspaceFolderQuery) => {
return get<WorkspaceFolder[]>(getPrefix(workspaceId, source), query)
}

/** 获取指定 Workspace 文件夹详情。 */
const getFolderDetail = (workspaceId: string, source: FolderSource, folderId: string) => {
return get<WorkspaceFolder>(`${getPrefix(workspaceId, source)}/${folderId}`)
}

/** 在指定资源模块中创建 Workspace 文件夹。 */
const postFolder = (
workspaceId: string,
source: FolderSource,
payload: WorkspaceFolderCreatePayload,
) => {
return post<WorkspaceFolderCreatePayload, WorkspaceFolder>(
getPrefix(workspaceId, source),
payload,
)
}

/** 更新指定 Workspace 文件夹。 */
const putFolder = (
workspaceId: string,
source: FolderSource,
folderId: string,
payload: WorkspaceFolderUpdatePayload,
) => {
return put<WorkspaceFolderUpdatePayload, WorkspaceFolder>(
`${getPrefix(workspaceId, source)}/${folderId}`,
payload,
)
}

/** 删除指定 Workspace 文件夹及其中的资源。 */
const deleteFolder = (workspaceId: string, source: FolderSource, folderId: string) => {
return del<undefined, boolean>(`${getPrefix(workspaceId, source)}/${folderId}`)
}

export default {
deleteFolder,
getFolderDetail,
getFolderTree,
postFolder,
putFolder,
}
27 changes: 0 additions & 27 deletions ui/src/api/admin/workspace/tool/tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@ import { del, get, post, put } from '../../core/request'
import type { ParamsPage, ResponsePage } from '../../core/types'
import type {
ToolCatalogResponse,
ToolFolder,
ToolFolderPayload,
ToolListQuery,
ToolPayload,
ToolTreeResponse,
WorkspaceTool,
} from '@/api/types'

const getPrefix = (workspaceId: string) => `/workspace/${workspaceId}/tool`
const getFolderPrefix = (workspaceId: string) => `/workspace/${workspaceId}/TOOL/folder`

/** 获取当前目录下的工具和子文件夹。 */
const getToolTree = (workspaceId: string, query?: ToolListQuery) => {
Expand All @@ -31,26 +28,6 @@ const getToolPage = (workspaceId: string, page: ParamsPage, query?: ToolListQuer
)
}

/** 获取工具文件夹树。 */
const getToolFolderTree = (workspaceId: string) => {
return get<ToolFolder[]>(getFolderPrefix(workspaceId))
}

/** 创建工具文件夹。 */
const postToolFolder = (workspaceId: string, payload: ToolFolderPayload) => {
return post<ToolFolderPayload, ToolFolder>(getFolderPrefix(workspaceId), payload)
}

/** 更新工具文件夹。 */
const putToolFolder = (workspaceId: string, folderId: string, payload: ToolFolderPayload) => {
return put<ToolFolderPayload, ToolFolder>(`${getFolderPrefix(workspaceId)}/${folderId}`, payload)
}

/** 删除工具文件夹及其内容。 */
const deleteToolFolder = (workspaceId: string, folderId: string) => {
return del<undefined, boolean>(`${getFolderPrefix(workspaceId)}/${folderId}`)
}

/** 创建工作空间工具。 */
const postTool = (workspaceId: string, payload: ToolPayload) => {
return post<ToolPayload, WorkspaceTool>(getPrefix(workspaceId), payload)
Expand Down Expand Up @@ -93,17 +70,13 @@ const putBatchMoveTools = (workspaceId: string, toolIds: string[], folderId: str

export default {
deleteTool,
deleteToolFolder,
getToolCatalog,
getToolDetail,
getToolFolderTree,
getToolPage,
getToolTree,
postTool,
postToolFolder,
postToolTestConnection,
putBatchDeleteTools,
putBatchMoveTools,
putTool,
putToolFolder,
}
2 changes: 2 additions & 0 deletions ui/src/api/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ export type * from './system-operate-log'
export * from './system-role'
export type * from './system-email'
export * from './workspace-model'
export * from './workspace-folder'
export * from './workspace-tool'
38 changes: 38 additions & 0 deletions ui/src/api/types/workspace-folder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/** Workspace 下多个资源模块共用的文件夹业务类型。 */

export const FOLDER_SOURCE = {
APPLICATION: 'APPLICATION',
KNOWLEDGE: 'KNOWLEDGE',
TOOL: 'TOOL',
} as const

export type FolderSource = (typeof FOLDER_SOURCE)[keyof typeof FOLDER_SOURCE]

export interface WorkspaceFolder {
children?: WorkspaceFolder[]
create_time?: string
desc?: string | null
id: string
name: string
parent_id?: string | null
update_time?: string
user_id?: string | null
workspace_id: string
}

export interface WorkspaceFolderCreatePayload {
desc?: string | null
name: string
parent_id?: string | null
}

export interface WorkspaceFolderUpdatePayload {
desc?: string | null
name?: string
parent_id?: string | null
}

export interface WorkspaceFolderQuery {
name?: string
[key: string]: unknown
}
84 changes: 84 additions & 0 deletions ui/src/api/types/workspace-tool.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/** Workspace 工具列表和工具维护共用的业务类型。 */

import type { WorkspaceFolder } from './workspace-folder'

export const TOOL_SCOPE = {
INTERNAL: 'INTERNAL',
SHARED: 'SHARED',
WORKSPACE: 'WORKSPACE',
} as const

export const TOOL_TYPE = {
CUSTOM: 'CUSTOM',
DATA_SOURCE: 'DATA_SOURCE',
INTERNAL: 'INTERNAL',
MCP: 'MCP',
SKILL: 'SKILL',
WORKFLOW: 'WORKFLOW',
} as const

export type ToolScope = (typeof TOOL_SCOPE)[keyof typeof TOOL_SCOPE]
export type ToolType = (typeof TOOL_TYPE)[keyof typeof TOOL_TYPE]

export interface WorkspaceTool {
code?: string
create_time?: string
desc?: string | null
folder_id?: string
icon?: string
id: string
init_field_list?: Record<string, unknown>[]
init_params?: Record<string, unknown> | string | null
input_field_list?: Record<string, unknown>[]
is_active: boolean
label?: string | null
name: string
nick_name?: string | null
scope: ToolScope
source?: 'shared' | 'workspace'
template_id?: string | null
tool_type: ToolType
update_time?: string
user_id?: string | null
version?: string | null
workspace_id: string
}

export interface ToolCatalogResponse {
shared_tools: WorkspaceTool[]
tools: WorkspaceTool[]
}

export interface ToolTreeResponse {
folders: WorkspaceFolder[]
tools: WorkspaceTool[]
}

export interface ToolListQuery {
create_user?: string
folder_id?: string
name?: string
scope?: ToolScope
tool_type?: ToolType
'tool_type_list[]'?: ToolType[]
[key: string]: unknown
}

export interface ToolPayload {
code?: string
desc?: string | null
folder_id?: string | null
icon?: string
init_field_list?: Record<string, unknown>[]
init_params?: Record<string, unknown> | null
input_field_list?: Record<string, unknown>[]
is_active?: boolean
name?: string
scope?: ToolScope
tool_type?: ToolType
}

export interface AddStoreToolPayload {
folder_id?: string | null
name?: string
}
2 changes: 1 addition & 1 deletion ui/src/assets/iconfont.js

Large diffs are not rendered by default.

Loading
Loading