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/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,14 @@ Keep these behaviors:
- `base: './'` for v2-compatible static deployment.
- `envDir: './env'`.
- Proxy `/admin/api`, `/chat/api`, `/doc`, `/schema`, `/static`, and `oss` file paths to the backend.
- Keep Tailwind, Vue, Vue JSX, Element Plus auto import, and component auto registration plugins.
- Keep Tailwind, Vue, Vue JSX, and component auto registration plugins.
- Do not add `unplugin-vue-define-options`; Vue 3.5 already supports `defineOptions`.
- Avoid adding `vite-plugin-html` unless multi-template requirements exceed Vite's built-in HTML env replacement.

## Frontend Implementation Notes

- Prefer existing project structure and naming.
- Keep UI code typed and data-driven.
- Explicitly import APIs used from Vue, Vue Router, and Pinia; do not restore API auto import.
- Name business variables after their domain and purpose. Avoid context-free collection names such as
`items` or `list` when a name such as `systemMenuItems` makes the contents clear.
1 change: 0 additions & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"sass": "^1.101.0",
"tailwindcss": "^4.3.2",
"typescript": "~6.0.0",
"unplugin-auto-import": "^21.0.0",
"unplugin-vue-components": "^32.1.0",
"vite": "^8.0.16",
"vue-eslint-parser": "^10.4.1",
Expand Down
37 changes: 37 additions & 0 deletions ui/src/api/admin/workspace/application.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { get, put } from '../core/request'
import type { ParamsPage, ResponsePage } from '../core/types'
import type {
ApplicationDetail,
ApplicationFormPayload,
RequestParams,
} from '@/api/types'
import { getWorkspaceId } from '@/utils/workspace-context'

const getPrefix = () => {
const workspaceId = getWorkspaceId()
return `/workspace/${workspaceId}/application`
}

/** 获取工作空间智能体列表。 */
const getApplicationPage = (page: ParamsPage, query?: RequestParams) => {
return get<ResponsePage<ApplicationDetail>>(
`${getPrefix()}/${page.currentPage}/${page.pageSize}`,
query,
)
}

/** 获取工作空间智能体详情。 */
const getApplicationDetail = (applicationId: string) => {
return get<ApplicationDetail>(`${getPrefix()}/${applicationId}`)
}

/** 保存工作空间智能体配置。 */
const putApplication = (applicationId: string, data: ApplicationFormPayload) => {
return put<ApplicationFormPayload, ApplicationDetail>(`${getPrefix()}/${applicationId}`, data)
}

export default {
getApplicationPage,
getApplicationDetail,
putApplication,
}
5 changes: 5 additions & 0 deletions ui/src/api/enums/application.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** 后端智能体类型枚举值。 */
export const APPLICATION_TYPE = {
SIMPLE: 'SIMPLE',
WORK_FLOW: 'WORK_FLOW',
} as const
1 change: 1 addition & 0 deletions ui/src/api/enums/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/** API 枚举值的唯一公共入口。 */
export * from './application'
export * from './folder'
export * from './login'
export * from './system-role'
Expand Down
70 changes: 70 additions & 0 deletions ui/src/api/types/application.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/** Workspace 智能体列表及其卡片共用的业务类型。 */

import type LogicFlow from '@logicflow/core'
import { APPLICATION_TYPE } from '@/api/enums'

export type ApplicationType = (typeof APPLICATION_TYPE)[keyof typeof APPLICATION_TYPE]

export interface ApplicationDetail {
create_time?: string
desc?: string | null
folder_id?: string
icon?: string
id: string
is_portal: boolean
is_publish: boolean
name: string
nick_name?: string | null
publish_time?: string | null
resource_count?: number
resource_type: string
type: ApplicationType
update_time?: string
user_id?: string | null
workspace_id?: string
work_flow?: LogicFlow.GraphConfigData
}

