Quellcode durchsuchen

feat: 添加系统相关接口

jiaxing.liao vor 4 Tagen
Ursprung
Commit
42edec8e91

+ 17 - 2
apps/web/src/components/Sidebar/index.vue

@@ -65,7 +65,11 @@
 			</div>
 		</div>
 
-		<el-menu :default-active="activeMenu" router class="el-menu-vertical-demo main-menu">
+		<el-menu
+			:default-active="activeMenu"
+			class="el-menu-vertical-demo main-menu"
+			@select="handleMainMenuSelect"
+		>
 			<el-menu-item v-for="item in sidebarMainMenu" :key="item.path" :index="item.path">
 				<el-tooltip v-if="collapsed" :content="item.label" placement="right">
 					<span>
@@ -134,7 +138,7 @@ import { useI18n } from '@/composables/useI18n'
 import { applyTheme } from '@/theme'
 import { getSidebarBottomMenu, getSidebarMainMenu, type SidebarBottomMenuItem } from '@/config/menu'
 
-import logo from '@/assets/logo.svg'
+import defaultLogo from '@/assets/logo.svg'
 
 const SearchDialog = defineAsyncComponent(() => import('../SearchDialog/index.vue'))
 const TemplateModal = defineAsyncComponent(() => import('../TemplateModal/index.vue'))
@@ -144,6 +148,8 @@ const emit = defineEmits<{
 	'settings-menu-toggle': [position: { top: number; left: number }, name: string]
 }>()
 
+const logo = window?.$systemConfig?.commonConfig?.webIcon || defaultLogo
+
 const router = useRouter()
 const { t, locale } = useI18n()
 const collapsed = ref(false)
@@ -178,6 +184,15 @@ const isBottomMenuItemActive = (item: SidebarBottomMenuItem) => {
 	return false
 }
 
+const handleMainMenuSelect = (path: string) => {
+	if (path === '/chat') {
+		window.open('#/chat', '_blank')
+		return
+	}
+
+	router.push(path)
+}
+
 const toggle = () => {
 	collapsed.value = !collapsed.value
 }

+ 5 - 5
apps/web/src/router/index.ts

@@ -61,11 +61,6 @@ const routes = [
 				name: 'FlowManagement',
 				component: AgentManager
 			},
-			{
-				path: 'chat',
-				name: 'Chat',
-				component: Chat
-			},
 			{
 				path: 'quick-start',
 				name: 'QuickStart',
@@ -162,6 +157,11 @@ const routes = [
 		path: '/workflow/:id',
 		name: 'Editor',
 		component: Editor
+	},
+	{
+		path: '/chat',
+		name: 'Chat',
+		component: Chat
 	}
 ]
 

+ 4 - 1
packages/api-service/index.ts

@@ -4,6 +4,7 @@ import knowledgeApi from './servers/knowledge/api'
 import aiChatApi from './servers/ai-chat/api'
 import resourceApi from './servers/resource/api'
 import vectorApi from './servers/vector/api'
+import systemApi from './servers/system/api'
 
 const agent = agentApi.agent
 const agentApplication = agentApi.agentApplication
@@ -17,6 +18,7 @@ const aiChat = aiChatApi.aiChat
 const resource = resourceApi.resource
 const agentLog = agentApi.agentLog
 const vector = vectorApi.vector
+const system = systemApi.system
 
 export {
 	agent,
@@ -30,5 +32,6 @@ export {
 	aiChat,
 	resource,
 	agentLog,
-	vector
+	vector,
+	system
 }

+ 5 - 0
packages/api-service/openapi2ts.config.ts

@@ -30,5 +30,10 @@ export default [
 		schemaPath: path.resolve(__dirname, './schema/vector.openapi.json'),
 		serversPath: './servers/vector',
 		requestLibPath: "import request from '@repo/api-client'"
+	},
+	{
+		schemaPath: path.resolve(__dirname, './schema/system.openapi.json'),
+		serversPath: './servers/system',
+		requestLibPath: "import request from '@repo/api-client'"
 	}
 ]

Datei-Diff unterdrückt, da er zu groß ist
+ 1531 - 0
packages/api-service/schema/system.openapi.json


+ 8 - 0
packages/api-service/servers/system/api/index.ts

@@ -0,0 +1,8 @@
+// @ts-ignore
+/* eslint-disable */
+// API 更新时间:
+// API 唯一标识:
+import * as system from './system'
+export default {
+  system
+}

+ 179 - 0
packages/api-service/servers/system/api/system.ts

