From c3e4947270772257c5387ecfaa7c98cb776643d7 Mon Sep 17 00:00:00 2001 From: Evan <91367930+evan-crash@users.noreply.github.com> Date: Thu, 7 Aug 2025 16:57:04 +0800 Subject: [PATCH] chore(frontend): remove duplicated file (#633) --- frontend/apps/coze-studio/src/routes.tsx | 321 ----------------------- 1 file changed, 321 deletions(-) delete mode 100644 frontend/apps/coze-studio/src/routes.tsx diff --git a/frontend/apps/coze-studio/src/routes.tsx b/frontend/apps/coze-studio/src/routes.tsx deleted file mode 100644 index df4a7f2b..00000000 --- a/frontend/apps/coze-studio/src/routes.tsx +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright 2025 coze-dev Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { createBrowserRouter, Navigate } from 'react-router-dom'; -import { lazy } from 'react'; - -import { SpaceSubModuleEnum } from '@coze-foundation/space-ui-adapter'; -import { GlobalError } from '@coze-foundation/layout'; -import { BaseEnum } from '@coze-arch/web-context'; - -import { exploreRouter } from './pages/explore'; -import { Layout } from './layout'; -const subMenu = lazy(() => - import('@coze-foundation/space-ui-adapter').then(exps => ({ - default: exps.WorkspaceSubMenu, - })), -); - -const SpaceLayout = lazy(() => - import('@coze-foundation/space-ui-adapter').then(exps => ({ - default: exps.SpaceLayout, - })), -); - -const SpaceIdLayout = lazy(() => - import('@coze-foundation/space-ui-base').then(exps => ({ - default: exps.SpaceIdLayout, - })), -); - -const KnowledgePreview = lazy(() => - import('@coze-studio/workspace-base/knowledge-preview').then(exps => ({ - default: exps.KnowledgePreviewPage, - })), -); - -const KnowledgeUpload = lazy(() => - import('@coze-studio/workspace-base/knowledge-upload').then(exps => ({ - default: exps.KnowledgeUploadPage, - })), -); - -const DatabaseDetail = lazy(() => - import('@coze-studio/workspace-base').then(exps => ({ - default: exps.DatabaseDetailPage, - })), -); - -const AgentIDELayout = lazy(() => import('@coze-agent-ide/layout-adapter')); - -const AgentIDE = lazy(() => - import('@coze-agent-ide/entry-adapter').then(res => ({ - default: res.BotEditor, - })), -); - -const IDELayout = lazy(() => - import('@coze-project-ide/main').then(exps => ({ - default: exps.IDELayout, - })), -); - -const IDEPublish = lazy(() => - import('@coze-studio/project-publish').then(exps => ({ - default: exps.ProjectPublish, - })), -); - -const Develop = lazy(() => import('./pages/develop')); -const Library = lazy(() => import('./pages/library')); - -const WorkflowPage = lazy(() => - import('@coze-workflow/playground-adapter').then(res => ({ - default: res.WorkflowPage, - })), -); - -const PluginPageLayout = lazy(() => import('./pages/plugin/layout')); -const PluginPage = lazy(() => import('./pages/plugin/page')); -const PluginToolPage = lazy(() => import('./pages/plugin/tool/page')); -const PluginMocksetPage = lazy( - () => import('./pages/plugin/tool/plugin-mock-set/page'), -); -const PluginMocksetDetailPage = lazy( - () => import('./pages/plugin/tool/plugin-mock-set/detail/page'), -); - -const LoginPage = lazy(() => - import('@coze-foundation/account-ui-adapter').then(res => ({ - default: res.LoginPage, - })), -); - -const AgentPublishPage = lazy(() => - import('@coze-agent-ide/agent-publish').then(exps => ({ - default: exps.AgentPublishPage, - })), -); - -const DocsRedirect = lazy(() => import('./pages/docs')); -const Redirect = lazy(() => import('./pages/redirect')); - -export const router: ReturnType = - createBrowserRouter([ - { - path: '/open/docs/*', - Component: DocsRedirect, - loader: () => ({ - hasSider: false, - requireAuth: false, - }), - }, - { - path: '/docs/*', - Component: DocsRedirect, - loader: () => ({ - hasSider: false, - requireAuth: false, - }), - }, - { - path: '/information/auth/success', - Component: Redirect, - loader: () => ({ - hasSider: false, - requireAuth: false, - }), - }, - { - path: '/', - Component: Layout, - errorElement: , - children: [ - { - index: true, - element: , - }, - exploreRouter, - { - path: 'sign', - Component: LoginPage, - errorElement: , - loader: () => ({ - hasSider: false, - requireAuth: false, - }), - }, - { - path: 'space', - Component: SpaceLayout, - loader: () => ({ - hasSider: true, - requireAuth: true, - subMenu, - menuKey: BaseEnum.Space, - }), - children: [ - { - path: ':space_id', - Component: SpaceIdLayout, - children: [ - { - index: true, - element: , - }, - { - path: 'develop', - Component: Develop, - loader: () => ({ - subMenuKey: SpaceSubModuleEnum.DEVELOP, - }), - }, - { - path: 'project-ide/:project_id/publish', - loader: () => ({ - hasSider: false, - }), - Component: IDEPublish, - }, - { - path: 'project-ide/:project_id/*', - Component: IDELayout, - loader: () => ({ - hasSider: false, - }), - }, - { - path: 'library', - Component: Library, - loader: () => ({ - subMenuKey: SpaceSubModuleEnum.LIBRARY, - }), - }, - { - path: 'project-ide/:project_id/*', - Component: IDELayout, - loader: () => ({ - hasSider: false, - }), - }, - { - path: 'knowledge', - children: [ - { - path: ':dataset_id', - element: , - }, - { - path: ':dataset_id/upload', - element: , - }, - ], - loader: () => ({ - pageModeByQuery: true, - }), - }, - { - path: 'database', - children: [ - { - path: ':table_id', - element: , - }, - ], - loader: () => ({ - showMobileTips: true, - pageModeByQuery: true, - }), - }, - { - path: 'bot/:bot_id', - Component: AgentIDELayout, - children: [ - { - index: true, - Component: AgentIDE, - }, - { - path: 'publish', - children: [ - { - index: true, - Component: AgentPublishPage, - loader: () => ({ - hasSider: false, - requireBotEditorInit: false, - pageName: 'publish', - }), - }, - ], - }, - ], - loader: () => ({ - hasSider: false, - showMobileTips: true, - requireBotEditorInit: true, - pageName: 'bot', - }), - }, - { - path: 'plugin/:plugin_id', - Component: PluginPageLayout, - children: [ - { - index: true, - Component: PluginPage, - }, - { - path: 'tool/:tool_id', - children: [ - { - index: true, - Component: PluginToolPage, - }, - { - path: 'plugin-mock-set', - Component: PluginMocksetPage, - children: [ - { - path: ':mock_set_id', - children: [ - { - index: true, - Component: PluginMocksetDetailPage, - }, - ], - }, - ], - }, - ], - }, - ], - }, - ], - }, - ], - }, - { - path: 'work_flow', - Component: WorkflowPage, - loader: () => ({ - hasSider: false, - requireAuth: true, - }), - }, - ], - }, - ]);