export interface ApplicationFormPayload {
name?: string
desc?: string
model_id?: string
dialogue_number?: number
prologue?: string
knowledge_id_list?: string[]
knowledge_setting?: Record<string, unknown>
model_setting?: Record<string, unknown>
problem_optimization?: boolean
problem_optimization_prompt?: string
icon?: string
type?: ApplicationType
work_flow?: LogicFlow.GraphData
model_params_setting?: Record<string, unknown>
tts_model_params_setting?: Record<string, unknown>
stt_model_params_setting?: Record<string, unknown>
stt_model_id?: string
tts_model_id?: string
stt_model_enable?: boolean
tts_model_enable?: boolean
tts_type?: string
tts_autoplay?: boolean
stt_autosend?: boolean
folder_id?: string
workspace_id?: string
mcp_enable?: boolean
mcp_servers?: string
mcp_tool_ids?: string[]
mcp_source?: string
tool_enable?: boolean
tool_ids?: string[]
application_enable?: boolean
application_ids?: string[]
skill_tool_ids?: string[]
mcp_output_enable?: boolean
work_flow_template?: Record<string, unknown>
long_term_enable?: boolean
long_term_model_id?: string
long_term_model_params_setting?: Record<string, unknown>
long_term_trigger_setting?: Record<string, unknown>
long_term_trigger_type?: string
}
1 change: 1 addition & 0 deletions ui/src/api/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/** API 与 View 或 Component 跨层业务类型的唯一公共入口。 */
export type * from './application'
export type * from './common'
export type * from './chat-user'
export type * from './chat-user-groups'
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/iconfont.js

Large diffs are not rendered by default.

90 changes: 0 additions & 90 deletions ui/src/auto-imports.d.ts

This file was deleted.

8 changes: 5 additions & 3 deletions ui/src/components/business/folder-tree/index.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import type { FolderSource, FolderItem } from '@/api/types'
import FolderApi from '@/api/admin/workspace/folder'
import type { FolderSource, FolderItem } from '@/api/types'
import { FOLDER_SOURCE } from '@/api/enums'
import { FOLDER_SORT, type FolderSort } from './types'
import { FOLDER_ENTRIES, FOLDER_ENTRY_ID } from '@/constants'
import { MsgSuccess } from '@/utils/message'
import MkListItem from '@/components/mk-search-list/mk-list-item.vue'
import VirtualizedTree from './VirtualizedTree.vue'
import { FOLDER_SORT, type FolderSort } from './types'
import { FOLDER_ENTRIES, FOLDER_ENTRY_ID } from '@/constants'
import { useStore } from '@/stores'
import { getWorkspaceId } from '@/utils/workspace-context'

Expand Down Expand Up @@ -322,6 +323,7 @@ defineExpose({ refresh: loadFolders })

<div class="px-4 mb-1">
<MkListItem
v-if="source !== FOLDER_SOURCE.APPLICATION"
:active="currentNodeKey === folderEntries.shared.id"
@click="handleFolderClick(folderEntries.shared)"
>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/business/model-select/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
import { computed, onMounted, ref } from 'vue'
import { Check } from '@element-plus/icons-vue'
import ProviderApi from '@/api/admin/workspace/model/provider'
import { MODEL_STATUS } from '@/api/enums'
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/global/mk-complex-search/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed } from 'vue'
import { computed, ref } from 'vue'
import type { OptionItem } from '@/api/types'

defineOptions({ name: 'MkComplexSearch' })
Expand Down
1 change: 1 addition & 0 deletions ui/src/components/global/mk-empty/index.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { computed } from 'vue'
import noDataImage from '@/assets/empty/no-data.svg'
import noSearchResultsImage from '@/assets/empty/no-search-results.svg'

Expand Down
4 changes: 3 additions & 1 deletion ui/src/layout/LayoutHeader.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script setup lang="ts">
import { useRouter } from 'vue-router'