@@ -0,0 +1,179 @@
+// @ts-ignore
+/* eslint-disable */
+import request from '@repo/api-client'
+
+/** 获取当前用户信息 状态 0: 已创建  1: 运行中  2: 成功  3: 失败  4: 挂起 POST /api/account/curUserInfo */
+export async function postAccountCurUserInfo(body: {}, options?: { [key: string]: any }) {
+  return request<{
+    isSuccess: boolean
+    code: number
+    result: {
+      account: string
+      cellPhone: string
+      employeeNumber: string
+      enterpriseName: string
+      id: string
+      isLoginToB: boolean
+      isOut: number
+      isSuperAdmin: boolean
+      langName: string
+      language: string
+      name: string
+    }
+    isAuthorized: boolean
+  }>('/api/account/curUserInfo', {
+    method: 'POST',
+    headers: {
+      'Content-Type': 'application/json'
+    },
+    data: body,
+    ...(options || {})
+  })
+}
+
+/** 查询异步任务状态 状态 0: 已创建  1: 运行中  2: 成功  3: 失败  4: 挂起 POST /api/bpm/getAsynTaskInfo */
+export async function postBpmGetAsynTaskInfo(
+  body: {
+    id: string
+  },
+  options?: { [key: string]: any }
+) {
+  return request<{
+    isSuccess: boolean
+    code: number
+    result: {
+      appPageCode: string
+      argsInput: { args: { name?: string; value?: string }[] }
+      code: string
+      creationTime: string
+      creatorUserId: string
+      downFileId: string
+      entityId: string
+      fileId: string
+      htmlStatusInfo: string
+      id: string
+      isDeleted: boolean
+      nodeId: string
+      params: string
+      progress: string
+      status: number
+      taskId: string
+      type: number
+      updateTime: string
+    }
+    isAuthorized: boolean
+  }>('/api/bpm/getAsynTaskInfo', {
+    method: 'POST',
+    headers: {
+      'Content-Type': 'application/json'
+    },
+    data: body,
+    ...(options || {})
+  })
+}
+
+/** 获取左边菜单列表 状态 0: 已创建  1: 运行中  2: 成功  3: 失败  4: 挂起 POST /api/menu/leftMenuList */
+export async function postMenuLeftMenuList(
+  body: {
+    menuCode: string
+  },
+  options?: { [key: string]: any }
+) {
+  return request<{
+    isSuccess: boolean
+    code: number
+    result: {
+      bindLink: boolean
+      code: string
+      deleted: boolean
+      dynamicMenuLink: string
+      enableApply: boolean
+      enableMobile: boolean
+      fullName: string
+      fullPath: string
+      iconColor: string
+      id: string
+      isBindLink: boolean
+      isDeleted: boolean
+      isFavourite: boolean
+      isManuallyCreate: boolean
+      langName: string
+      languageCulture: string
+      link: string
+      linkId: string
+      linkType: number
+      linkWorkflowId: string
+      manuallyCreate: boolean
+      menuDepth: number
+      menuIndex: number
+      menuType: number
+      name: string
+      openType: number
+      parentId: string
+      subMenuList: {
+        bindLink: boolean
+        code: string
+        deleted: boolean
+        dynamicMenuLink: string
+        enableApply: boolean
+        enableMobile: boolean
+        fullName: string
+        fullPath: string
+        iconColor: string
+        id: string
+        isBindLink: boolean
+        isDeleted: boolean
+        isFavourite: boolean
+        isManuallyCreate: boolean
+        langName: string
+        languageCulture: string
+        link: string
+        linkId: string
+        linkType: number
+        linkWorkflowId: string
+        manuallyCreate: boolean
+        menuDepth: number
+        menuIndex: number
+        menuType: number
+        name: string
+        openType: number
+        parentId: string
+        subMenuList: string[]
+        target: string
+        targetName: string
+        ts: { value: string }
+      }[]
+      target: string
+      targetName: string
+      ts: { value: string }
+    }
+    isAuthorized: boolean
+  }>('/api/menu/leftMenuList', {
+    method: 'POST',
+    headers: {
+      'Content-Type': 'application/json'
+    },
+    data: body,
+    ...(options || {})
+  })
+}
+
+/** 根据菜单编号,获取用户已授权的菜单按钮编号列表 状态 0: 已创建  1: 运行中  2: 成功  3: 失败  4: 挂起 POST /api/menubutton/authorised */
+export async function postMenubuttonAuthorised(
+  body: {
+    menuCode: string
+  },
+  options?: { [key: string]: any }
+) {
+  return request<{ isSuccess: boolean; code: number; result: string[]; isAuthorized: boolean }>(
+    '/api/menubutton/authorised',
+    {
+      method: 'POST',
+      headers: {
+        'Content-Type': 'application/json'
+      },
+      data: body,
+      ...(options || {})
+    }
+  )
+}

+ 67 - 0
packages/api-service/servers/system/api/typings.d.ts

@@ -0,0 +1,67 @@
+declare namespace API {
+  type AgentNode = {
+    appAgentId: string
+    creationTime: string
+    creatorUserId: string
+    data: NodeData
+    height?: number
+    id: string
+    isDeleted?: boolean
+    position: { x: number; y: number }
+    selected?: boolean
+    type: 'custom' | 'start' | 'end' | 'condition' | 'task' | 'http-request'
+    updateTime?: string
+    width?: number
+    zIndex?: number
+  }
+
+  type HttpHeader = {
+    name: string
+    value: string
+  }
+
+  type NodeData = {
+    outputs: {
+      name: string
+      describe: string
+      type: 'string' | 'number' | 'boolean' | 'object' | 'array'
+    }[]
+    output_can_alter?: boolean
+    variables?: string[]
+    method: 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'options'
+    ssl_verify?: boolean
+    isInIteration?: boolean
+    default_value?: string[]
+    body?: RequestBody
+    params?: string[]
+    title: string
+    type: 'http-request' | 'condition' | 'task'
+    error_strategy?: 'none' | 'retry' | 'abort' | 'continue'
+    retry_config?: { max_retries: number; retry_enabled: boolean; retry_interval: number }
+    url: string
+    authorization?: {
+      type: 'none' | 'bearer' | 'basic' | 'api-key'
+      config: { api_key?: string; header?: string; type?: string }
+    }
+    timeout_config?: {
+      max_write_timeout: number
+      max_read_timeout: number
+      max_connect_timeout: number
+    }
+    heads?: HttpHeader[]
+    selected?: boolean
+    desc?: string
+    isInLoop?: boolean
+  }
+
+  type RequestBody = {
+    data: RequestDataItem[]
+    type: 'json' | 'form-data' | 'x-www-form-urlencoded' | 'raw' | 'binary'
+  }
+
+  type RequestDataItem = {
+    type: 'text' | 'file' | 'json'
+    value: string
+    key?: string
+  }
+}