import AvatarDropdown from './avatar-dropdown/index.vue'
import WorkspaceDropdown from './workspace-dropdown/index.vue'
import { isWorkspace, isSystem } from '@/router/admin/utils'
Expand Down Expand Up @@ -40,7 +42,7 @@ function switchMode() {
</el-button>
<el-divider direction="vertical" />
<el-button v-if="isWorkspace(mode)" class="-mx-1" text @click="switchMode">
<MkIcon name="icon_admin_outlined" />
<MkIcon name="icon_admin_outlined" />
<span>系统管理</span>
</el-button>
<!-- TODO 只有系统管理员权限没有返回工作空间 -->
Expand Down
18 changes: 9 additions & 9 deletions ui/src/router/ROUTE_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ src/router/
│ ├── system/
│ │ ├── index.ts # 系统管理路由汇总
│ │ └── modules/
│ │ ├── agent.ts # System 来源的智能体详情路由
│ │ ├── application.ts # System 来源的智能体详情路由
│ │ └── knowledge.ts # System 来源的知识库详情路由
│ └── workspace/
│ ├── index.ts # 工作空间模块汇总
│ └── modules/
│ ├── home.ts # 首页
│ ├── agent.ts # 智能体
│ ├── application.ts # 智能体
│ ├── knowledge.ts # 知识库
│ ├── tool.ts # 工具
│ ├── model.ts # 模型
Expand Down Expand Up @@ -70,7 +70,7 @@ Login、Workflow 路由没有挂载 `AppLayout`,因此不会出现在左侧导
- `workflow`:集中维护各业务的全屏画布路由,当前包含智能体工作流,后续知识库等画布继续在
`admin/workflow/index.ts` 中注册。
- Workflow 统一使用 `/workflow/<canvas-type>/:resourceId` 结构;当前智能体工作流地址为
`/workflow/agent/:agentId`。智能体页面使用新标签打开该地址;路由参数
`/workflow/application/:applicationId`。智能体页面使用新标签打开该地址;路由参数
只保留智能体标识,页面当前不请求接口。

登录页面地址为 `/login`;忘记密码使用独立页面 `/forgot-password`,两者均复用登录布局且不挂载 `AppLayout`。
Expand Down Expand Up @@ -152,17 +152,17 @@ const route = useRoute()
const mode = computed(() => route.meta.scope ?? 'workspace')
```

## Agent 和 Knowledge 路由层级
## Application 和 Knowledge 路由层级

Workspace 页面:

```text
/admin/workspace/:workspaceId/tools
/admin/workspace/:workspaceId/model

/admin/workspace/:workspaceId/agent
/admin/workspace/:workspaceId/agent/:agentId
/admin/workspace/:workspaceId/agent/:agentId/edit
/admin/workspace/:workspaceId/application
/admin/workspace/:workspaceId/application/:applicationId
/admin/workspace/:workspaceId/application/:applicationId/edit

/admin/workspace/:workspaceId/knowledge
/admin/workspace/:workspaceId/knowledge/:knowledgeId
Expand All @@ -172,8 +172,8 @@ Workspace 页面:
System 复用页面(仅替换根前缀):

```text
/admin/system/agent/:agentId
/admin/system/agent/:agentId/edit
/admin/system/application/:applicationId
/admin/system/application/:applicationId/edit

/admin/system/knowledge/:knowledgeId
/admin/system/knowledge/:knowledgeId/document/:documentId
Expand Down
4 changes: 2 additions & 2 deletions ui/src/router/admin/system/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RouteRecordRaw } from 'vue-router'
import { systemAgentRoutes } from './modules/agent'
import { systemApplicationRoutes } from './modules/application'
import { systemKnowledgeRoutes } from './modules/knowledge'

export const systemRoutes: RouteRecordRaw = {
Expand Down Expand Up @@ -93,7 +93,7 @@ export const systemRoutes: RouteRecordRaw = {
},
],
},
...systemAgentRoutes,
...systemApplicationRoutes,
...systemKnowledgeRoutes,
{
path: 'share',
Expand Down
17 changes: 0 additions & 17 deletions ui/src/router/admin/system/modules/agent.ts

This file was deleted.

Loading
Loading